Repository navigation
Count SimX micro-ops as pending until commit so WSYNC waits for them - #476
Merged
Merged
Conversation
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.
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_wsynccould 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 fedrunning()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.cpponly:has_pending_instrsis a lookup instead of a scan over every in-flight instruction.assertcatches a counter underflow (an instruction committing that was never counted).No RTL, ISA or config change, so the perf baselines (rtlsim cycles) and
config_hashare unaffected.Testing
tensor_wg,dxaandcorecases run locally on the fix: all passed, with no underflow.model_paritychecks SimX against rtlsim; this change brings SimX's WSYNC timing in line with the RTL.