Patch (fork): lower 64-bit image atomics, SMEM descriptor size reads, and spilled lane masks (+657 PSOs on RTX 5060 Ti) #728
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Wasler on 2026-11-24T08:27:59Z.
Pull requests are currently restricted to collaborators (
pull_request_creation_policy: collaborators_only), so sharing this tested patch branch from a fork:66252c0Summary
Fixes four top shader translation blockers and improves waterfall descriptor tracking (tested on Windows 11, NVIDIA GeForce RTX 5060 Ti driver 621.01, Windows SDK
dxil.dll10.0.26100.0):crates/victory-shader/src/emit/lower.rs,shader.rs):image_atomic_*(dmask: 0x3for binop,dmask: 0xfforcmpswap), lowering todx.op.atomicBinOp.i64/dx.op.atomicCompareExchange.i64withpack64/split64andATOMIC_INT64_TYPED(1 << 27->SFI0 0x40_0000) +ATOMIC_INT64_HEAP(1 << 32->SFI0 0x1000_0000).crates/victory-shader/src/emit/lower.rs):descriptor_data(), preferFields::Image/Fields::Bufferuses overFields::Smem, and fall back toFields::Smem(s_buffer_load_dword*) for SRV/UAV descriptors when no vector buffer use exists.v_writelane_b32/v_readlane_b32(crates/victory-shader/src/structure.rs,resource.rs,emit/lower.rs):resource::spilled_laneacrossresource,structure, andlower.v_readlane_b32instructure.rs, and handle constant masks (NULL/0/-1) inv_cndmask_b32.lower.rs, treat mask-returningv_readlane_b32asLANE_MASK, and resolve constant-lanev_readlane_b32reads from the spilled lane directly so inactive masks in sibling spill lanes do not poison unrelated scalar lanes.crates/victory-shader/src/resource.rs):v_mov_b32andv_readfirstlane_b32incopy_sourceso VGPR-moved / waterfall-loop descriptors trace back to theirs_loador VGPR phi.Verification
cargo test --workspace: all tests pass (0 failed;victory-shader: 74 passed including 5 new unit tests).cargo clippy -p victory-shader --all-targets: 0 warnings.cargo xtask policy:asset policy: 151 files ok.victory translate --validate --pipelineson local title shader archive (maind2a4bae->66252c0, RTX 5060 Ti):emit: a 64-bit image atomic:653->0emit: a scalar memory read as data:573->0emit: a select on an untracked mask:288->0emit: a lane mask holding lanes elsewhere read as data:276->16resources: a descriptor neither loaded nor built:298->29012,272->12,862emitted (12,761validated,12,862pipelines)1,693->1,748emitted (1,715validated,1,410pipelines; remaining 338 refused = Wave64 on 32-lane GPU)8,191->8,220emitted (8,158validated,8,220pipelines)21,835->22,492(+657 pipelines)Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T09:07:01Z.
Rebased and verified commit
66252c0onto latest upstream main (8e79c80):crates/victory-shader/src/emit/lower.rsand updatedspilled_inactive_mask_does_not_poison_other_lanesto passrsrc2: 0tolowers().crates/victory-shaderpass with 0 failures (sixty_four_bit_image_atomics_lower_and_validate,spilled_inactive_mask_does_not_poison_other_lanes,descriptor_data_handles_s_buffer_load_srv, etc.).cargo xtask policypass (153 files ok).fix/shader-64bit-atomics-smem-and-spilled-lane-masksImported from Marvisak/VIctory. Originally posted by RID-Games on 2026-11-24T10:08:18Z.
Ran
fix/shader-64bit-atomics-smem-and-spilled-lane-masks([08399d7](https://github.com/LAKSHYA-cmd-tech/VIctory/commit/08399d7)) on Linux (rustc 1.100):cargo test -p victory-shaderdoes not compile —sixty_four_bit_image_atomics_lower_and_validatecallsvalidator::Validator::loadunguarded, butvalidatoris#[cfg(windows)](emit/mod.rs:88) →E0433. Adding#[cfg(windows)]to that call (the pattern atemit/mod.rs:471) makes the branch pass on Linux: 75 tests. The same gate is needed inintegrate/gta6-world-and-shader-fixes.With the gate, the branch stacks cleanly with the #724/#725 heap-uav branch — one conflict at the image atomic handle, resolved by keeping both the glc resource flags and the 64-bit atomic feature bits; 79 tests pass. AI-assisted.
Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T10:50:17Z.
On the current
66252c0branch, we found a typed image compare-exchange case where DXV passes but the operation reuses the dimensions query’sRWTexture2D<4xF32>handle. The handle cache key includes only the first resource-properties word. Microsoft DXC’s independent HLSL reference uses the integer annotation{4098,261}for this operation.We put the exact emitter change tested on top of your branch. It carries the full-properties key from #177 and uses the matching integer properties for the dimensions query on this compare-exchange path. We submitted the corrected shader and the DXC reference to an RTX 4090 through Wine/vkd3d-proton. Both returned the original texels
13579bdf2468ace0and13579bde2468ace0. Only the first matched the comparison and changed tofedcba98deadbeef; the second differed solely in its high word and stayed untouched.This is one heap-indexed, two-texel synthetic case. The other atomic operations and the game’s output remain unmeasured.
Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-24T11:03:47Z.
Independent verification of
66252c0on a second host (RTX 4070 SUPER, Windows 10)Cherry-picked your branch onto
d2a4bae(your base) plus this repo's Windows 10 Agility exports(#729), then ran the title for ~3 minutes. Everything below is from that run; no game data quoted.
The patch works — measured against the same title without it
Your three target classes are gone from the log entirely:
What the remaining 317 look like (may be useful for the next patch)
So your "SMEM descriptor size reads" change cleared its named case, but
a descriptor read only as datais now the single biggest blocker at this stage of the title(484 of the remaining failures are descriptor-related in one form or another).
Practical note for whoever lands this
Please rebase onto current
mainbefore merging. On this host the branch sits ond2a4baeandmisses ~50 fixes that landed since; the title runs, but at 2334 draws/frame it sits at 2 fps
(583 ms/frame) with 12.2 GB RSS, which is not usable interactively and is one memory spike away
from wedging the machine. I could not rebase it myself —
lower.rsconflicts badly against currentmainand resolving it by hand would be guessing at your intent.Host: Windows 10 22H2 UBR 3393 (KB5029331), RTX 4070 SUPER 12 GB, Ryzen 7 7800X3D, DXC 1.9.2602.17,
Agility core 1.620.2 in
D3D12\beside the exe.Imported from Marvisak/VIctory. Originally posted by HrHd on 2026-11-24T12:44:08Z.
The fork branch behind this issue needed five conflicts resolved against current
main(ffe310e), and the two that matter are worth writing down because they are not mechanical — anyone rebasing it will hit them and can easily ship a broken merge.1.
crates/victory-shader/src/resource.rs,copy_source(the actual hazard). The fork collapsesv_readfirstlane_b32andv_mov_b32into copy propagation.v_movis already covered upstream, but collapsingv_readfirstlanesilently breaks all 28 per-lane-descriptor/waterfall tests:first_lane_sourcenever fires, and the failures surface asa descriptor neither loaded nor builtfar away from the change. Fix used here: keep upstreamcopy_sourceand instead teachclassifythat av_readfirstlaneof a value that does not vary is a plain copy (uniform_readfirstlane, with afirst_lane_wordsfilter so no waterfall proof is demanded). That needs a per-register write count as a guard — a register written in two blocks is not SSA, and without the guarda_per_lane_descriptor_some_lanes_do_not_write_failsstarts passing when it should fail.2.
descriptor_data, which is also what #180 rewrites. The fork'ss_buffer_load_dwordarm is mutually exclusive with #180's twin-load and only-measured paths in the same function. Merged here by one closure that prefers an image or vector-buffer use over thes_bufferfallback, and looks at the site's own loads first, twins second; thes_bufferarm then sits afterFields::Bufferand only sees the fallback case.Measured here, pack of 25,322 programs, offline translator, same tree:
lane mask holding lanes elsewhere read as data141
victory-shadertests pass with the merge, including the 28 above.Caveats, so nobody is surprised:
a scalar memory read as datalargely stops being its own class and reappears undera descriptor read only as data(394 → 860 in an earlier measurement of the fork alone) — it moves cases between buckets, it does not fix all of them; andcross-lane operation outside computerises 46 → 154 as more compute gets far enough to hit it.The remaining top class (879 programs, a descriptor dword consumed as the address of another
s_load_dword*) is untouched by this branch. Filed separately as #798 with the shape and both possible fixes.Imported from Marvisak/VIctory. Originally posted by Wasler on 2026-11-24T12:48:13Z.
Rebased
Wasler/VIctorybranchfix/shader-top5onto currentorigin/main(ffe310e) in commitb0851fb:emit/lower.rsandresource.rsconflicts (includinguniform_first_lanescoped to same-blockv_mov_b32->v_readfirstlane_b32so all waterfall tests remain intact, and#[cfg(windows)]aroundValidator::loadinsixty_four_bit_image_atomics_lower_and_validate).cargo test -p victory-shader: 125 passed, 0 failed (1 ignored bench), andcargo build --profile diag -p victory --features diagnosticsbuilds cleanly.Imported from Marvisak/VIctory. Originally posted by Sunkiller-qc on 2026-11-24T13:08:57Z.
For the 64-bit image atomics part, there are already open PRs: #305 and #539, plus #705 for typed int64. Also, the handle-reuse problem MichaelSmithAI found on this branch (the atomic reuses the dimension query's float handle) is what #177 fixes. Splitting this branch, so that the SMEM descriptor size reads and the spilled lane masks stand on their own, would make it easier to merge alongside those.
Imported from Marvisak/VIctory. Originally posted by Proudnoob4 on 2026-11-24T15:09:18Z.
Independent corpus A/B on Windows 10 x64: +789 validated, 0 lost
Merged your
fix/shader-top5headb0851fbontoffe310e+ #175 + #579 + #206 + #493 + #876 (typeless views), built clean, then ran the full corpus withtranslate --validate --listin 10 parallel chunks (26,503 containers / 26,084 translated programs, diag build):By stage: pixel +572, mesh +166, vertex +29, compute +22. The largest families are
PS_AlphaPrepass*,PS_AlphaPrepassSpatter*,PS_PedAlphaPrepass*andPS_PedAlphaPrepass_Decals*, which matches your +657 PSO figure on the 5060 Ti (different counting rule and stack).For context, adding #878 on top gives +47 more (I confirmed that independently) and r4tedx's
gpu/run-time-indexed-views+39 more; the full combination reaches 22,554 validated with 0 lost. An RTX 4080 / Win10 run of the full stack survived 900 s with no device removal but the presented frame is still the title card; the black scene is not solved by the translation gains alone.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Proudnoob4 on 2026-11-24T22:05:05Z.
Correction and disclosure for my comment above
It ends with "AI-assisted (Claude Code)", but HY4 Flash (
hy4-flash-free) wrote and posted it. OpenCode ran it after my Claude Code session hit its usage limit. I have now rechecked it with Claude Code against the original files.This correction: Claude Code (Claude Opus 5.5); every figure was recomputed from the original files on my machine.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:48:00Z.
Automated triage for the maintainers.
Thanks for the branch and the measurements. Pull requests are open to everyone now, so please open one for whatever this branch still adds.
Since the branch was posted,
maingained its own versions of most of it:0b35b7f. It includes the GPU testimage_atomics_of_64_bitsincrates/victory-shader/src/emit/valu_tests.rs.75677cb("buffer sizes read from descriptors, and size-only waterfall loops"). It adds theFields::Smemarm ofdescriptor_dataincrates/victory-shader/src/emit/lower.rs.Not obviously covered is part 4, following
v_readfirstlane_b32inresource.rscopy_source. HrHd notes above that collapsing it there breaks the per-lane/waterfall tests. The most useful next step is atranslate --validateA/B of the rebased branch against currentmain. If some programs are still gained, a PR with just that part is the way to land it. #1899 is a separate open PR for 64-bit texture atomics, and #177 covers the handle reuse MichaelSmithAI found.Generated by Claude Code