Skip to content

global_route: write artifacts once at top-level on success - #4429

Closed
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:fix-global-route-artifact-writes
Closed

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:fix-global-route-artifact-writes

Conversation

@oharboe

@oharboe oharboe commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

This refactors global_route.tcl to only write out the .odb and .sdc artifacts once in the successful case, properly keeping the logic at the top-level script similarly to floorplan.tcl. It correctly propagates early failures by returning 0 from the helper proc rather than exiting, which allows OpenROAD to handle failures cleanly without crashing.

This refactors global_route.tcl to only write out the .odb and .sdc artifacts once in the successful case, properly keeping the logic at the top-level script similarly to floorplan.tcl. It correctly propagates early failures by returning 0 from the helper proc rather than exiting, which allows OpenROAD to handle failures cleanly without crashing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>

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

Copy link
Copy Markdown
Contributor

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 updates flow/scripts/global_route.tcl to return explicit status codes (0 for failure, 1 for success) from global_route_helper and conditionally executes the artifact writing steps based on this result. The reviewer noted that returning 0 on failure will cause the script to exit successfully without writing artifacts, silently ignoring the failure. It is recommended to throw an error instead to properly propagate the failure to the build system.

Comment on lines +172 to 177
if { [global_route_helper] } {
write_guides $::env(RESULTS_DIR)/route.guide
source_step_tcl POST GLOBAL_ROUTE
orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb
orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

If global_route_helper returns 0 (indicating a failure), the script currently skips writing the successful artifacts but exits with a successful status code (0). This will cause the build system or Makefile to silently ignore the failure and proceed to subsequent steps.

To properly propagate the failure and terminate the script with a non-zero exit code, we should throw an error when global_route_helper returns 0.

if { ![global_route_helper] } {
  error "Global route failed"
}

write_guides $::env(RESULTS_DIR)/route.guide
source_step_tcl POST GLOBAL_ROUTE
orfs_write_db $::env(RESULTS_DIR)/5_1_grt.odb
orfs_write_sdc $::env(RESULTS_DIR)/5_1_grt.sdc

@oharboe

oharboe commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

never mind. It is fine the way it is. Ideally we could have simpler .tcl scripts and have more logic in C++ where we can have unit-tests for use-cases... Leave be for now.

@oharboe oharboe closed this Aug 14, 2026
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.

1 participant