From d53029aba13e92efdcfdd698df3f41a3d25d9ff1 Mon Sep 17 00:00:00 2001 From: dsengupta0628 Date: Wed, 22 Apr 2026 04:19:34 +0000 Subject: [PATCH] add some debug info for dispatch queue and regression Signed-off-by: dsengupta0628 --- search/Sta.cc | 6 +++++ search/test/CMakeLists.txt | 1 + search/test/search_kahns_bfs_dispatch.ok | 4 +++ search/test/search_kahns_bfs_dispatch.tcl | 31 +++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 search/test/search_kahns_bfs_dispatch.ok create mode 100644 search/test/search_kahns_bfs_dispatch.tcl diff --git a/search/Sta.cc b/search/Sta.cc index 3eee9dbe..f63d4aae 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -338,6 +338,12 @@ Sta::setThreadCount1(int thread_count) dispatch_queue_ = new DispatchQueue(thread_count); } +uint64_t +Sta::dispatchCallCount() const +{ + return dispatch_queue_ ? dispatch_queue_->dispatchCallCount() : 0; +} + void Sta::updateComponentsState() { diff --git a/search/test/CMakeLists.txt b/search/test/CMakeLists.txt index d3739b5a..ea483061 100644 --- a/search/test/CMakeLists.txt +++ b/search/test/CMakeLists.txt @@ -19,6 +19,7 @@ sta_module_tests("search" genclk_latch_deep genclk_property_report json_unconstrained + kahns_bfs_dispatch latch latch_timing levelize_loop_disabled diff --git a/search/test/search_kahns_bfs_dispatch.ok b/search/test/search_kahns_bfs_dispatch.ok new file mode 100644 index 00000000..91c01401 --- /dev/null +++ b/search/test/search_kahns_bfs_dispatch.ok @@ -0,0 +1,4 @@ +Warning 198: ../../examples/gcd_sky130hd.v line 527, module sky130_fd_sc_hd__tapvpwrvgnd_1 not found. Creating black box for TAP_11. +off_dispatches=203 +on_dispatches=1060 +on_to_off_ratio=5.22x diff --git a/search/test/search_kahns_bfs_dispatch.tcl b/search/test/search_kahns_bfs_dispatch.tcl new file mode 100644 index 00000000..269bc572 --- /dev/null +++ b/search/test/search_kahns_bfs_dispatch.tcl @@ -0,0 +1,31 @@ +# Performance regression: DispatchQueue dispatch() counts under Kahn's +# BFS OFF vs ON. The count is a wall-clock-independent proxy for +# parallel-dispatch overhead, so a shift in the golden signals a real +# change in the BFS/dispatch strategy. + +read_liberty ../../test/sky130hd/sky130hd_tt.lib +read_verilog ../../examples/gcd_sky130hd.v +link_design gcd + +sta::set_thread_count 2 +source ../../examples/gcd_sky130hd.sdc + +# OFF phase: level-based BFS. +set sta_use_kahns_bfs 0 +set before [sta::dispatch_call_count] +report_checks -path_delay min_max -group_count 10 > /dev/null +set off_dispatches [expr {[sta::dispatch_call_count] - $before}] + +# ON phase: Kahn's BFS. Invalidate arrivals so the iterators +# re-propagate through visitParallel instead of returning cached +# results. +sta::arrivals_invalid +set sta_use_kahns_bfs 1 +set before [sta::dispatch_call_count] +report_checks -path_delay min_max -group_count 10 > /dev/null +set on_dispatches [expr {[sta::dispatch_call_count] - $before}] + +puts "off_dispatches=$off_dispatches" +puts "on_dispatches=$on_dispatches" +puts [format "on_to_off_ratio=%.2fx" \ + [expr {$on_dispatches / double($off_dispatches)}]]