shader: lower proven mesh entry wave-info reads (Part of #3703) #3838
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3838"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T08:17:13Z.
Generalizes proven ES+GS entry
WaveInSubgroupprojections and validates FSSM mesh user-data spans and widths.Part of #3703. Refs #3641.
(Opened as Draft per #3514 until an active review slot frees.)
Summary
s_bfe_u32ands_and_b32projections confined to bits 24 through 27 whiles3holds its entry value. Reads touching other bits and dynamic masks still refuse. Afters3is overwritten, use ordinary scalar arithmetic.WaveInSubgroup. Branching on it clearsgroup_flowso a divergent branch cannot reach a group barrier.v_readfirstlane_b32 sDst, v5shortcut when the reaching group value is known. The pre-exchange fixture verifies that the unshifted group seed and wave number reach POS0. The post-exchange fixture verifies the shifted group value. A read with an unproven seed still refuses.s0..s7. Compute-only TGID and thread-ID VGPR assumptions still refuse.Verification
Rebased on
5770f14eand tested atd2261ce7on Windows 11 with MSVC and the Windows SDK DXC.native_mesh_entry_registers_irpassed in fresh Debug and Release builds. The test is registered in theprpreset.unproven mesh entry register 261. The rebased compiler passed it in both configurations.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T08:19:39Z.
Review: APPROVED
Reviewed
3a7dfe0d(draft) by reading the diff; not built or run.Verdict: approve. The
s3[27:24]reads are exact, and the two tightenings fix real gaps. No MUST.m86census onf365f125. The #3703 row (392) counts about 25 different entry registers, and this PR clears onlys3reads confined toWaveInSubgroup. The two tightenings below can also refuse programs that translate today. The census would show the real gain and confirm that none is lost.entry_wave_info(gfx1013_direct_mesh.inl:93): fors_bfe_u32it takes the offset fromS1[4:0]and the width fromS1[22:16], and accepts only fields inside bits 24–27. The result(wave_number >> (offset-24)) & maskequals the guest field becausewave_numberis below 16 (at most 4 waves of 64 or 8 of 32). Ans_and_b32mask outside0x0f000000falls back to the refusal, SCC isresult != 0for both, and onces3is written the generic path takes over.v5guard (:2394): before the exchange,exchanged_groupis the seed, which the exchange then shifts right by 7 (:1224). Av_readfirstlanebefore that point used to return the unshifted seed for every wave. Refusing it is a fix, not a loss.:129):user_data + count ≤ 32. Type 1 must be 2 words withoffset_dwords == 0, where a non-zero offset used to be dropped silently. Types 3 and 5 must be 1 word. Theinputsentries are otherwise unchanged (countfor type 0, the root-descriptor flag for type 1).Tests:
native_mesh_entry_registers_iris in theprfilter. It covers the subfields in wave32 and wave64, an overwrittens3, av5read before the exchange, and the FSSM range and width refusals.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T08:51:46Z.
Review: CHANGES_REQUESTED
Follow-up to my approval: a mesh census of
f365f125+ this PR alone shows that it refuses every captured Mesh86 program. I missed this when reading the diff.Verdict: changes requested.
unproven mesh entry register 261f365f125+ #3825f365f125+ #3838Same capture and method as the #3703 census (
compile_dxil … gfx1013-container-ms-texture-heap). Counts only.exchanged_group == entry_group_seedand the new guard (gfx1013_direct_mesh.inl:2394) sends the read to the generic path, which refusesv5. On main this read takes theexchanged_groupshortcut.v_readfirstlane v5at entry does yield the seed (the source lane's value in this ABI), the guard is too broad. It should refuse only a read between the seed and a matched exchange later in the program.v5guard was wrong. Thes3[27:24]and FSSM parts are unaffected.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T19:35:38Z.
Review: APPROVED
Re-review on
d2261ce7(rebased on5770f14e).Verdict: approve. This replaces my change request. The
entry_group_seedguard is gone,v_readfirstlane_b32is left untouched, and the newv5-before-exchangeprologue case covers the shape I reported.Census, same capture and method as before (6,685 distinct mesh programs), main
5770f14evs this head:The earlier head refused all 6,685 programs at the prologue; this head refuses none of them there. No program in this capture stops first at
s3; the remainingunproven mesh entry registerrefusals are VGPRs (262–314), so no movement is expected from this PR.Checked in
entry_wave_info:s_bfe_u32reads only bits 24–27 (offset 24–27, width within the field); SCC is the result ≠ 0, as RDNA 2 defines it for both forms.s_and_b32masks inside0x0f000000only; any other bit refuses throughgraphics_input(3).s3(graphics_registers.count(3)) falls back to the normal path.NIT: the FSSM user-data range/width check is separate hardening from the wave-info read. It loses nothing here, but one line about it in the PR body would help the next reader.
Update: the first run was on a main that refused 257 programs early (my #3707, #3892; fixed by #3893). I reran main
5770f14eand this head, both with that fix: 0 moved, 0 lost, 0 gained. The numbers above are unchanged.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T23:04:57Z.
Merged
main(67862ee4) into this branch. The reviewed commitd2261ce7is unchanged, and no follow-up fix was needed.Tests, Windows 11 26200 with RTX 5080 and WARP. The mesh filter was
native_direct_mesh|native_direct_container|native_mesh_plus this PR's own tests. Every branch passed a full Debug build of every target, including the C++17native_compute_pack_refusal_check.accepted=1 refused=0). They also fail on a clean67862ee4, and every one of them passed withX2W_SYNC_MESH_REQUESTS=1.All six mesh PRs (#3832, #3835, #3838, #3842, #3843 and #3846) were also merged together onto
67862ee4. That combined tree passed 47/47 in Debug and 47/47 in Release, plus 8/8 under the PR preset. All 15 pairs merge cleanly.Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-02T23:47:28Z.
Marked Ready for review now that #3827 and #3829 have merged, keeping to 5 non-draft PRs per #3514. CI is green at this head. All 17 open PRs from this batch were also merged together onto main
c42b7ce3. That combined tree passes a full build, and the only problems it showed were pre-existing main flakes plus one #3833/#3835 fixture issue that does not involve this PR; the #3835 fix is coming.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T00:24:08Z.
Review: APPROVED
Independently reviewed this head. The wave-info projection is limited to s3 bits 24–27, checks the field bounds before shifting, and preserves ordinary reads after an s3 write. The reflected user-data paths check width and the ES+GS range before assigning registers.
MSVC x64 Debug:
ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(native_mesh_entry_registers_ir|native_direct_mesh)$'passed 2/2, including the existing refusal cases. The trial merge against0b83a346bwas clean.