Skip to content

Commit 8b20b1d

Browse files
committed
rsz: Measure 'wire stepping' runtime
Output can be seen by adding set_debug RSZ rebuffer 1 before timing-driven global placement. See below for sample output: [INFO RSZ-0038] Inserted 343 buffers in 30 nets. Iter | Area | Removed | Inserted | Pins | | Buffers | Buffers | Remaining ------------------------------------------------------- 0 | +0.0% | 0 | 0 | 60301 6000 | +1.4% | 0 | 936 | 54301 12000 | +3.2% | 0 | 2210 | 48301 18000 | +3.3% | 0 | 2307 | 42301 24000 | +3.8% | 0 | 2632 | 36301 30000 | +4.2% | 0 | 2874 | 30301 36000 | +4.7% | 0 | 3231 | 24301 42000 | +5.3% | 0 | 3650 | 18301 48000 | +5.7% | 0 | 3922 | 12301 54000 | +6.7% | 93 | 4870 | 6301 60000 | +6.5% | 242 | 5111 | 301 final | +6.2% | 343 | 5254 | 0 ------------------------------------------------------- [DEBUG RSZ-rebuffer] Time spent [DEBUG RSZ-rebuffer] ---------- [DEBUG RSZ-rebuffer] STA 5.17 [DEBUG RSZ-rebuffer] Buffer for timing 5.04 [DEBUG RSZ-rebuffer] of which long wire stepping 0.00 [DEBUG RSZ-rebuffer] Recover area 3.78 Signed-off-by: Martin Povišer <[email protected]>
1 parent d5b06a5 commit 8b20b1d

File tree

2 files changed

+37
-27
lines changed

2 files changed

+37
-27
lines changed

src/rsz/src/Rebuffer.cc

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,33 @@ using BnetSeq = BufferedNetSeq;
6464
using BnetPtr = BufferedNetPtr;
6565
using BnetMetrics = BufferedNet::Metrics;
6666

67+
class ScopedTimer
68+
{
69+
public:
70+
using Clock = std::chrono::steady_clock;
71+
72+
ScopedTimer(Logger* logger, double& accumulator)
73+
: logger_(logger), accumulator_(accumulator)
74+
{
75+
if (logger_->debugCheck(RSZ, "rebuffer", 1)) {
76+
start_ = Clock::now();
77+
}
78+
}
79+
80+
~ScopedTimer()
81+
{
82+
if (logger_->debugCheck(RSZ, "rebuffer", 1)) {
83+
accumulator_
84+
+= std::chrono::duration<double>{Clock::now() - start_}.count();
85+
}
86+
}
87+
88+
private:
89+
Logger* logger_;
90+
double& accumulator_;
91+
std::chrono::time_point<Clock> start_;
92+
};
93+
6794
// Template magic to make it easier to write algorithms descending
6895
// over the buffer tree in the form of lambdas; it allows recursive
6996
// lambda calling and it keeps track of the level number which is important
@@ -652,6 +679,7 @@ BnetPtr Rebuffer::bufferForTiming(const BnetPtr& tree,
652679
return opts1;
653680
}
654681

682+
ScopedTimer timer(logger_, long_wire_stepping_runtime_);
655683
int round = 0;
656684
while (location != node->location()) {
657685
debugPrint(logger_,
@@ -1977,33 +2005,6 @@ int Rebuffer::fanout(Vertex* vertex) const
19772005
return fanout;
19782006
}
19792007

1980-
class ScopedTimer
1981-
{
1982-
public:
1983-
using Clock = std::chrono::steady_clock;
1984-
1985-
ScopedTimer(Logger* logger, double& accumulator)
1986-
: logger_(logger), accumulator_(accumulator)
1987-
{
1988-
if (logger_->debugCheck(RSZ, "rebuffer", 1)) {
1989-
start_ = Clock::now();
1990-
}
1991-
}
1992-
1993-
~ScopedTimer()
1994-
{
1995-
if (logger_->debugCheck(RSZ, "rebuffer", 1)) {
1996-
accumulator_
1997-
+= std::chrono::duration<double>{Clock::now() - start_}.count();
1998-
}
1999-
}
2000-
2001-
private:
2002-
Logger* logger_;
2003-
double& accumulator_;
2004-
std::chrono::time_point<Clock> start_;
2005-
};
2006-
20072008
void Rebuffer::setPin(Pin* drvr_pin)
20082009
{
20092010
// set rebuffering globals
@@ -2035,6 +2036,7 @@ void Rebuffer::setPin(Pin* drvr_pin)
20352036
void Rebuffer::fullyRebuffer(Pin* user_pin)
20362037
{
20372038
double sta_runtime = 0, bft_runtime = 0, ra_runtime = 0;
2039+
long_wire_stepping_runtime_ = 0;
20382040

20392041
init();
20402042
resizer_->ensureLevelDrvrVertices();
@@ -2333,6 +2335,12 @@ void Rebuffer::fullyRebuffer(Pin* user_pin)
23332335
debugPrint(logger_, RSZ, "rebuffer", 1, "STA {:.2f}", sta_runtime);
23342336
debugPrint(
23352337
logger_, RSZ, "rebuffer", 1, "Buffer for timing {:.2f}", bft_runtime);
2338+
debugPrint(logger_,
2339+
RSZ,
2340+
"rebuffer",
2341+
1,
2342+
" of which long wire stepping {:.2f}",
2343+
long_wire_stepping_runtime_);
23362344
debugPrint(logger_, RSZ, "rebuffer", 1, "Recover area {:.2f}", ra_runtime);
23372345
}
23382346

src/rsz/src/Rebuffer.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ class Rebuffer : public sta::dbStaState
172172
static constexpr float elmore_skew_factor_ = 1.39;
173173
static constexpr float relaxation_factor_ = 0.01;
174174

175+
double long_wire_stepping_runtime_ = 0;
176+
175177
friend class RepairSetup;
176178
friend class BufferMove;
177179
};

0 commit comments

Comments
 (0)