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!2999
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2999"
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?
@wwwwwwww3333333 on GitHub · 2026-11-26 03:00 UTC · original
wwwwwwww3333333:fix/compute-lane-quads→main· +541 −24 · 3 files · 6 commits · openBuilds on #1237 by @felicienradio (its commit is kept as is, rebased onto main
63bcca4) and adds what makes it match the console in groups of more than one row. It is for the 735 compute programs of #2027 ("Function uses features incompatible with the shader stage (cs)"), which #1237 was measured to validate without a newer validator (@wildheathen's census on #1237; my changes here do not touch validation, and I have not rerun the census). Among them are the fog/lighting apply pass (CS_ApplyCombinedDeferred, #2045) and the density shadow blur.The problem the earlier comparisons did not reach. The console takes an implicit level from quads of lanes, and its compute lanes hold threads in x-major order: in an
[8, 8, 1]group a quad is four threads of one row. Hosts place two-dimensional groups their own way. On an RX 6750 XT the host put 2x2 tiles of threads in a quad, so main, #1065 and #1237 all took the "y" derivative across rows. The 1D tests on #1237 could not show this, since a one-row group keeps its order everywhere. @ElSeba0811 saw a 2D case pick a different mip on #1237 and fixed it locally the same way (a one-row host group); the test below says which answer is the console's.What changes (second commit)
image_samplewithout_l/_lz/_d/_cd, orimage_get_lod) in a group of more than one row, and no other cross-lane code, runs as one host row of as many threads. Thread ids are taken back from the flat id. Programs that already use cross-lane code keep main's relabelling to console lanes, which also makes the quads right. No wave size is forced, so 32-lane hosts run wave64 programs as before.a16) the bias is the low half's f16, as on main'ssampleBiaspath. #1237 read it as f32, andimage_addresses_of_16_bits_and_clampsfailed with it.Test
compute_samples_take_derivatives_from_lane_quads: an[8, 8, 1]group, coordinates from the thread ids, chosen so that each derivative pair has one nonzero vector (the result does not depend on how the sampler combines them). Lane quads give level 1; 2x2 tiles give level 3. Each level of the texture holds its own number. RX 6750 XT (driver 32.0.21045.29003) and WARP, wave32 and wave64:63bcca4(The first three rows are wave32 on the hardware adapter, from a first version of the test whose u also stepped along x, which read 3 on every tree; they are the 2x2-tile answer either way.)
Suites (Windows 11, Rust 1.98.1 MSVC): victory-shader 303 passed (main alone: 302; the difference is the new test).
cargo clippy -p victory-shader --all-targets -- -D warnings: clean.Not measured: how the lit world looks with it. That needs a run in the title.
Unit tests only, no game files.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LwHmoV6jP696CZH3DVW7V1
@steven-seagull27 on GitHub · 2026-11-26 03:16 UTC · original
The compute LOD change matched all 16,416 expected samples per adapter on an RTX 5080 and Microsoft WARP at
1d7472f. I also found a one-line correction for the PR's test fixture.The original
quad_programreads its UVs withbuffer_load_dwordx2 ... offen. DXC disassembly identifies that SRV as aByteAddressBufferand shows a two-componentrawBufferLoad. The test currently binds it asStride::Structured(8). Changing the UV view toStride::Rawmakes the descriptor match the shader. With that one change, the original coordinates and sampler returned level 1 for 64/64 lanes in each guest wave mode on both adapters. Test fixture, line 1114For the wider test I dispatched 2 × 3 × 2 groups and used the guest XYZ local and group IDs to address the UV and output buffers. Each consecutive four guest lanes shared a prescribed footprint of 2, 4, 8 or 16 texels. Each mip had a distinct constant color, with point filtering and clamp-to-edge. I ran plain
image_sample,image_sample_bwith alternating FP16 biases of +1 and −1, and explicit mip zero. The SDK validator accepted all shader variants.653b119(#1237 rebased)1d7472fBoth adapters returned the same counts for guest wave32 and wave64. Across all cases, including 3 × 5 × 4, the predecessor missed 7,844 of 16,416 values on each adapter. These are synthetic texture readbacks. I haven't measured a game frame with this change.
@zed6000 on GitHub · 2026-11-26 03:34 UTC · original
The census you hadn't rerun. Measured offline on the title's shaders (the method in #1247), head
1d7472fmerged ontomain63bcca4(a clean merge), RX 7900 XTX (RDNA3), dxil.dll 1.8.2502:mainwith the validator'sEntry function performs some operation that is incompatible with the shader stage. Program by program, they're exactly the same 748 programs #1065 (cbd152c) gains on the same base. So on this title the two are interchangeable in count; the difference is the 2D quad order this PR adds.compute_samples_take_derivatives_from_lane_quadspasses on RDNA3: Wave32 and Wave64, hardware and built-in WARP, every lane at level 1.0.cargo test -p victory-shader --lib --locked: 303 passed, 0 failed, 3 ignored.cargo clippy -p victory-shader --all-targets --locked -- -D warningsis clean.Offline counts and unit tests only; no program names or data.
@wwwwwwww3333333 on GitHub · 2026-11-26 03:53 UTC · original
Both fixed in
7b5a3fc. @fuzeofficlal: the offset word is now decoded once, before the sample, sampleBias and sampleGrad paths, soimage_sample_oin compute takes the quad path with its offset instead of being refused. @steven-seagull27: the test binds the coordinates asStride::Raw, as the program reads them, and also runsimage_sample_o. On an RX 6750 XT and WARP, wave32 and wave64, every lane reads level 1 in all eight cases; victory-shader 303 passed twice, clippy clean. Thanks to both of you, and to @zed6000 for the census.@steven-seagull27 on GitHub · 2026-11-26 04:06 UTC · original
@wwwwwwww3333333 I retested
7b5a3fc. On RTX 5080, Windows WARP and WARP 1.0.22, all 640/640 tagged offset samples per adapter returned the expected mip and texel. Each texel identifies its mip, X and Y, so an ignored or incorrectly signed offset changes the readback even if the sampler chooses the correct mip.At mip 1, lane 0 read
(8,6)with offset(0,0),(9,6)with(+1,0), and(6,7)with(-2,+1). The five offsets ran across all 64 threads for both guest wave sizes. On1d7472fthe same offset shaders were refused before dispatch. The updated stock raw-view test and the earlier 16,416-lane multidimensional LOD matrix also passed on each adapter.AI-assisted with Codex. Synthetic tagged textures.
@Marvisak on GitHub · 2026-11-26 05:30 UTC · original · edited 2026-11-26 07:19 UTC
Automated triage for the maintainers.
Thanks, the size issue is fixed. In
86f801cthe lane-quad code (implicit_level,row_thread_id,quad_gradients,sample_offsets) moves tocrates/victory-shader/src/emit/lower/quads.rswith no change in logic.lower.rsis back under the 512 KiB limit, and CI is green.Merge candidate. A compute program that samples with an implicit level runs its multi-row groups as one host row. The thread ids are rebuilt from the flat id, so quads are four lanes of one row, as on the console. The thread backs this with GPU readbacks on RTX 5080, WARP and two AMD cards, covering the texel-offset path, and with a census of +748 validating programs and none lost.
For the maintainers:
653b119), so landing this supersedes #1237, which is still open.CI: passing.
Recommending a look, not approving.
Generated by Claude Code
@wwwwwwww3333333 on GitHub · 2026-11-26 06:03 UTC · original
CI fix in
86f801c: the lane-quad code (implicit_level, the one-row thread ids,quad_gradients, the offset-word decoding) moves toemit/lower/quads.rs, aslower/bvh.rsdoes.lower.rsis now 522,621 bytes. No change in behaviour: victory-shader passed 303 of 303 twice on an RX 6750 XT, Clippy is clean, and the xtask policy tests pass. CI is green.@kotekompotek on GitHub · 2026-11-26 03:04 UTC · original · approved these changes
LGTM — verified the mechanism end to end. implicit_level excludes only _l/_lz/_d/_cd (bias/_cl stay implicit). The row flattening to [xyz,1,1] forces x-major lane quads on every host, with thread_id reconstructing console (x,y,z) from flattenedThreadIdInGroup via URem/UDiv — decomposition is exact. quad_gradients uses lane base|1 and base|2 deltas (hardware coarse-derivative semantics), bias scales by 2^bias through exp2, and the sampleGrad arg order (offsets, ddx3, ddy3, undef clamp) matches DXIL op 63. The test discriminates the two orderings: lane quads give level 1, 2x2 tiles give 3.
@fuzeofficlal on GitHub · 2026-11-26 03:22 UTC · original · requested changes
Code review on
1d7472f7(static source inspection; no runtime GPU/DXIL validation executed):crates/victory-shader/src/emit/lower.rs:8880-8920):let quad_grads = matches!(op, 60 | 61) && self.s.threads.is_some() && self.s.mesh.is_none() && kind != 5;intercepts non-cube computeimage_sample_o(op == 60) andimage_sample_b_o(op == 61) before the existing60 =>offset decoder, and immediately returnsErr("a sample offset outside a pixel shader")wheneveroffset_wordis set.image_sample_owith valid immediate offsets (-8..=7) reached the offset decoder in60 =>. Since DXILsampleGrad(op 63) already accepts the sameosimmediate offset arguments right below (args.extend(&os)), decoding and validatingoffset_wordbefore selectingsampleGradvssamplefixes the regression cleanly. Adding a computeimage_sample_ooffset test case would lock this in.@Dukestar69 on GitHub · 2026-11-26 07:29 UTC · original · approved these changes
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP +dxil.dll):cargo test -p victory-shader compute_samples_take_derivatives_from_lane_quads -- --test-threads=1(RTX 5090 & WARP): 1 passed, 0 failed on both.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 09:48 UTC · original · requested changes
86f801cfmoves the quad helpers cleanly intoemit/lower/quads.rs(bringingemit/lower.rsdown to522,621bytes), fixes the computeimage_sample_oregression by decodingoffset_wordahead of the60 | 61 if quad_gradsbranch, and binds the coordinate SRV asStride::Raw.A few issues still need attention:
image_sample_b_ois unreachable despite matchingimplicit_level:quads::implicit_levelmatchesimage_sample_b_o(triggering group reshaping), and lines 8837-8854 already handleoffset_wordalongsideop == 61, yetemit/lower.rslines 8664-8677 only dispatchimage_sample_b(image_sample_b_ohitsErr(name)), and lines 8748-8749 only skip the bias address word for exactname == "image_sample_b". Please either wire up and testimage_sample_b_oor explicitly scope it out.quad_gradientsreads quad lanesbase,base | 1, andbase | 2viawaveReadLaneAt.i32without checking source-lane activity. Please add test coverage for a partial tail quad or divergent control flow.compute_samples_take_derivatives_from_lane_quadshas a uniform color, the in-tree test only checks mip selection rather than texel offset forwarding; a tagged-texel assertion would pin that down in CI. Alsorustfmt --edition 2024 --checkreports line-wrapping diffs inquads.rsandsynthetic_tests.rs.Verified locally on Windows 11 x64 (RTX 5090 + WARP +
dxil.dll,86f801cf):cargo run --locked -p xtask -- policy: passed (192 files ok)cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): cleanemit::lower::tests: 33 passed, 0 failedcompute_samples_take_derivatives_from_lane_quadsandimage_addresses_of_16_bits_and_clamps(RTX 5090 andVICTORY_WARP=1): 1 passed, 0 failed each@wwwwwwww3333333 on GitHub · 2026-11-26 10:53 UTC · original
Thanks @fuzeofficlal. All three are addressed in
9833d58.Tests (RX 6750 XT and WARP, Windows 11, Rust 1.98.1 MSVC): the lane-quad test passes in wave32 and wave64 for all three forms, twice in a row. victory-shader 303 passed, 0 failed, 3 ignored. clippy -D warnings clean, cargo xtask policy 192 files ok, lower.rs 523,244 bytes.
Not covered: quads that diverge before a sample, and any title.
@steven-seagull27 on GitHub · 2026-11-26 11:00 UTC · original
@wwwwwwww3333333 Confirmed
9833d58on an RTX 5080 and Windows inbox WARP. Withimage_sample_b_o, both returned 1,920/1,920 correct mip and texel tags in each of two fresh runs. That is 960/960 for guest Wave32 and 960/960 for Wave64 on each adapter. I used point sampling, LOD biases −1, 0, +1, and five signed XY offsets across all 64 threads of an 8×8 group.The tag encodes mip, X and Y independently. Holding lane 0's offset at
(-2,+1)gave these exact readbacks on both adapters.At bias +1, changing just the offset to
(0,0)read mip 2 at(4,3)(20196). The unchanged PR test also passed all three instruction forms on both guest wave sizes and adapters. For a[3,1,1]group, translation refused all three forms on Wave32 and Wave64 with the expected partial-quad diagnostic, before dispatch.AI-assisted synthetic test. Divergence within a quad and title behavior remain untested here.
@fuzeofficlal on GitHub · 2026-11-26 11:18 UTC · original · requested changes
Verified
9833d580on RTX 5090 and WARP:image_sample_b_ois now wired into thesampleGradpath, partial-quad thread groups are rejected (product % 4 != 0),emit/lower.rsstays under the policy cap at523,244bytes, andcompute_samples_take_derivatives_from_lane_quadspasses all three forms (Plain,Offset,BiasOffset) in Wave32 and Wave64 on both hardware and WARP with tagged texel checks.One remaining blocker prevents merging:
console_lanes(emit/lower.rs:620-626, 2936-2976):if !console_lanesskips flattening[X, Y, Z]to[X*Y*Z, 1, 1], leaving the 2D/3D group intact and falling back tothread_id'salign_down(waveReadLaneFirst(flattenedThreadIdInGroup), wave) + lane_index. On hosts that assign 2D groups in 2×2 tiles rather than x-major order (e.g.,[6, 8, 1]at Wave32), two waves can start at flat IDs0and28, both rounding down to0and producing duplicate guest thread IDs and corrupted quad gradients.Two smaller notes:
waveReadLaneAt.i32unconditionally onbase,base | 1, andbase | 2(quads.rs:45-70), where inactive lanes yield undefined values (potentially propagating intosampleGradderivatives); keeping that boundary explicit and/or adding divergent-quad coverage is worth considering.quads::implicit_level(quads.rs:8-15) matchesimage_get_lod,image_sample_c,image_sample_cl, and cube (kind == 5) ops even though computequad_gradsonly lowers non-cubeop60/61.Please make multi-row implicit-level compute groups with
console_lanesindependent of host tile ordering and add a multi-wave test covering that combination.Verified locally on Windows 11 x64 (RTX 5090 + WARP +
dxil.dll,9833d580):cargo run --locked -p xtask -- policy(192 files ok) andcargo clippy --workspace --all-targets -- -D warnings(default and--all-features): clean.emit::lower::tests(33 passed),compute_samples_take_derivatives_from_lane_quads(Wave32 & Wave64, all 3 forms),image_addresses_of_16_bits_and_clamps, andemit::tests(17/17): all passed on both RTX 5090 and WARP.@steven-seagull27 on GitHub · 2026-11-26 11:39 UTC · original
@fuzeofficlal I reproduced the multi-row failure from your review on
9833d580, on both the RTX 5080 (621.40) and app-local WARP 1.0.22. The guest shader combinesimage_samplewithv_readlane_b32and stores a pair at every guest thread ID: the tagged mip/texel it sampled and the flat ID it read from wave lane 0. ReviewA native HLSL probe on both adapters read first flat IDs 0 and 28 for the two 6 × 8 waves. Both round down to base 0. Sixteen IDs get assigned twice and IDs 32–47 are missing. The native 48 × 1 control read 0 and 32. An independent CPU model enumerating 2 × 2 tiles gives the same collisions.
The fix uses one host row for implicit-level sampling even when another instruction requires console lanes. It retains the wave lane index and reconstructs x/y/z with the original guest dimensions. Across the three shapes the RTX matched 208/208 Wave32 pairs. WARP 1.0.22 matched 208/208 at each of Wave32 and Wave64. Windows inbox WARP skipped both fixed widths. The regression also checks the emitted group dimensions without a working GPU. These measurements cover the converged sampling path. Commit and regression
The original quad sampling test, strict all-feature shader Clippy, and asset policy passed. AI-assisted with Codex. Synthetic inputs on native Windows.
@wwwwwwww3333333 on GitHub · 2026-11-26 12:15 UTC · original
Thanks @fuzeofficlal for the review and @steven-seagull27 for the reproduction and the fix. I took steven's commit (eec9008, now
3f6b205on this branch, author kept) as it is: a multi-row group that also needs console lanes is flattened to one host row for implicit-level sampling too, and the thread ids are rebuilt from the guest dimensions.On an RX 6750 XT (RDNA2, driver 32.0.21045.29003, Windows 11, Rust 1.98.1), with the commit on top of
9833d58:Not addressed in this push: quads that diverge before a sample (still undefined, as on the hardware), and the cube and image_get_lod cases where implicit_level matches more than compute lowers (I haven't added coverage for them).
@fuzeofficlal on GitHub · 2026-11-26 12:40 UTC · original · approved these changes
Verified
3f6b2052: removing the!console_lanesgate (crates/victory-shader/src/emit/lower.rs:616-624) flattens multi-row implicit-level compute groups even when fixed wave widths are requested, andthread_id(emit/lower.rs:2935-2977) reconstructs guest coordinates usingself.rows.or(self.s.threads). The mergedemit/lower.rsis 523,400 bytes (888 bytes under the 524,288-byte limit).Local verification passed:
xtask policy(192 files ok),cargo clippy -p victory-shader --all-targets -- -D warnings(default &--all-features),emit::lower::tests(33 passed),multirow_samples_and_console_wave_reads_keep_each_guest_thread(208/208 sample + wave-base pairs matched across6x8,6x16, and8x8on RTX 5090 Wave32; Wave64 hardware and inbox WARP skipped viaOPTIONS1), and bothcompute_samples_take_derivatives_from_lane_quads(Plain/Offset/BiasOffset, Wave32/Wave64) andimage_addresses_of_16_bits_and_clampspassed on RTX 5090 and WARP.Non-blocking note:
quads::implicit_levelstill matchesimage_get_lod,image_sample_c*, and cube ops outside compute lowering'squad_gradssupport, and divergent quads remain outside verified coverage. Approving to clear the earlier request for changes.@neonbyte1 on GitHub · 2026-11-26 20:18 UTC · original
In-game result on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with vkd3d-proton,
VICTORY_WAVE32_APPROX=1. GTA VI's opening yard.Base:
mainplus the wave64 stack #2176 → #2711 → #2925 reconciled with #439, and a few unmerged PRs this setup needs. On that base, 8 compute/pixel programs are still refused in game.Added: this PR together with #2363 and #1014's permlane change (manual merges onto that stack; neither is based on #2176/#439).
This PR's program now runs in game:
5b2ce592c3a5dd09CS_DensityShadowMapMips("implicit-derivative sample in console flow without 64-lane host waves" before).AI-assisted (Claude); measured on my machine, no game data shared.
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.