[rocroller] Coherently handle wait states for conditionals#4908
Draft
ThanHenderson wants to merge 1 commit intodevelopfrom
Draft
[rocroller] Coherently handle wait states for conditionals#4908ThanHenderson wants to merge 1 commit intodevelopfrom
ThanHenderson wants to merge 1 commit intodevelopfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (76.83%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #4908 +/- ##
========================================
Coverage 65.35% 65.35%
========================================
Files 1718 1718
Lines 267217 267217
Branches 37047 37047
========================================
Hits 174637 174637
Misses 77072 77072
Partials 15508 15508
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The
WaitcntObserverpreviously had no awareness of control flow. When processing conditionals, the observer walked through if-body and else-body sequentially, accumulating queue state across both blocks as if they executed together. This caused incorrect waitcnt assertions for forward branches and could lead to missed wait insertions at join points where in-flight operations from one branch path were invisible to the merged state.Technical Details
addBranchStatenow classifies branches as forward (conditional) or backward (loop) based on whether the target label has already been encountered in the linear traversal. Forward branch labels are recorded inm_forwardBranchLabels.LiveBranchStatestruct andm_liveBranchStatesmap capture the full observer state (queues, flags, types) at forward branch points, preservingRegister::ValuePtrentries needed for restore and merge operations.m_afterUnconditionalBranchflag ensures that whenaddLabelStateis reached after ans_branch(e.g., end of the if-body), the observer resets to the saved branch state instead of continuing with the previous block's accumulated state. This processes each conditional block independently.ConditionalBottom), the fall-through and branch queue states are merged via a back-aligned per-position union. Entries are aligned by distance from the end of the queue, and registers from the branch path are inserted into empty slots at corresponding positions. If no slot is available,m_needsWaitZerois set as a fallback.assertSafeToBranchTonow accepts astrictparameter. Backward branches use strict checking (both sides must match). Forward branches use relaxed checking (label state may be a superset of branch state due to merging).Test Plan
Test Result
TBD
Submission Checklist