Repository navigation
Shaders: pixel wave operations include helper lanes on SM 6.7 hosts - #3749
kilolimaVI wants to merge 4 commits into
Conversation
On the console, whole-quad mode puts a pixel program's helper lanes in EXEC, so a loop that serves one value per pass (s_ff1 of EXEC, v_readlane, v_cmpx) serves them too, and a quad read of a helper's result gives its value. The host's ballots leave helper lanes out (before shader model 6.7's WaveOpsIncludeHelperLanes), so a helper is never served. helper_lane_tests draws such a loop over a triangle whose edge crosses quads (16x16, 136 pixels) and reads each pixel's x neighbour with DPP quad_perm. On main a neighbour reads 0 for 8 pixels on a Radeon 780M (RDNA3) and 18 on WARP; with Marvisak#2373's wave operations over helper lanes (validation made non-fatal) 0 on both. Ignored as a defect, as semantics_tests does for an open one, until a fix lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The console's wave operations include a pixel shader's helper lanes; the host's leave them out. A loop that serves one lane's value per pass (v_readfirstlane, then the lanes with that value) never serves a helper lane whose value no live lane shares, and a loop over a range taken from a whole-wave min/max gives a helper lane an unreliable range. Such a lane runs to the loop limit; on an RTX 3080 that made single draws of Grand Theft Auto VI's world (PS_VehicleLiveryOff..., PS_Textured_Eight) take longer than the driver allows, which reset the GPU. Each was found with every draw and dispatch made to finish before the next. Where the host runs shader model 6.7, pixel shaders with wave operations are now emitted as 6.7 with the entry attribute "waveops-include-helper-lanes" (DXC's [WaveOpsIncludeHelperLanes]); the attribute group is written only into modules that use it, so other shaders' bytes are unchanged. Without 6.7, v_readfirstlane in a pixel shader gives a helper lane its own value: what the console gives it on the pass that serves it. The setting is part of the translation, so the shader cache keys on it. The RTX 3080 reports 6.7; all of the title's vertex and pixel pipelines build with it. With it, the vehicle draw no longer hangs; another draw (MSR_VS_CascadeShadows_drawskinned) still does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The container's signature parts are written the way validator 1.6 does (container::signature), so a module that also declares dx.valver 1.7 failed validation: "Container part 'Program Output Signature' does not match expected for module." dx.version and dx.shaderModel go to 6.7 for pixel shaders with wave operations; dx.valver stays 1.6, which the validator accepts. helper_lane_tests is no longer ignored: with helper lanes in the wave operations it gives 0 wrong neighbours in wave64 on a Radeon 780M (RDNA3) and on WARP (8 and 18 before), with validation fatal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head
AI use: Claude Code (Claude Opus 5.5). |
|
NVIDIA row for this PR: it passes on Ampere, and the un-ignored test fails on this card without the fix. This adds an NVIDIA run to the 780M + WARP one in the description. RTX 3070 (desktop), driver 616.56, Windows 11 Pro 10.0.26100, debug. Head
Nothing NVIDIA-specific: Ampere misses fewer helper-lane neighbours than the 780M on main (5 against 8), and none with the PR. Not tested: a title run, so not the world draws that reset the RTX 3080; AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
|
I checked the disk-cache question from @upipibi's report on
Each row shared one disk cache directory across four separate processes. In every case the cached shader matched a fresh translation, including the emitted DXIL. With only the entry key selector reverted to the main behavior, the process with WARP incorrectly hit the offline SM 6.6 entry and the assertion failed. The existing triangle-edge test also passed on WARP with 0 incorrect neighbour values out of 136 pixels. This checks offline prefill and reuse with an SM 6.7-capable host. The local run used WARP. GitHub lists the upstream CI run as action required with zero jobs started. Please retain Git authorship if reusing the probe, or add |
|
@andrewpozdnakov7-jpg thanks, that closes the one part nobody had run: the per-entry cache key, with the negative control showing main's keying would hand WARP the 6.6 entry. If the probe can live as a test (two translations into one temporary cache folder, one with helper-lane waves on and one off, asserting each reads back its own DXIL), I'd like to add it to this PR with your authorship kept, as with the gather tests on #3613. Could you push it as a commit on top of AI-assisted (Claude). |
|
The test commit 152ebaa is directly on aa7f8a5. It uses a generated straight-line pixel shader and the public shader-cache entry points. In one temporary cache directory the two settings each miss once, then each hits its own entry. At every step the cached HostShader matches a fresh translation, with DXIL shader model 6.6 or 6.7 as appropriate. The separate integration test executable owns its cache and translation setting. It runs on the CPU and creates no GPU device. With main's entry key the test fails on the first helper-enabled lookup because that lookup hits the earlier entry. The author head passes the integration test, the shader-cache unit tests, strict Clippy, and the asset policy. You can cherry-pick 152ebaa. Please retain the Git author, or add a Co-authored-by trailer for andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com if folding the test into another commit. AI-assisted with OpenAI Codex. |
|
@andrewpozdnakov7-jpg's cache test is now on this branch as-is, with his authorship (head
With upipibi's RTX 3070 (5 → 0 neighbours wrong) and ColorMeBoom's RDNA1 run, that covers the shader change on three GPU families and the cache key with a test. What's left untested is a title run. AI-assisted (Claude). |
Rebase of @Vyto-Line's #2373 onto main
63bcca4, with the one fix it needed to validate. Vyto-Line's commit is kept as-is with his authorship. #2373 is labeled "needs rebase" and has had no reply since the rebased branch was offered there on Nov 27, so this carries it forward. Happy to close this if he updates #2373 instead.The problem (from #2373): the console's wave operations include a pixel shader's helper lanes; the host's leave them out. Lane-mask loops (
v_readfirstlane, then the lanes sharing that value) never serve a helper lane whose value no live lane shares, so it runs to the loop limit. On an RTX 3080 that made single world draws take longer than the driver allows and reset the GPU.The change:
waveops-include-helper-lanes(DXC's[WaveOpsIncludeHelperLanes]). Other shaders' bytes are unchanged. The setting is part of the translation, so the shader cache keys each entry on it (entry_build), since the device decides it only after the cache is opened.dx.valver1.7, every 6.7 pixel shader failed validation ("Container part 'Program Output Signature' does not match expected for module"), becausecontainer::signaturewrites the 1.6 format.dx.versionanddx.shaderModelgo to 6.7;dx.valverstays 1.6, which the validator accepts.helper_lane_tests(from Shaders: a test of lane-mask loops at a triangle edge (ignored: defect) #3571) is no longer ignored.Builds on #3571. Its test commit is the first commit here.
Results, AMD Radeon 780M (RDNA3, SM 6.8) + WARP, Windows 11, validation fatal:
Full suite:
victory-shader303 passed,victory-gpu --features diagnostics246 passed.Merges cleanly with #3556, #3588, #2841 and #3007. With #3583 and #3613 the only conflict is the order of the test module lines in
emit/mod.rs. Related: #1970 also setsWaveOpsIncludeHelperLanes, inside a 38-file local-fork bundle 479 commits behind main.AI-assisted (Claude).