Shaders: lower untracked v_cndmask_b32/carry-in masks via lane_bit and descriptor-only GetDimensions #585
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!585
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/585/head"
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?
@FibbS6 on GitHub · 2026-11-24 05:13 UTC · original
FibbS6:fix/cndmask-untracked-mask-and-descriptor-dims→main· +131 −50 · 1 files · 2 commits · closed without mergingProblem
Two common shader patterns currently fail to lower and get dropped:
v_cndmask_b32and carry-in VALU ops (*_ci_u32) whose scalar mask operand was not tracked as a structured boolean (or uses inline0/-1constants).GetDimensions) where the resource type/layout is already known fromUsedResourcemetadata.Fix
mask_condto handle inline0/-1constants, tracked masks, and untracked scalar masks vialane_bitwhen console lanes are active.GetDimensionsloads using nativeUsedResourcemetadata.Verification
cargo xtask policy— passed (151 files ok)cargo clippy -p victory-shader --lib -- -D warnings— 0 warningscargo test -p victory-shader -- --test-threads=1—69 passed, 0 failed@iurysf on GitHub · 2026-11-24 06:16 UTC · original
Tested offline against main
d2a4baewithvictory translate --list --validateover the title'sshaders.rpf+ executable (26,096 programs), dxil.dll 1.9.2602.17:emit/lower.rs(~L440-500: phi worklist vs sort/any), so #309 + #385 + this PR don't merge cleanly. One of them will need a rebase.AI-assisted.
@slint6614-dev on GitHub · 2026-11-24 09:24 UTC · original
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate --pipelines(pipelines created on an AMD RX 9070, Windows 11, dxil.dll from SDK 10.0.26100). Counts are emitted / validated / pipelines. This PR was merged locally with current mainc7a5f49first (main: VS/PS 12224 / 12148, CS 1440 / 1417, MS 8163 / 8101; it includes #612).@Hiiva on GitHub · 2026-11-24 09:53 UTC · original
I tested the mask-operand change from
afbe339on top of the corrected #189 emulation stack. The scalar fallback unconditionally setsWAVE_OPS, even whenlane_bituses the emulated console lane and emits no host wave operations.Small integration fix and synthetic regressions:
github.com/Hiiva/VIctory@e3da6a2aeeThe new CPU test fails before the fix because SFI0 contains
WAVE_OPSin Emulate mode. After the fix, DXIL validation and WARP readbacks pass forv_cndmask_b32and all three carry/borrow-in forms, with an ordinary scalar mask pair containing different low/high halves plus inline zero and minus one. Each case checks all 128 threads across two console waves. The existing 14 CPU wave tests and shader all-targets clippy also pass.This is a portability/metadata correction, not evidence that the extra flag caused a title crash. I tested the mask change only; the descriptor-only GetDimensions commit is not included in this branch.
@rpmaster2 on GitHub · 2026-11-24 10:45 UTC · original · edited 2026-11-24 12:31 UTC
Independent test on RDNA4: this PR alone, on
main@58fed37, diag build, DRED on, 300 s run from an identical restored save.Method: count unique
stage/hashpairs whose pipelines are dropped withshader does not translatein the log.maina select on an untracked mask96 log lines,a lane mask holding lanes elsewhere read as data80main+ this PRSo on this title it removes 439 of 472 refusals here, and both mask reasons disappear from the log entirely. Remaining reasons with this PR:
a descriptor read only as data(24 lines),a structured buffer of unknown stride(8),a descriptor's address or format read as data(1).The run itself: world at ~1 fps, 150 draws/frame, 13 black-frame warnings, no device removal in 300 s. Before this PR
mainloses the device at frames 1090-1290 in every one of five runs, so this run also happens to be the first that does not crash in that window - but the world is still black, so the remaining refusals (or something else) still cost the picture.A later control run on
maingave 440 unique refusals (375 compute, 26 mesh, 34 pixel, 5 vertex, with the same mask counts 95/81), so the baseline is stable and this is not a shader-cache effect: the cache key includes a blake3 of the executable, so each build has its own entries.Stacking this PR with #660 gives the same 33, i.e. no further gain here; #660 alone has not produced a world run on this host yet (its first run stayed in the front end), so I will not claim anything about it.
Not tested:
cargo test, clippy, other GPUs - this is only a game-run measurement.No game data: counts, shader hashes, driver version and error strings only.
AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.
@rpmaster2 on GitHub · 2026-11-24 11:43 UTC · original · edited 2026-11-24 12:31 UTC
Correction to my earlier comment - the in-game number I quoted is not a valid measure of this PR, and I withdraw it.
I re-measured offline with
victory translate --pipelinesover the whole dump (26,148 programs found, same input for every build):main@58fed37main+ this PRSo this PR emits 21 more vertex/pixel programs and 4 more compute programs, and no change in mesh. That is a real, positive delta.
The "472 -> 33 refused pipelines" I reported from game runs is confounded: the runs covered different amounts of world content (a
mainrun reached 2,220 draws/frame at frame 1500, the run of this PR 152 draws/frame at frame 1171), so fewer shaders were ever requested, independent of this PR. The log hash is the container's blake3 prefix, so the counts are per shader, but the set of shaders the world asks for differs run to run. I cannot attribute the in-game drop to this PR, and I should not have.What still holds: with this PR every pixel/vertex/mesh shader of the run translated and the run survived 300 s without a device removal, while
mainlost the device at frames 1090-1500 in six of six runs. That may still be worth a look, but it is one run and I would not treat it as evidence.Remaining top refusals offline with this PR: a 64-bit image atomic (653 programs), a scalar memory read as data (612), a descriptor read only as data (570), a descriptor neither loaded nor built (298).
No game data: counts, driver version and error strings only.
AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.
@dragoso on GitHub · 2026-11-24 18:45 UTC · original
In-game A/B on an RTX 5060 Ti: #585 clears "a select on an untracked mask" in every shader that hit it in the run, with no regression. None of those shaders becomes usable yet: each stops at its next refusal, mostly "a descriptor read only as data". No game data in this comment: counts, shader hashes and offsets only.
Setup
--features diagnostics:mainatffe310e, and this PR (f800f1c) merged ontoffe310e(clean merge)VICTORY_CACHE_DIRfor each build,VICTORY_KEYS=60:Enter,90:Enter, 7-minute cap. The world is entered at +1:50 in both.Results
main0x887A0006)Shader by shader, over the 1,991 shaders seen in both runs:
mainit was refused with "a descriptor read only as data", so this is the descriptor-onlyGetDimensionscommit.mainrefused with "a select on an untracked mask" all get past it, and stop at the next refusal:This matches the gap with #1247's offline count (+25 validated programs). In the game, the select is rarely the last blocker: #585 is necessary for these 78 shaders, but not enough on its own. Stacked with #1067, most of the 42 should become measurable.
Separately, 5 shaders still fail with "a lane-mask join of an untracked mask". That is a different refusal, the same on both builds. They are
2561af9577c47289,8b9483919d8d5e99,ce79e9eba7ae0348(compute) andb37565055f2f7d3b,cc6def9058a4bc0a(pixel).The world removes the device with both builds, so nothing here changes that outcome.
AI-assisted (Claude Code); everything was run on our machine.
@dragoso on GitHub · 2026-11-24 19:19 UTC · original
Follow-up: #585 stacked with #1067 adds 563 host pipelines on an RTX 5060 Ti and loses none. 190 of them need both PRs. Counts only; no shader names or dumps.
My earlier in-game numbers came from runs that end when the world removes the device, so they depend on how far each run gets. These come from a run that doesn't:
victory translate --validate --pipelines --listovershaders.rpf(retail 1.0.2.1, 26,084 programs). A program counts as usable only when its D3D12 pipeline is created on this GPU (NVIDIA RTX 5060 Ti, 32-lane, driver 32.0.16.1742, dxil.dll from SDK 10.0.26100).Builds:
mainffe310e,ffe310e+ #585, andffe310e+ #585 + #1067. The last one had one conflict, indescriptor_data's branch for a descriptor with no use; I took #1067's side, which covers #585's.mainmainmainmainwith "a descriptor read only as data", so they come from the descriptor-onlyGetDimensionscommit. The select change by itself does not complete any program: all 288 programsmainrefuses with "a select on an untracked mask" move on to another refusal, 205 of them to "a descriptor read only as data".main's failure:0x80070057at PSO creation (wave64)In the game, the stacked build had 0 regressions: no shader whose pipeline was created on
mainfails with it. It reaches the world and is removed with0x887A0006likemain, so it doesn't change that outcome.AI-assisted (Claude Code); everything was run on our machine.
@BitWuehler on GitHub · 2026-11-24 20:24 UTC · original
In-game Linux + Proton + NVIDIA RTX 5080 confirmation alongside
#1067(with#1067'sdescriptor_datamerge resolution):"a select on an untracked mask is not supported"dropped from89→0unique world shaders onGE-Proton11-14(driver 620.73.04, retail1.0.2.1,series-x).#1067(67 → 0), unique untranslated shaders dropped415 → 308(-107) and median worlddraws/framerose2,076 → 3,051(peak8,073) with 0 GPU faults, 0 device removals, and 0 kernel Xids.Full A/B table posted in #1067. (AI-assisted log summary; own retail copy, no game files or raw logs attached.)
@Marvisak on GitHub · 2026-11-25 00:25 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1084. Its mask half (select and carry-in on an untracked mask test the lane's own bit) was taken over as #1084 with tests. Its other half guesses a descriptor-only load's view kind from the used-resource entry, which carries no dimension; main takes the kind from a twin load instead (
75677cb8).If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed