(feat): Added an optimization dump for each phase under a special log target#9873
Conversation
PR SummaryLow Risk Overview When applying an Reviewed by Cursor Bugbot for commit 7b2c047. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b96bd2d82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
orizi
left a comment
There was a problem hiding this comment.
@orizi made 2 comments.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on eytan-starkware and TomerStarkware).
crates/cairo-lang-lowering/src/optimizations/strategy.rs line 144 at r1 (raw file):
) -> Maybe<()> { let fmt = crate::fmt::LoweredFormatter::new(db, &lowered.variables); tracing::info!(
Suggestion:
tracing::trace!(crates/cairo-lang-lowering/src/optimizations/strategy.rs line 154 at r1 (raw file):
phase.apply(db, function, lowered)?; let fmt = crate::fmt::LoweredFormatter::new(db, &lowered.variables); tracing::info!(
Suggestion:
tracing::trace!(9b96bd2 to
f626392
Compare
aeb10da to
5d2a519
Compare
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware made 3 comments.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on orizi and TomerStarkware).
crates/cairo-lang-lowering/src/optimizations/strategy.rs line 144 at r1 (raw file):
) -> Maybe<()> { let fmt = crate::fmt::LoweredFormatter::new(db, &lowered.variables); tracing::info!(
Done.
crates/cairo-lang-lowering/src/optimizations/strategy.rs line 154 at r1 (raw file):
phase.apply(db, function, lowered)?; let fmt = crate::fmt::LoweredFormatter::new(db, &lowered.variables); tracing::info!(
Done.
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on TomerStarkware).
5d2a519 to
58b48e9
Compare
f626392 to
5689e86
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5689e86. Configure here.
58b48e9 to
5444b1b
Compare
5689e86 to
7b2c047
Compare


Summary
Adds tracing instrumentation to the optimization pipeline that logs the lowered IR before any optimization phases run and after each individual phase completes. Logs are emitted at the
infolevel under theoptimization_dumptarget, including the function's full path and the formatted lowered representation.Type of change
Please check one:
Why is this change needed?
Without visibility into the intermediate lowered IR states between optimization phases, it is difficult to debug incorrect or unexpected transformations introduced by a specific phase. This change makes it possible to trace exactly how the lowered IR evolves through each optimization step.
What was the behavior or documentation before?
The optimization pipeline applied each phase sequentially with no observable output about the intermediate IR states.
What is the behavior or documentation after?
When tracing is enabled at the
infolevel for theoptimization_dumptarget, the lowered IR is logged before any phases run and after each phase completes, labeled with the function's full path and the phase name.Related issue or discussion (if any)
Additional context
The logs can be selectively enabled using a tracing subscriber filtered to the
optimization_dumptarget, making this a low-overhead addition when tracing is not active.