CRPR: paths, memory and runtime grow faster than the design on large propagated clock networks

Đang mở
#452 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@dsengupta0628 đang làm issue này rồi.

Từ ngày 10/11/2026.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
22/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, python
Lĩnh vực
performance

Hướng nghiên cứu

Start with the reproducer: gen.py makes the Verilog and run.tcl runs report_checks with CRPR on and off, printing path and tag counts. The issue points at sta::Tag::matchCmp and Path::vertexId in the tag comparison, and at ArrivalVisitor::pruneCrprArrivals for how far CRPR pruning goes. Done would need an agreed design that keeps reported CRPR results unchanged while cutting tags and paths.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Feature request: CRPR memory on large propagated clock networks

Not a high priority, documenting for later hydration into a PR.

With CRPR enabled and propagated clocks, every register clock pin gets its own ClkInfo carrying its CRPR clock path, so tags do not merge. Data vertices downstream of many registers then keep one arrival per launching clock path, and the path count, memory and runtime grow faster than the design.

Where we met it: XiangShan's XSTile top level in bazel-orfs, about 700k registers. CTS latency balancing calls updateTiming(false) and then reads only clock arrivals at the sinks.

  • With CRPR on, that timing update added 77 GB in 714 s.
  • With CRPR off, the same clock arrivals on the finished tree cost 6.9 GiB in 336 s: 12 tags, 3 tag groups, 4 clock infos.
  • With CRPR on, those same clock arrivals passed 130 GiB in 30 minutes and were still growing. A profile showed the time in sta::Tag::matchCmp → Path::vertexId, comparing CRPR clock paths.

