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

オープン
#452 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@dsengupta0628 がすでに取り組んでいます。

2026年11月10日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
22/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, python
領域
performance

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Verilog
スター
658
フォーク
299
平均マージ
1日 12時間
マージ済み PR(30日)
28

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

The-OpenROAD-Project/OpenSTA のほかの issue

The-OpenROAD-Project/OpenSTA の issue をすべて見る

似ている issue

Performance の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。