Fix barrier phase routing and global response tracking - #407
Conversation
Add non-deadlocking diagnostics for cross-slot local phase corruption and missing global-barrier phase advancement. Register both tests in the aggregate regression suite and explicit SimX/xrtsim smoke coverage. Co-Authored-By: RunjiaChen <runjia@u.nus.edu> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Capture the phase and exact waiters for each pending global-barrier generation, queue completed local arrivals, and route each cluster response directly to its barrier slot. Keep response-only writes out of the barrier state RAM and qualify the working phase bypass by address. Use one-bit phase toggles in SimX so wait comparisons keep matching the RTL after wraparound.
|
Independently reproduced and verified. Branch updated against Reproduction on clean masterIsolated worktree at
Baseline failure signatures match #402 and #403 exactly: Review notesThe design is right. Replacing the The SimX change is a larger correctness fix than the commit message suggests.
Follow-ups (not blockers)
|
Summary
Fix two barrier phase hazards in RTL and align SimX with the architectural one-bit phase:
The first commit also brings the diagnostic coverage from #402 and #403 into the regression suite, and the second widens the existing asynchronous-global-barrier overlap window.
Root cause
The old RTL reused
store_waddrandstore_phase_wdatafrom the request pipeline while retiring an independent global response. Under overlap/backpressure, this could update the wrong barrier slot, corrupt state, or lose a completed request behind the single request register. The old unlock path also usedactive_warps, which could release scheduler-stalled warps that had never waited on that barrier.Separately, the working phase register forwarded every phase write without checking whether the write address matched the barrier currently being processed. Back-to-back arrivals to different slots therefore consumed the previous slot's phase.
Before/after evidence
The "before" column is current
origin/masterwith the two diagnostic test commits applied but without the fix.bar_slot_phase, RTL, XLEN64, 1 core / 2 warps, 256 roundsgbar_phase, RTL, XLEN64, 2 cores0 -> 0; 2 errors0 -> 1; 0 errorsasync_gbarrier, RTL, XLEN64, 2 coresgbar_phaseandbar_slot_phaseare deterministic, diagnostic, and non-deadlocking: they always make forward progress and return observed phase/error data to the host. This makes a bad phase an ordinary regression failure rather than a timeout. The widened existingasync_gbarriertest separately guards end-to-end liveness under a longer overlap window.Verification
gbar_phase: PASS on XLEN64 SimX, RTL, and XRT simulator (2 cores)bar_slot_phase: PASS on XLEN64 SimX, RTL, and XRT simulator (1 core / 2 warps)gbar_phase: PASS on XLEN32 RTL (2 cores)async_gbarrier: PASS on XLEN64 RTL (2 cores)async_barrier: PASS on XLEN64 RTL (1 core)python3 ci/testcase.py lint: PASS, 641 cases across 34 categoriesgit diff --check: PASSThis incorporates and supersedes the test-only coverage proposed in #402 and #403.
Fixes #400
Fixes #401