Skip to content

Fix: replace_arith_modules ignores -slack_threshold due to key mismatch#9580

Merged
maliberty merged 6 commits intoThe-OpenROAD-Project:masterfrom
suhr25:fix/rsz-replace-arith-modules-slack-threshold
Mar 2, 2026
Merged

Fix: replace_arith_modules ignores -slack_threshold due to key mismatch#9580
maliberty merged 6 commits intoThe-OpenROAD-Project:masterfrom
suhr25:fix/rsz-replace-arith-modules-slack-threshold

Conversation

@suhr25
Copy link
Contributor

@suhr25 suhr25 commented Mar 1, 2026

SUMMARY

This PR fixes a bug in replace_arith_modules where the -slack_threshold option was being ignored due to a mismatched key name. The issue is limited to src/rsz/src/Resizer.tcl and only affects Tcl argument parsing, with no impact on the C++ layer.


FIX / CHANGES

  • Root cause:
    The option was renamed from -slack_margin to -slack_threshold, but the later checks still used the old name. As a result, the user-provided value was never picked up and always defaulted to 0.0.

  • Approach:
    Updated the key name in both the guard and parsing call so it matches what parse_key_args produces.

Fix

- if { [info exists keys(-slack_margin)] } {
-   set slack_margin [rsz::parse_time_margin_arg "-slack_margin" keys]
+ if { [info exists keys(-slack_threshold)] } {
+   set slack_margin [rsz::parse_time_margin_arg "-slack_threshold" keys]
  • No changes to core logic—this just fixes the Tcl → C++ argument wiring.

VERIFICATION

  1. Run a normal flow up to timing estimation.
  2. Call:
replace_arith_modules -path_count 100 -slack_threshold 0.5 -target setup
  1. After the fix:
  • The log now shows -slack_margin 0.5 instead of 0.0
  • The provided threshold is actually used during replacement

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a bug where the -slack_threshold option in replace_arith_modules was ignored because the code was still checking for the old -slack_margin key. The change correctly updates the key name. I've added one suggestion to improve consistency by renaming the local variable from slack_margin to slack_threshold and also pointed out a minor typo and inconsistency in a related log message.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

@suhr25
Copy link
Contributor Author

suhr25 commented Mar 1, 2026

Hi @maliberty,
Please take a look at this PR when you get time.
Thanks!

@suhr25 suhr25 force-pushed the fix/rsz-replace-arith-modules-slack-threshold branch from de9c8cb to cde382d Compare March 2, 2026 03:32
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

2 similar comments
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Member

@maliberty maliberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Ideally we would have a test for this option.

@maliberty
Copy link
Member

Apparently these need updating
20:32:20 456 - rsz.replace_arith_modules1.tcl (Failed) IntegrationTest tcl rsz log_compare
20:32:20 457 - rsz.replace_arith_modules2.tcl (Failed) IntegrationTest tcl rsz log_compare
20:32:20 458 - rsz.replace_arith_modules3.tcl (Failed) IntegrationTest tcl rsz log_compare

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

@suhr25 suhr25 force-pushed the fix/rsz-replace-arith-modules-slack-threshold branch from 4a7091b to 1e39beb Compare March 2, 2026 20:11
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

suhr25 added 6 commits March 2, 2026 20:45
keys(-slack_margin) was checked but only keys(-slack_threshold) is
registered by parse_key_args, so the option was always silently ignored.

Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
Golden files reflected the old log line that used 'replace_arith_module'
(missing 's') and '-slack_margin'. Update to match the corrected log
output: 'replace_arith_modules ... -slack_threshold 0.0'.

Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
@suhr25 suhr25 force-pushed the fix/rsz-replace-arith-modules-slack-threshold branch from 1e39beb to 62fd8dd Compare March 2, 2026 20:46
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

clang-tidy review says "All clean, LGTM! 👍"

@suhr25
Copy link
Contributor Author

suhr25 commented Mar 2, 2026

Hi @maliberty,
I have made changes according to your comment.
Please take a look
Thanks!

@maliberty maliberty enabled auto-merge March 2, 2026 21:46
@maliberty maliberty merged commit ad20cea into The-OpenROAD-Project:master Mar 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants