Skip to content

Count SimX micro-ops as pending until commit so WSYNC waits for them - #476

Merged
tinebp merged 1 commit into
masterfrom
fix/simx-pending-uops
Nov 15, 2026
Merged

tinebp merged 1 commit into
masterfrom
fix/simx-pending-uops

Conversation

@jel221

@jel221 jel221 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Human comment:
Minor SimX error that appeared when testing for FlashAttention-4. vx_wsync can complete even before instructions that expand out into microops can complete, so SimX underestimates RTL cycles.

This is the last of the 3 separated out PRs for each actual feature/fix you requested from that other pull request. as for the SPARSE_FULLK parameter, it will be pushed with the final TMEM fix if the area/power justifies the performance icnrease for sparse umma.

AI-generated comment:

Problem

SimX's vx_wsync could complete before the warp's work had actually finished.

WSYNC completes once has_pending_instrs(wid) reports nothing in flight for the warp besides itself. SimX tracked in-flight instructions in a list, but a macro instruction (e.g. WGMMA, which expands into 8–64 TCU micro-ops) was removed from that list when its last micro-op issued, and the micro-ops themselves were never added. Between that point and the micro-ops committing, the warp looked idle, so a WSYNC after a WGMMA could pass while the tensor core was still computing. The RTL counts micro-ops until they commit, so SimX disagreed with it here: its cycle counts were optimistic, and a read after the WSYNC could in principle see unfinished results. The same view also fed running() and the active-cycle counter, so a core could be treated as idle early.

This was found while working on #457.

Fix

sim/simx/core.cpp only:

  • Micro-ops are counted as pending when they issue and removed when they commit. The macro still leaves the count when its last micro-op issues, so there is no gap.
  • The in-flight list is replaced with a per-warp counter and a total, so has_pending_instrs is a lookup instead of a scan over every in-flight instruction.
  • An assert catches a counter underflow (an instruction committing that was never counted).

No RTL, ISA or config change, so the perf baselines (rtlsim cycles) and config_hash are unaffected.

Testing

  • SimX regression, tensor_wg, dxa and core cases run locally on the fix: all passed, with no underflow.
  • SimX cycle sweep of the perf_gate benchmarks, before vs after:
  • CI: model_parity checks SimX against rtlsim; this change brings SimX's WSYNC timing in line with the RTL.

@jel221
jel221 requested a review from tinebp November 15, 2026 03:29
@tinebp
tinebp merged commit 0e15b9d into master Nov 15, 2026
1 of 8 checks passed
@tinebp
tinebp deleted the fix/simx-pending-uops branch November 15, 2026 04:48
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.

2 participants