From c3e092033e39c153e8260ddbe99f674f22fb165c Mon Sep 17 00:00:00 2001 From: Deepashree Sengupta Date: Wed, 12 Aug 2026 17:36:54 +0000 Subject: [PATCH] Fix quadratic stampEqns() in PrimaDelayCalc by reserving sparse matrix columns (#486) * support for filter in get_scene/mode Signed-off-by: dsengupta0628 * fix the openroad timeout issue Signed-off-by: dsengupta0628 --------- Signed-off-by: dsengupta0628 --- dcalc/PrimaDelayCalc.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dcalc/PrimaDelayCalc.cc b/dcalc/PrimaDelayCalc.cc index 2ff493a2..a90ace47 100644 --- a/dcalc/PrimaDelayCalc.cc +++ b/dcalc/PrimaDelayCalc.cc @@ -598,6 +598,13 @@ PrimaDelayCalc::stampEqns() C_.setZero(); B_.setZero(); + // The stamps below do not visit the nodes in index order. Reserve room in + // each column so an out of order coeffRef() insert does not shift the packed + // array to make room, which makes stamping quadratic in the node count. + constexpr int non_zero_entry_count = 8; + G_.reserve(Eigen::VectorXi::Constant(order_, non_zero_entry_count)); + C_.reserve(Eigen::VectorXi::Constant(order_, non_zero_entry_count)); + NetSet drvr_nets(network_); for (ArcDcalcArg &dcalc_arg : *dcalc_args_) { const Net *net = dcalc_arg.drvrNet(network_);