Repository navigation
Elect the first active Wave64 lane before an EXEC branch splits the group - #4
Open
steven-seagull27 wants to merge 2 commits into
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.
Fixes the divergent
v_readfirstlane_b32readback reported in upstream #189. Based onfeat/wave64-compute-emulationat3e39e34.A read at the beginning of a single-entry active EXEC edge can elect across the whole guest wave in its group-uniform predecessor. The source VGPR must already be available there. This uses the existing Wave64 election and its shared scratch before the branch, then uses the elected value inside. It covers both
s_cbranch_execzfallthrough ands_cbranch_execnztaken edges. Waterfalls and sources produced inside divergent control flow continue through the existing lowering. The latter can still return a host-local answer.The regression uses two guest waves per group, six 128-thread readbacks per mode, and three masks. It exercises 40 active lanes spanning both halves, a first active lane at 39, and an entirely inactive second guest wave. Expected values include 0/64 and 39/103. Inactive destinations retain 42.
The portable WARP emulation results repeated in three fresh processes. As a separate Native Wave64 control on that runtime, high-half-only cases intermittently returned the wrong SGPR on both revisions. This patch changes the two emulated modes. An AMD native Wave64 or Intel Wave16 run would be valuable.
The stock
emit::wave64_tests::suite passed 35/35 on the patched tree, as dida_lowering_refused_tries_supported_fallbacks, strict shader Clippy, andcargo xtask policy. The unfiltered shader library run stopped inheap_direct_texture_reads_mark_their_heap_indexwith Windows exception0xc0000005on this machine. The same test also stopped on the original code. No title run.cargo test -p victory-shader --lib gpu_divergent_readfirstlane_spans_host_waves -- --nocapture