[IR Container] Phase 2.2 Fusion Statement Registration#5958
[IR Container] Phase 2.2 Fusion Statement Registration#5958mdavis36 wants to merge 2 commits intomd/dep-special-typesfrom
Conversation
|
Review updated until commit 251ae68 Description
|
| Relevant files | |||||||
|---|---|---|---|---|---|---|---|
| Enhancement |
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 PR contains tests |
| ⚡ Recommended focus areas for review |
Non-deterministic iteration
all_inputs may not have a defined order, which could affect determinism. Please verify this is intentional and acceptable for the project's determinism requirements. |
|
!test |
1588d37 to
cf4ae4a
Compare
074c814 to
54cd0fe
Compare
|
!test |
Greptile SummaryThis PR consolidates statement registration ( Key changes:
Confidence Score: 4/5
Sequence DiagramsequenceDiagram
participant C as Client Code
participant F as Fusion
participant IC as IrContainer
note over C,IC: Before this PR
C->>F: registerVal(val)
F->>IC: ir_container()->registerVal(val)
IC->>IC: vals_up_.emplace_back(val)
IC->>IC: vals_.insert(val)
IC->>IC: val->setName(IrContainerPasskey(), ...)
note over C,IC: After this PR
C->>F: registerVal(val)
F->>IC: ir_container() → get pointer
F->>IC: c->vals_up_.emplace_back(val)
F->>IC: c->vals_.insert(val)
F->>F: val->setName(IrContainerPasskey(), ...) [Fusion is now friend of passkey]
Last reviewed commit: 0716dc5 |
cf4ae4a to
7820c63
Compare
0a16eaa to
251ae68
Compare
Additional Comments (1)
The old NVF_ERROR(
exprs_.find(expr) != exprs_.end(),
"Wanted to remove an expression but it doesn't exist in this container.");before searching Same pattern applies to |
|
!test |
3693e3d to
4111350
Compare
Inlines registerVal, registerExpr, removeVal, and removeExpr logic directly into Fusion, eliminating the delegation to IrContainer. This consolidates the registration path after per-Fusion special values were moved from IrContainer to Fusion. Also removes vestigial friend class StatementGuard from IrContainer (it only uses public Fusion API) and adds Fusion as a friend of IrContainerPasskey so it can construct passkeys for setName() calls.
7d1aa72 to
0716dc5
Compare
|
!test |
Summary
Inline
registerVal,registerExpr,removeVal, andremoveExprlogic directly intoFusion, eliminating the delegation toIrContainer. This consolidates the statement registration path after per-Fusion special values, axioms, and metadata were moved to Fusion in PR #5954 .Key Changes
fusion.cpp:registerVal,registerExpr,removeVal,removeExprimplemented directly on Fusion, no longer delegating to IrContainercontainer.cpp: Remove registration/removal implementationscontainer.h: RemoveregisterVal/registerExpr/removeVal/removeExprdeclarations, remove vestigialfriend class StatementGuard(it only uses public Fusion API)container.h: AddFusionas friend ofIrContainerPasskeyso it can construct passkeys forsetName()callsWhy This Matters
Statement registration is the write path for container mutation. In Phase 2, when multiple Fusions share a container, registration must populate per-Fusion tracking maps (
per_fusion_vals_,per_fusion_exprs_). Having registration live in Fusion (which knowsthis— the owning Fusion) rather than in IrContainer (which doesn't know which Fusion is registering) is essential for correct per-Fusion tracking.Relationship to Phase 2
This is the final foundation change before the shared_ptr transition begins. Now Fusion is the single authority for:
CI Risk
Low. Pure code motion — identical behavior, just different call location. The registration logic is unchanged; only the method boundaries moved.