Run pixel shader wave operations over helper lanes, as the console does #2371
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2373"
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 Marvisak/VIctory. Originally posted by Vyto-Line on 2026-11-25T12:10:04Z.
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.
Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T12:22:55Z.
Review: COMMENTED
Two points block this PR. Two points are questions. One point is context.
Blocking: the cache key freezes a value that can be set later
build()builds the key once in aOnceLock. The key now includeshelper_lane_waves().set_helper_lane_waves()runs inHost::create(), afterD3D12CreateDevice. Nothing makescreate()run before the firstbuild(). Ifbuild()runs first, the key freezes withhelper_lane_waves() == false. The cache then serves 6.6 translations on a 6.7 host, or the reverse. This is the sameOnceLockrace that PR #2369 addresses. Fix: set the value before the first key is built, or read the value when the key is used, not when it is frozen.Blocking: no test
The PR adds 107 lines and no test. Nothing covers the DXIL group-5 attribute (
waveops-include-helper-lanes), the 6.7 header (version and shader model), or theselect(isHelperLane, a, r)fallback. The repo requires a test that fails before the fix and passes after. Please add one for each change, or say why a test is not possible.Question:
set_function_attroverwrites the attributeset_function_attrwritesfuncs[i].attr = Some(attr)with no check.mainis created withattr = None, so this is safe today. Ifmainever carries another attribute, this overwrites it. Should the setter reject an already-set attribute?Question: two call sites for
set_helper_lane_wavesvictory-gpu/src/host.rs::create()andvictory-shader/src/emit/host.rsboth callset_helper_lane_waves(). The two crates share one globalAtomicBool. Could the two hosts disagree in one process? Are both call sites needed?Context: the remaining hang is a vertex shader
The PR notes that
MSR_VS_CascadeShadows_drawskinnedstill hangs. That is a vertex shader, outside this pixel-only fix. This is context, not a defect in this PR.Assisted-by: DeepSeek V4 Pro (OpenCode)
Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T12:36:03Z.
Review: COMMENTED
Helper-lane wave operations gated on SM 6.7 (CheckFeatureSupport), mergeable=False against main
940d32f69b— needs a rebase. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Note SM 6.7 requires Agility SDK 1.7x — ties to #2383.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:29:58Z.
Automated triage for the maintainers.
Needs rebase. This PR conflicts with current
main(940d32f) incrates/victory-gpu/src/shader_cache.rsandcrates/victory-shader/src/emit/lower.rs. Its content will be reviewed once it is rebased.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 13:02:50 +00:00
Imported from Marvisak/VIctory. Originally posted by YaBulochka on 2026-11-25T12:47:05Z.
Regression data point on the full retail dump: this PR gains 808 programs but loses 3,002, so the net is -2,194 validated.
Method:
victory translate shaders.rpf --validate --list, Linux/Wine, dxil.dll 1.9.2609.5,x86_64-pc-windows-gnurelease.940d32f(baseline)Program-by-program (
common the sorted validated lists):emit: a scalar memory read as data- e.g.MSNC_VS_MirrorReflectionPedTransformSkinD_907647ea_Wrappedat0x22dc,MS_VS_MirrorReflectionPedTransformDecalsD_db76baa6_Wrappedat0x1474;MSNC_VS_*/MS_VS_*(mesh and vertex stage), not pixel.So the helper-lane pixel work does what it says for its own stage (that is presumably the +808), but something in the same tree makes scalar memory reads fail to trace in the mesh/vertex lowering. Worth running this exact command before merging; if you want, I can also bisect the PR's commits to say which one introduces the
scalar memory read as datapath.Baseline command and dump are the same as in the #1458 reports.
Imported from Marvisak/VIctory. Originally posted by YaBulochka on 2026-11-25T13:10:29Z.
Correction to my comment above - the regression is not in this PR, and I compared against the wrong baseline.
The PR's merge-base is
ffe310e, not940d32f. Numbers on the same dump, same command:ffe310e(this PR's base)58f0be9)940d32f(current main, unrelated to this PR)So on its own base this PR is neutral: 21,724 before, 21,724 after, same lost set (
emit: a scalar memory read as dataonMSNC_VS_*/MS_VS_*). The 3,002 programs I attributed to this PR were already failing at its base; something betweenffe310eand940d32ffixes them.Apologies for the noise - the fix is to rebase the PR on current main and re-run, where the expected number is 23,918.
upstream-sync referenced this pull request2026-11-25 15:04:27 +00:00
upstream-sync referenced this pull request2026-11-25 17:05:03 +00:00
upstream-sync referenced this pull request2026-11-26 02:07:05 +00:00
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T17:08:55Z.
AMD data, Radeon 780M (RDNA3 iGPU, reports SM 6.8), Windows 11, head
58f0be9.I wrote a hardware test for this: a pixel program (hand-assembled console ISA) that serves one per-pixel key per pass (
s_ff1of EXEC,v_readlane,v_cmpx), then reads the x neighbour's result with DPPquad_perm:[1,0,3,2], drawn as a triangle whose edge crosses quads (16x16, 136 pixels covered). Neighbour results wrong:63bcca4(wave64 program)So the 6.7 path does fix helper lanes on RDNA3 (3/3 runs), and WARP needs it too (it leaves helpers out of
waveActiveBallot).Two problems though:
dxil.dll):Container part 'Program Output Signature' does not match expected for module.The PR movesdx.valverto 1.7 whilecontainer::signaturestill writes the parts the 1.6 way. The title doesn't run the validator, so it only shows in tests; the numbers above were taken with validation made non-fatal.victory-gpu/src/host.rs,shader_cache.rs,victory-shader/src/emit/host.rs,lower.rs).Happy to share the test (
emit/helper_lane_tests.rs, ~250 lines, no other changes) if you want it in the PR.AI-assisted (Claude).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T18:42:39Z.
Follow-up on the validator failure: it comes from
dx.valver, not the 6.7 shader model.shader.rssets bothdx.versionanddx.valverto 1.7, butcontainer::signaturewrites the signature parts the way validator 1.6 does. Keepingdx.valverat 1.6 whiledx.versionanddx.shaderModelgo to 6.7 makes the validator accept them:(in place of
self.m.named_md("dx.valver", vec![version]);)With that change on
58f0be9and validation fatal again, the helper-lane draw test validates and gives 0 wrong neighbours in wave64 on both the Radeon 780M and WARP (main: 8 and 18). The test is now its own PR, #NUMBER, ignored as a defect until a fix like this one lands.AI-assisted (Claude).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T18:53:36Z.
@vyto-line I rebased this onto main
63bcca4with the validator fix, in case it's useful: https://github.com/kilolimaVI/VIctory/commits/shader/helper-lane-wavescreate_deviceinemit/host.rs; main'shelper_reads_ownkept but skipped when helper lanes are on;victory-gpu/host.rskeeps both checks.shader_cache: the folder key is computed when the cache is opened, before any device exists, sohelper_lane_waves()was still false there. The flag now keys each entry instead (unchanged on 6.6 hosts).dx.valverstays 1.6 (the validator fix above), and the helper-lane test from my test PR is no longer ignored.On a Radeon 780M with validation fatal: the helper-lane test gives 0 wrong neighbours on the 780M and on WARP (main: 8 and 18);
victory-shader303 passed,victory-gpu --features diagnostics246 passed on the 780M and WARP, clippy clean with default and all features.Feel free to pull it into this PR. If you'd rather I open it as a separate PR that keeps your commit, say so.
AI-assisted (Claude).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T14:48:51Z.
@Vyto-Line since this is labeled "needs rebase" and there was no reply to the rebased branch, I opened #3749 to carry it forward. Your commit is in it unchanged, with your authorship, plus the
dx.valver1.6 fix and the un-ignored helper-lane test (780M: 8 → 0 wrong, WARP: 18 → 0).If you'd rather update this PR yourself, say so and I'll close #3749.
AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.