bazel-orfs now carries a patch that turns CRPR off while CTS balances latencies, which does not change the tree (bazel-orfs#1494). Timing the whole routed top level still runs out of memory, so the flow times it in cut-down cones per set of macros.

Reproducer, standalone opensta. N flops on a buffered clock tree with fanout 8; each flop's Q drives the next flop's D, and an AND2 tree over every Q drives the output. report_checks runs with CRPR off, then on:

python3 gen.py N > top.v
TREE=top.v CRPR=0 opensta -no_init -exit run.tcl
TREE=top.v CRPR=1 opensta -no_init -exit run.tcl
flops N paths, CRPR off paths, CRPR on ratio RSS off / on run time off / on
1k 28,672 86,852 3.0× 44 / 48 MB <1 s / <1 s
10k 277,440 1,089,056 3.9× 89 / 143 MB <1 s / 2 s
100k 2,699,584 13,190,756 4.9× 526 / 1,148 MB 7 s / 25 s
1M 26,396,736 157,315,176 6.0× 4.8 / 12.0 GB 64 s / 928 s

With CRPR on, there are about 3 tags and 1 clock info per register, with 1M flops 3,145,744 tags and 1,048,580 clock infos. With CRPR off there are 16 tags and 4 clock infos at every size. The ratio of paths grows with N, roughly with the depth of the cone that merges registers; on a plain chain without the AND tree, paths are the same with and without CRPR. Run time is the whole run, from reading the Liberty file to the report.

Ideas, for whoever knows the code better than we do:

  • Could CRPR's clock path stay out of the tag when a vertex's arrivals would otherwise merge, and the credit be found when a path is reported? We see ArrivalVisitor::pruneCrprArrivals, but we don't know how far it is meant to go.
  • Or could a caller that reads clock arrivals only, as CTS latency balancing does, ask for them without CRPR tags?

gen.py

#!/usr/bin/env python3
"""gen.py N > top.v: N flops on a buffered clock tree (fanout 8), Q to the
next flop's D, and an AND2 tree over every Q driving the output."""
import sys

n = int(sys.argv[1])
w = print
w("module top (clk, d, q);\n  input clk, d;\n  output q;")
level, k = ["clk"], 0
while len(level) * 8 < n:
    nxt = []
    for drv in level:
        for _ in range(8):
            w(f"  wire c{k};\n  BUF b{k} (.A({drv}), .Y(c{k}));")
            nxt.append(f"c{k}")
            k += 1
    level = nxt
for i in range(n):
    d = "d" if i == 0 else f"q{i - 1}"
    w(f"  wire q{i};\n  DFF f{i} (.CK({level[i % len(level)]}), .D({d}), .Q(q{i}));")
terms, m = [f"q{i}" for i in range(n)], 0
while len(terms) > 1:
    nxt = []
    for a in range(0, len(terms) - 1, 2):
        w(f"  wire r{m};\n  AND2 a{m} (.A({terms[a]}), .B({terms[a + 1]}), .Y(r{m}));")
        nxt.append(f"r{m}")
        m += 1
    terms = nxt + ([terms[-1]] if len(terms) % 2 else [])
w(f"  assign q = {terms[0]};\nendmodule")

run.tcl

# opensta -no_init -exit run.tcl, with env TREE (gen.py's Verilog) and CRPR (0/1)
proc rss_mb {} {
  set f [open /proc/self/status]
  regexp {VmRSS:\s+(\d+)} [read $f] -> kb
  close $f
  return [expr {$kb / 1024}]
}
read_liberty cells.lib
read_verilog $::env(TREE)
link_design top
create_clock -name clk -period 2 [get_ports clk]
set_propagated_clock [all_clocks]
set_input_delay 0 -clock clk [get_ports d]
set_output_delay 0 -clock clk [get_ports q]
sta::set_crpr_enabled $::env(CRPR)
set start [clock milliseconds]
report_checks -path_delay max -format end > /dev/null
puts [format "crpr %s: %.1f s, rss %d MB, tags %d, tag groups %d, clk infos %d, paths %d" \
  $::env(CRPR) [expr {([clock milliseconds] - $start) / 1000.0}] [rss_mb] \
  [sta::tag_count] [sta::tag_group_count] [sta::clk_info_count] [sta::path_count]]

cells.lib

library (cells) {
  delay_model : table_lookup;
  time_unit : "1ns";
  capacitive_load_unit (1, pf);
  voltage_unit : "1V";
  current_unit : "1mA";
  pulling_resistance_unit : "1kohm";
  leakage_power_unit : "1nW";
  input_threshold_pct_rise : 50;
  input_threshold_pct_fall : 50;
  output_threshold_pct_rise : 50;
  output_threshold_pct_fall : 50;
  slew_lower_threshold_pct_rise : 20;
  slew_lower_threshold_pct_fall : 20;
  slew_upper_threshold_pct_rise : 80;
  slew_upper_threshold_pct_fall : 80;
  nom_voltage : 1.0;
  nom_temperature : 25;
  nom_process : 1;
  lu_table_template (t2) {
    variable_1 : input_net_transition;
    variable_2 : total_output_net_capacitance;
    index_1 ("0.01, 0.1");
    index_2 ("0.001, 0.1");
  }
  lu_table_template (c2) {
    variable_1 : related_pin_transition;
    variable_2 : constrained_pin_transition;
    index_1 ("0.01, 0.1");
    index_2 ("0.01, 0.1");
  }
  cell (BUF) {
    area : 1;
    pin (A) { direction : input; capacitance : 0.002; }
    pin (Y) {
      direction : output;
      function : "A";
      timing () {
        related_pin : "A";
        timing_sense : positive_unate;
        cell_rise (t2) { values ("0.02, 0.2", "0.03, 0.21"); }
        cell_fall (t2) { values ("0.02, 0.2", "0.03, 0.21"); }
        rise_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
        fall_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
      }
    }
  }
  cell (AND2) {
    area : 1;
    pin (A) { direction : input; capacitance : 0.002; }
    pin (B) { direction : input; capacitance : 0.002; }
    pin (Y) {
      direction : output;
      function : "A * B";
      timing () {
        related_pin : "A";
        timing_sense : positive_unate;
        cell_rise (t2) { values ("0.02, 0.2", "0.03, 0.21"); }
        cell_fall (t2) { values ("0.02, 0.2", "0.03, 0.21"); }
        rise_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
        fall_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
      }
      timing () {
        related_pin : "B";
        timing_sense : positive_unate;
        cell_rise (t2) { values ("0.02, 0.2", "0.03, 0.21"); }
        cell_fall (t2) { values ("0.02, 0.2", "0.03, 0.21"); }
        rise_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
        fall_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
      }
    }
  }
  cell (DFF) {
    area : 4;
    ff (IQ, IQN) { next_state : "D"; clocked_on : "CK"; }
    pin (CK) { direction : input; clock : true; capacitance : 0.002; }
    pin (D) {
      direction : input;
      capacitance : 0.002;
      timing () {
        related_pin : "CK";
        timing_type : setup_rising;
        rise_constraint (c2) { values ("0.02, 0.02", "0.02, 0.02"); }
        fall_constraint (c2) { values ("0.02, 0.02", "0.02, 0.02"); }
      }
      timing () {
        related_pin : "CK";
        timing_type : hold_rising;
        rise_constraint (c2) { values ("0.01, 0.01", "0.01, 0.01"); }
        fall_constraint (c2) { values ("0.01, 0.01", "0.01, 0.01"); }
      }
    }
    pin (Q) {
      direction : output;
      function : "IQ";
      timing () {
        related_pin : "CK";
        timing_type : rising_edge;
        cell_rise (t2) { values ("0.04, 0.24", "0.05, 0.25"); }
        cell_fall (t2) { values ("0.04, 0.24", "0.05, 0.25"); }
        rise_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
        fall_transition (t2) { values ("0.01, 0.3", "0.02, 0.31"); }
      }
    }
  }
}

OpenSTA as vendored in OpenROAD at bf0feec09188 (src/sta at bc7af6f0, 2026-10-23), standalone opensta binary, Linux.

Ngôn ngữ chính
Verilog
Star
658
Fork
299
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của The-OpenROAD-Project/OpenSTA

Tất cả issue của The-OpenROAD-Project/OpenSTA

Issue tương tự

Thêm issue về Performance

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.