shader: read the wave size of slot 67 compute requests from .sa #3006
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3006"
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 Leyukaka on 2026-11-27T04:17:45Z.
Fixes #2999. Part of #2935. Target branch
main.Change (
src/shader_compute_request.*,src/gfx1013_compute_native.cpp,src/native_compute_output.h,src/direct_compute_cache.cpp,src/startup_stubs/d3d12_compute_dispatch.inl,tools/startup/compile_dxil.cpp):read_compute_requestsetsComputeRequest::wave32from bit 20 of.sadword 4: set means wave32, clear means wave64. A.sathat is not 28 bytes is still refused, as before.translate_computecompiles a wave64 request through the wave64 path thattranslate_compute_containeralready uses for a stage withoutwave32.v_mbcnt_hiadds nothing for its lanes. One known difference remains: a wave64 compare or carry-out also writes zero to the high word of an SGPR pair destination, and the wave32 model leaves that word as it was.29cs, as onmain, and revision-28 archives are still read. The bit's meaning is an inference from captured data, explained in #2999 and indocs/experiments/native-slot67-wave-size.md.Native output revision. A native compute manifest now ends with
native <revision>, fromnative_compute_output_revisioninsrc/native_compute_output.h.<key>.cs.hlsl, which is a native output from before this change.ManifestRetryschedule of an absent manifest: 1 s, doubling up to 32 s.<key>.cs.hlslis a Python output and is used as before.compile_dxil --watchrebuilds stale native outputs. An unmarked output with a sidecar goes on to the usual bytecode check.<key>.cs.hlsl.compile_dxilalready republished a Python-translated key. That directory needs one--requestsrerun.Fixtures.
native_dpp_row_check.py, added onmainsince the first version.startup_compute_root_srv_dispatch_check.pynow copies the Python sidecar along with the manifest and bytecode in its bad-manifest cases.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
main8cf9be9bplus this commit.ctest -R "native_|startup_compute|startup_shader_cache_rekey|compile_dxil|startup_manifest_retry"passed 344 of 345, with five WARP capability skips (77).native_scalar_lds_hardwarefails with "native compute PSO creation failed", as it does onmainwithout this change.native_slot67_wave_size_hardwarebuilds the samev_mbcnt_lo/v_mbcnt_hiprogram as three requests. The stored lane indices match a CPU reference, with every other buffer word untouched:tid % 64tid % 32tid % 32native_compile_dxil_watch,startup_compute_dispatch_warp/_hardwareandnative_startup_request_cache_checkcover the stale-output paths. I described them in the earlier comment.Mutation checks, run by hand on the earlier
cpp-migrationhead and not rerun on this one:--watchkeep it, skipping the bytecode check for a Python output, and keeping the.cs.hlslon a native publish.Measured on a local capture (counts and instruction shape only), on
cpp-migratione0d83759before this was rebuilt onmain, withcompile_dxil --jobs 8 gfx1013-direct-cs@36 --requests. I have not re-measured onmain, which has gained lowerings since.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T04:43:17Z.
Review: COMMENTED
The cold-cache lane-index fixture verifies the new wave-size decoding. Issue #2999 also calls for rebuilding cached translations on update. The PR documents that
--watchand the stand-in can still reuse the old<key>.txt/<key>.cs.cso, so a warm native cache can keep running the old wave32 result for a wave64 request. Please add an upgrade control that prepopulates the old output, then show that the updated consumer refreshes or rejects that output. A native output compatibility check could preserve legacy Python request keys while doing this.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T05:13:44Z.
Thanks, done in the new commits, without changing request keys. The branch also merges
cpp-migration999e17cd, since #3003 changed the same--watchcheck.Native output revision.
compile_dxilnow ends each native compute manifest withnative <revision>. The revision is a constant shared with the stand-in,native_compute_output_revisioninsrc/native_compute_output.h, starting at 1. It is meant to be bumped whenever a native translation of an unchanged request can change meaning.Stand-in. Before reading bindings or bytecode:
nativerevision is refused with "native translation from another compiler revision; rebuild it";nativeline and no<key>.cs.hlslis a native output from before this change. It is refused with "native translation without a revision; rebuild it";<key>.cs.hlslis the Python translator's output and is used as before;compile_dxil.--watchtreats a stale or unmarked native output as pending and rebuilds it..cs.hlslgoes on to the existing bytecode check, so a Python output with incomplete bytecode is still rebuilt.--requestsalready rebuilds every output.<key>.cs.hlslleft by the Python translator, so the new pair cannot pass as a Python output. An unreadable manifest goes on to the bytecode check instead of counting as complete.One case stays undetected: a directory where an earlier
compile_dxilalready republished a Python-translated key. That key's old.cs.hlslsits next to an unmarked native manifest, and nothing tells the two apart. Such a directory needs one--requestsrerun; the doc says so.Upgrade controls:
native_compile_dxil_watchseeds an unmarked native output and anative 0output, each with a dummy.cs.cso. It checks that--watchreplaces the manifest and the bytecode of both. An unmarked Python-style output with a.cs.hlslkeeps all three files byte for byte, with their timestamps. The same output with truncated bytecode is rebuilt, and its.cs.hlslis removed.startup_compute_dispatch_warpand_hardwarecheck both refusal strings with the output untouched. They then check the output words for anative 1manifest and for a Python-style one.native_startup_request_cache_checkchecks the exact native manifest and that no.cs.hlslis written.On the RTX 5080 and WARP, after the merge,
ctest -R "native_|startup_compute|startup_shader_cache_rekey|compile_dxil"passed 280 of 282. The two failures fail the same way on999e17cdwithout this PR:native_scalar_lds_hardwarewith "native compute PSO creation failed", andnative_cvt_pk_u8_hardwarewith words 8, 24, 40 and 56 reading0xa5a5a501where0xa5a5a500is expected. Four manual mutants each fail a new control:--watchkeep an unmarked native output fails the watch check;.cs.hlslon a native publish fails the watch check.One interaction to handle on merge: the portable fixture of #2975 writes a hand-made manifest without a
nativeline, and its HLSL as<key>.hlsl. Under this check, that fixture needs its HLSL saved as<key>.cs.hlsl. I will make that change in whichever of the two PRs lands second.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T05:20:38Z.
Review: COMMENTED
PR #3006 by @Leyukaka — shader: read the wave size of slot 67 compute requests from .sa
What works
Issues
Recommendations
Overall
Well-executed inference-driven addition. The bit extraction is correct, the wave32 model fallback for small groups is a good safety net, and the manifest versioning provides a clean path forward for future native translation changes. The key question for merge readiness is whether the capture analysis in #2999 has sufficient evidence to confirm bit 20 as the wave size marker.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T05:24:51Z.
Review: COMMENTED
Independent Release
/O2on exact head5c49bbe38b803d13bdaccfd4e2584cc91aaffc34, Windows 11 build 26200.9974 and SDK 10.0.26100. I builtstartup_stream_consumer d3d12_xs_shim compile_dxil native_store_replayand rannative_compile_dxil_watch,native_startup_request_cache_controls,startup_compute_dispatch_(warp|hardware)andnative_slot67_wave_size_hardware: 5 passed, no skips. WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 matched all 320 dispatch words for the current and Python-style manifests, preserving sentinels in the stale cases. RTX also matched 128/128/64 lane indices for the three slot-67 cases. The marker keeps the existing request key, but the.cs.hlslheuristic still cannot identify an old native output over a prior Python publication; the documented one-time--requestsrebuild still applies to mixed directories. Please keep the reported #2975 sidecar rename with whichever PR lands second.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T12:26:53Z.
Retargeted to
main. A trial merge at1ec2c938conflicts ingfx1013_compute_native.cpp,shader_compute_request.cpp,d3d12_compute_dispatch.inlandstartup_compute_dispatch_check.py. Please preserve the DPP changes from #3010, revision-29 request keys with revision-28 archive support, andManifestRetrytiming for both absent and stale manifests. Carry the #2975 sidecar naming resolution as discussed. #3014 still follows this PR because both touch the request reader andcompile_dxil; we'll validate the wave-size and cache-rebuild path on the rebased head before requesting the rekey rebase.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-27T17:47:19Z.
Rebuilt on current
main(8cf9be9b) as one commit,e7a1e90f, which replaces the earlier branch history. The description is updated to match. Your four points:gfx1013_compute_native.cppis thewave64expression;main'sheap_windowandparse(...)arguments stay as they are.29cskeys and the revision-28 archive path inshader_compute_request.cppare as onmain; only the returnedwave32field is new.ManifestRetry: both stale-native refusals callmanifest_retry.missed(...)and return; a usable manifest callsfound(). There is noretry_manifest_atleft. An absent manifest keepsmain's handling.main, so there is nothing to rename here. That rename applies to whichever of #2975/#3049 lands after this. Onmain,startup_compute_root_srv_dispatch_check.pycopies a Python manifest and.cs.csointo its bad-manifest cases. It now also copies the.cs.hlsl, so those cases keep testing the binding refusals rather than the stale-native one.One fixture added on
mainsince the first version,native_dpp_row_check.py, built.sawithout the wave32 bit and now sets it. #3022's permlane fixture sets it too, in that PR.On this head (RTX 5080 and WARP, Release),
ctest -R "native_|startup_compute|startup_shader_cache_rekey|compile_dxil|startup_manifest_retry"passed 344 of 345, with five WARP capability skips.native_scalar_lds_hardwarefails with "native compute PSO creation failed", as onmainwithout this change.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T21:56:41Z.
Review: COMMENTED
I tried to review
e7a1e90fover currentmain63fd6ea8. The trial merge (git merge-tree --write-tree origin/main review/3006) conflicts in one hunk ofsrc/gfx1013_compute_native.cpp, just after the0xc00root-flag check. Since this PR's base8cf9be9b, #3140 (673a9f2c) has turned the one-lineifbody there into a block that also setsinitial[next + 1] = {Symbol::Type::table, compute_sampler_heap};. This PR replaces theconst bool wave64 = stage && !stage->wave32;line that follows it. The resolution should keep #3140's block as it is, followed by this PR's comment and newwave64expression. The other files merge cleanly.One interaction to recheck after the rebase: #3180 (
63fd6ea8) gates the wave32 VCC SMEM limit on!wave64. With this PR, wave64 requests over 32 threads would then keep the 106-SGPR limit. That is the intended behaviour. I haven't run it.I'll review it once it is updated with
main.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:22:47Z.
One addition to my comment on
e7a1e90f: as ofmain22f38526there is a second conflict, intests/native_f16_alu_check.py. #3188 (698a057f) changed that GPU check into a loop over analuand adppprogram, and this PR sets the wave32 bit (1 << 20) in the.sadword 4 of that block. The rebased version should keep both programs and set the bit for both requests.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T00:06:48Z.
Rebased on
main14d56502as one commit (7e018ffe). The conflicts were:main's sampler-heap line next to thewave64expression;native_buffer_store_view.hind3d12_xs_device.cpp;tests/native_f16_alu_check.py.main(#3188) already sets the wave32 bit in the one.saboth thealuanddpprequests use, somain's version is kept.tests/native_sdwa_f16_check.pyis the same case onmain(#3201).15 test files now set the bit, down from 17, because
mainalready does it in those two.Tests.
ctest -R "native_|startup_compute|startup_shader_cache_rekey|compile_dxil|startup_manifest_retry"passes 394 of 399 (RTX 5080 and WARP, Release). The 5 failures are the same onmain14d56502without this change:native_scalar_lds_hardware, as before;native_rtv_variant_warp/_hardwareandstartup_compute_dispatch_native_warp/_hardware. They assert the exact cache contents and now find therevision.txtthat #2820 writes. #3228 addresses the twodispatch_nativeones.Measured on the 882 untranslated compute requests ranked in #3224, with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests,main14d56502against this branch.v_cmp_*_e64 s10, ...), then reads[10:11], which the wave32 model leaves unbound.main's whole-program gate for wave64 groups of more than 64 threads.mainwith the wave32 model, although they are wave64 requests. They are refused now rather than translated with the wrong wave size.main. These are wave64 requests over 32 threads that keep the 106-SGPR SMEM limit, which is the behaviour you described.The Tests and Measured sections of the description still describe the first version on
8cf9be9b. This comment replaces them.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T00:43:18Z.
Rechecked
7e018ffeagainst main350785e8after #3227. The only merge conflict is the final compute manifest writer in direct_compute_cache.cpp. Keep main's program.stride_srvs loop before the SRV/UAV/sampler lines, then append the existing native revision line. The new native_descriptor_scc_check.py exact manifest list also needs its final native 1 line.I tried just those two changes locally on the existing PR. Windows 11 26200.9974, RTX 4060 Laptop 32.0.16.1656, Release /O2: native_descriptor_scc_hardware, startup_compute_descriptor_scc_hardware, native_compile_dxil_watch and native_slot67_wave_size_hardware all passed. Please carry those two changes in the existing PR on current main so CI and independent review can evaluate the new head. The reported #3224 compile counts remain separate from GPU readback.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T00:48:21Z.
Rebased again on
main86beae95; head is nowecd2646a.format_compute_runtime_manifest:main'sudsrc ... stridelines from #3227 are kept, and thenative <revision>line still comes last.tests/native_descriptor_scc_check.pycompares the published manifest line for line. With this PR the manifest has one more line,native <revision>. The test now checks that exactly one such line is present and compares the other lines exactly as before.native_compile_dxil_watch_check.pyin this PR counts the line the same way.ctest -R "native_|startup_compute|startup_shader_cache_rekey|compile_dxil|startup_manifest_retry"ran before the test change (RTX 5080 and WARP, Release): 408 of 411 passed.native_scalar_lds_hardwarefailed, as it does onmain.native_descriptor_scctests failed on the manifest line.After the change,
-R "native_descriptor_scc|startup_compute_descriptor_scc"passes both_hardwaretests, and the two_warptests report the capability skip.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T01:00:29Z.
Review: APPROVED
Independent review of
ecd2646aaaintegrated on main86beae95, tree3ab5553ad6. The .sa bit selects the direct DXIL wave model for larger groups; stable request keys still load previous raw requests. Version-tagged native manifests and the watcher prevent stale DXIL reuse, and Python manifests with the existing sidecar are still accepted. The descriptor SCC entry is preserved. The small-group high-half limitation is documented and is outside this change.Debug and Release /O2 each had six passes and three wave32 capability skips, no failures. Hardware verified the new wave-size reference, both descriptor SCC routes, native Dispatch and the legacy/retry controls. WARP was inbox 10.0.26100.9818. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656.
This validates source-built requests and cache migration. The shader census totals are contributor measurements and do not establish title rendering.