Repository navigation
Read the first active Wave64 lane across both host halves in single-wave groups - #12
MichaelSmithAI wants to merge 4 commits into
Conversation
|
Thank you. The defect is real, the fix is right where it applies, and I would like to carry it with your authorship after the detection is narrowed. Reviewed, built and run on an RTX 5070 (32-lane waves) and a Radeon iGPU (64-lane waves), at The defect, reproduced at the parent ( Your GPU test taken onto the base fails on the RTX 5070 at 48 threads: lanes 32-47 of each group read 32 where the console reads 0. A probe that reports every case, two groups each, lanes that differ from the console's result:
With your change the RTX 5070 is exact at 32, 48 and 64 threads; 128 is unchanged, as your test comment says. So the design note's "as on What checked out
Why not as it is: the rule fires for 179 compute programs and most of them gain nothing 160 of the 179 move from the per-lane form to the console flow (the other 19 are refused before and after for unrelated reasons; none fell back). In a group of more than 32 threads every first-lane read and every EXEC or VCC branch then becomes an exchange, which is two group barriers, and the module declares
"The same in every lane" comes from a conservative check written for this measurement (VALU and scalar chains over scalars and constants; no joins, guarded writes or loads); it is not in the tree. So at least 87 of 160 would pay barriers for nothing, and the real beneficiaries are at most 37. What I am asking for
One thing your test skips and that I will take separately: the Radeon (32-64) shows the same wrong lanes for the varying read, before and after, because these undeclared programs run there in 32-lane waves too. On a host that runs 64-lane waves the fix is to declare On where it goes: Marvisak#439 is not taking new behaviour while it waits for review, so this would land on the branch after it. You merged our newest head in already, which is fine; one commit of yours on top is what I would carry. AI-assisted (Claude Code). |
56d0af0 to
b5f052b
Compare
|
Updated to An ordinary first-lane read can now request the exchange only for a 33–64-thread group on a host that runs 32-lane waves and cannot run 64-lane waves. The classifier follows straight-line scalar and vector arithmetic over constants and SGPR inputs. Loads, joins and partially executed writes remain conservative. On the simulated 32–32 target, varying entry and divergent reads declare RTX 4090 readback matched every lane in the entry and divergent controls at 32, 48 and 64 threads. The uniform 64-thread control read 2 throughout group 0 and 3 throughout group 1. All seven focused tests passed. I don't have a revised title-pack count or timing measurement. The Radeon native-wave case remains open as discussed. The Linux shader suite passed 99 tests with one ignored. The Win64 shader suite under Wine passed 163 with one ignored and the same |
|
Second round, at Soundness of the uniformity check. No case found where it calls a value uniform that can differ between lanes. It only admits an SGPR input (user data, the group id or zero on the host: these can differ per group, never per lane) or the result of an unguarded listed operation in a block every lane reaches, all of whose operands are uniform. The four requests. The 33-64 thread limit, the tests that pin the form (including the per-lane fallback after the console flow declines a joined descriptor) and the doc are done. Both CI clippy commands are clean; What is left: the check clears no title program yet.
The 21 fewer are exactly the groups of 32 threads or fewer. All 158 are in groups of 33 to 64 threads (156 at 64, 2 at 48). I ran one more pass with four candidate widenings measured per program:
So one change does it: a scalar load at a uniform address is uniform (it reads the same memory for the whole wave). That takes the rule from 158 programs to 92, and the 66 are the ones the first review counted as reading only uniform values. The other two widenings are sound as far as I can see but buy nothing on this title, so I would leave them out. Why I hold it until then: each program the rule moves gets a group barrier pair at every first-lane read and every EXEC or VCC branch, and there is an open report of a 30-series card hanging in a barrier-heavy split program. 66 programs paying that for nothing is worth one more commit. With the scalar loads in, I will take your commit, with your authorship, onto the branch after Marvisak#439 ( Still open and mine: on a host that runs both wave sizes (the Radeon here) these programs stay undeclared and run in 32-lane waves, with the same wrong lanes; declaring AI-assisted (Claude Code). |
… halves A Wave64 first-lane read at entry can return lane 32's value in the upper half on a 32-lane host. In divergent flow the two host halves can likewise select different active lanes. Prefer the existing console-flow exchange for an ordinary first-lane read in a 33–64-thread group when straight-line scalar and vector arithmetic cannot prove its input uniform. Waterfalls and existing wave-size requirements retain their own routing. Keep the per-lane retry when the console form declines a joined descriptor. Pin the DXIL wave sizes and fallback route, and check the entry, divergent and uniform cases with two groups on a 32-lane adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b5f052b to
512ce75
Compare
|
Retargeted to The proof now follows The new regression loads a four-dword descriptor from the second table slot, then a pair of dwords from its buffer at a group-dependent offset. It reads the second returned dword through a VGPR with All 16 focused first-lane and mask tests passed under Wine/GE, and both Windows-target workspace Clippy configurations passed. The 66-program reduction is your title-pack projection. I haven't rerun that pack or measured frame time. |
…ads across halves Port of r4tedx/VIctory shader/wave-per-group plus r4tedx#12 (MichaelSmithAI, f3f61f9), the follow-ups to upstream JMAN730#439: - Groups of several wave64 console waves without LDS are emitted as one host group of 64 threads per console wave (HostShader::group_waves); direct dispatches multiply x (within 65535), indirect ones of such pipelines are dropped until the clamp pass multiplies the records. These were 43 programs on a 32-lane host (16x16, 1024x1, 8x16 ...). - A v_readfirstlane whose source may differ between the host halves takes the console flow in groups of 33-64 threads (a plain read in the upper half returned lane 32, not 0). Uniform scalar loads stay per-lane. - A mask joined across divergent paths and read as a number takes the console flow (moey424); whole-wave sections in groups of 32 threads or fewer. Co-authored-by: Swarm <swarm@users.noreply.github.com> Co-authored-by: moey424 <mohammad.allami75@gmail.com> Co-authored-by: CitizenCInema <fredericlaura.fl@pm.me> Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
|
First a correction, and an apology: my advice last round was wrong. I told you that following scalar loads would clear 66 of the 158 programs. I had misread my own diagnostic: the bit pattern I took for "scalar loads alone" meant "scalar loads, plus dropping the reach condition, plus any lane-pure operation, together". You implemented exactly what I asked, correctly, and it clears none: the rule still fires for the same 158 programs. That one is on me, not on What the final check of
So nothing is wrong with it. It still moves 139 programs into the barrier form, and this time I measured what actually stands between the proof and the 66, per program. What blocks the proof (158 fired programs; each line counts programs in which that instruction is on the frontier of the read's sources):
What each widening would clear (projected from that listing, each program counted once):
"More operations" means any VALU or scalar operation whose result depends only on its operands in the same lane: the float conversions and arithmetic above are the bulk. A denylist would be shorter than the list: operations that read another lane (DPP forms, That would leave the rule at 92 programs (83 with the select), all of them with a genuinely per-lane source. I will verify with one count pass, as before. Because the last round's miss was mine: if you would rather not do another, say so and I will merge AI-assisted (Claude Code). |
|
Thanks for rerunning the corpus and correcting the count. Please go ahead and merge For the reach-condition follow-up, one regression worth keeping is a VGPR initialized to 0, overwritten with 42 only on lanes 10 and above, then read with |
…ostics Check the required package archive before title startup
r4tedx
left a comment
There was a problem hiding this comment.
Reviewed the merge 6db13d8 (after #17 landed in shader/wave-per-group). Static review: I read the resolution and did not compile or run it.
- Both sides' tests are kept, each once: 40 split tests and 8 waterfall tests. That covers this PR's first-lane cases (Wave32 readback, uniform scalar loads, wave-size declaration checks, larger-group admission, waterfall fallback) and #17's full- and partial-wave exit-mask cases.
- The hardware readbacks now go through #17's
hardware_adapters(), which returns no adapters underVICTORY_WARP=1. The partial-wave case still requiresreported_target().runs(32). lower.rsis identical to this PR's parent.host.rsandvictory-gpumatch the base (6551f22). The net diff against the base islower.rs, the two test files anddocs/wave64-on-wave32.md.
Approving the resolution. Not merging yet: CI was still running when I checked.
AI-assisted.
A Wave64 compute shader can read a different first active lane in each 32-lane host wave. On an RTX 4090, the upper half of a 64-thread group read 32 at entry where the console reads 0. Inside a branch starting at lane 10 it read 103 from lane 32 where the console reads 37.
This change lets an ordinary
v_readfirstlane_b32request the existing console-flow exchange on hosts that support 32-lane waves but cannot run 64-lane waves. The group must have 33–64 threads and at least one source must lack a uniformity proof. The proof follows straight-line scalar and vector arithmetic over constants and scalar inputs. It also follows scalar dword loads when every base or descriptor word and the scalar offset are uniform. Joins and partial writes remain conservative. Waterfall reads use their existing lowering.The tests inspect the emitted DXIL wave size and exercise the public emitter's per-lane retry when console flow declines a joined descriptor. RTX 4090 readbacks under Wine/GE matched every expected word for entry and divergent reads at 32, 48 and 64 threads, and for a uniform scalar-to-vector chain in two 64-thread groups. The scalar-load fixture reads a descriptor in slot 1 and then two dwords at a group-dependent offset. Its first-lane read of the second dword stays undeclared at 48 and 64 threads and returns 37 throughout group 0 and 91 throughout group 1. An offset outside the proof still selects wave size 32. Larger groups and the retry can still produce per-half values. Hosts that support native Wave64 are outside this change.
The maintainer’s offline title-pack evaluation predicted that following these scalar loads would clear 66 of the 158 programs selected by the prior rule. We have not measured this head against the title pack or timed it in game.
Follow-up to Marvisak#439 and Marvisak#1132. AI-assisted.