Skip to content

[BUNDLE] Shader instruction lowering: 10 PRs, #156 #162 #169 #368 #379 #990 #1021 #1048 #1052 #1053 (rebuilt on main 70564ae) - #1492

Open
MamaLeVrai wants to merge 24 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/shader-lowering
Open

MamaLeVrai wants to merge 24 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/shader-lowering

Conversation

@MamaLeVrai

@MamaLeVrai MamaLeVrai commented Nov 24, 2026 •

Copy link
Copy Markdown

One PR in place of 10. After main moved, this bundle keeps the 10 of its earlier 20 PRs that still merge; the left-out ones are listed below. The earlier description follows, and may mention PRs or measurements that no longer apply. Twenty open shader PRs that add or fix the lowering of single instructions (SAD, frexp and ldexp, f16 division fixup, packed and 16-bit integer ops, scalar SCC flags, buffer and image details, mesh output bounds, hardware tests), merged on top of the stack #1319 and #1402. Every head is merged unchanged onto main (70564ae, after the maintainer's 28 commits of Nov 24, 22:36 CET), and the result is built and tested together.

For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a [BUNDLE] PR. The re-verification commands are below, so one run covers all of it.

What is inside

PR Author Head Title
#156 Rareuncommon 344704e02 Shaders: lower v_mul_hi_u32_u24 and v_mul_hi_i32_i24
#162 Rareuncommon 5d6889e8b Shaders: lower v_sad_u8, v_sad_hi_u8, v_sad_u16, v_sad_u32 and v_msad_u8
#169 Dufftwt 645391bcc Shaders: tbuffer_load_format_d16 loads pack two 16-bit channels per VGPR
#368 Quat3rnion f47ebd83f Shaders: lower buffer cache invalidations as no-ops
#379 LouisRiverstone 5ecb6abe7 Shaders: lower v_div_fixup_f16
#990 LouisRiverstone 8d67fa5b0 Shaders: hardware test for v_cvt_f16_u16 and v_cvt_f16_i16
#1021 CaravelaLabs 3d71ad1a6 Shaders: s_atc_probe's immediate is not a register
#1048 LouisRiverstone 7b57e8e8d Shaders: hardware test for s_bfe_u32
#1052 LouisRiverstone 41b2472e1 Shaders: hardware test for the integer v_min3/v_max3/v_med3
#1053 LouisRiverstone 393320dfa Shaders: hardware test for v_cmp_class_f32

Changes made while bundling

No PR was edited, and there is no hand resolution: a PR that does not merge as it is, is left out (below).

Left out, and why

Rebuilt on the new main. The earlier version of this bundle had 20 PRs; 10 merge here in order, each checked with clippy as it went in.

Verification

Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 486 passed, 0 failed, 7 ignored (one run; main: 476 passed, 7 ignored)

The title was not run, so this says nothing about in-game effect. No game data is used or committed.

Re-verify in one go

git fetch https://github.com/MamaLeVrai/VIctory.git bundle/shader-lowering
git checkout FETCH_HEAD
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked

To confirm that no component PR moved since this was built, compare each Head above with gh pr view <n> --repo Marvisak/VIctory --json headRefOid. If one differs, the branch needs a rebuild: merge the new head in the same order.

If this lands

The component heads are in the history unchanged, so each PR's commits and authorship are kept and GitHub should mark them merged. Merging them one by one instead works too, with the exceptions noted above.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

LouisRiverstone and others added 14 commits November 24, 2026 07:34
The ISA's special cases in its order: a NaN numerator or denominator comes
back quieted, 0/0 and inf/inf give NaN, x/0 and inf/x a signed infinity,
0/x and x/inf a signed zero, otherwise |S0| with the quotient's sign.
Worked on the f32 values of the f16 operands, which are exact.
The ISA's "exponent of S0 all ones -> overflow" check runs before the
final |S0| case, so a NaN quotient with a finite, non-zero numerator and
denominator gives sign | infinity, as measured on gfx1036 hardware. The
zero, infinity and invalid checks still come first.
The d16 forms of the typed buffer loads return each channel as 16 bits,
two per VGPR, low half first; the decoder already sizes their data that
way. The lowering only treated `buffer_` names as d16, so a
tbuffer_load_format_d16_* went through the 32-bit path: the first VGPR
got channel x as a 32-bit value (the f32 bits of 1.0 instead of the f16
pair (1.0, 2.0)) and the other channels were dropped.

The format path now packs its channels for d16: integer formats keep
their low 16 bits, the other formats become f16 (as the MUBUF d16 path
converts them).
SDATA on s_atc_probe and s_atc_probe_buffer is a 7-bit immediate, the buffer resource is four dwords, and GLC/DLC are not operands of either.
buffer_gl0_inv and buffer_gl1_inv name a buffer but read no descriptor, so resource tracking refused them before lowering. Skip descriptor tracking for _inv buffer instructions and lower the pair to nothing, as the existing scalar cache instructions already are. Add a synthetic full-pipeline test.
The high dword of the 48-bit product whose low dword v_mul_u32_u24 and v_mul_i32_i24 already give: the low
24 bits of each operand, zero- or sign-extended, through the existing mul_hi.

The test module gets lowers_valu, a one-thread compute program with root constants in v1..v4 and a buffer
store of v0 (built with lower_with), so a vector instruction can be checked for lowering without a GPU.

AI-assisted (Claude Code).
src2 plus the sum of the unsigned differences |a - b| of the operands' bytes (v_sad_u8), halves (v_sad_u16)
or whole dwords (v_sad_u32), wrapping at 32 bits. v_sad_hi_u8 adds the byte sum shifted to the high half;
v_msad_u8 leaves out a byte whose mask byte (src1) is 0.

AI-assisted (Claude Code).
Buffer format loads divide a UNORM or SNORM field by its largest value.
A host may divide through a reciprocal and land just below 1.0: on an
RX 9070 (RDNA 4), 16_16_UNORM's 65535 loaded through the d16 path as the
half 0x3BFF instead of 0x3C00. The largest value now selects 1.0, and an
SNORM field's two lowest values select -1.0, as the formats define them.
Copilot AI balanced review requested due to automatic review settings November 24, 2026 18:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@justlovett0

Copy link
Copy Markdown

Investigated this bundle and cherry-picked from it. Stack: main ffe310e + #175/#994/#747/#302/#193/#704/#309/#953/#1067/#986/#1260/#1267/#1254/#1276/#189 (wave64 emulation), RTX 3080 10 GB / Win10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124). Re-census of captured runtime containers; world stable ~9 min, 0 device removals.

The whole-bundle merge was entangled with the #1319/#1402 base and a large mod.rs test-module divergence, so instead I cherry-picked the components matching our runtime refusals: #1084, #305, #306, #176, #587. Measured: compute emission 493/560 (+3); #305 cleared our 64-bit image atomics (2 → 0); no regressions; world stable.

Finding for the bundle's framing: these instruction-lowering fixes sit deeper than the frontier that dominates our runtime refusals — "a descriptor's address or format read as data" (50), "an address not from a root parameter" (25), "an address from a phi" (12). Until those descriptor/address classes clear, the instruction fixes give marginal runtime gain (the same shaders stop at the earlier descriptor gap). The bundle is still valuable as those clear.

AI use: Qwen Code; local measurements, user-confirmed visuals. No game data posted.

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump: #98 costs 31 programs; the other 20 PRs change no count

Recommendation: Drop #98 from this bundle until it handles these programs. All the PRs measured here lose nothing else.

I ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11, and compared the results program by program (25,889 programs). Each head is built on its own, release profile.

Build Validated Change Lost
#1402 head 2310409 (this bundle's base) 23,412
this PR, head c1e74a3 23,381 −31 31
this PR with the #98 merge (eb37d6d) reverted 23,412 0 0

What #98 loses. All 31 programs fail with "a whole-wave section step the simulation does not follow". They validate on #1402, and they validate again once only the #98 merge is reverted. Another 15 programs that already failed move to the same reason: 11 from "a structured buffer of unknown stride" and 4 from "image_gather4_l". This matches what zed6000 measured for #98 alone on main in #1247 (29 compute programs lost).

The other 20 PRs change no count on this data. Without #98, the bundle and #1402 agree program by program. That is expected for single-instruction lowerings and hardware tests whose instructions the remaining failures do not reach first. Their effect on output correctness is not measured here.

These counts show only that programs translate and pass the validator. They do not show that the output is correct. I did not render anything. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

@MamaLeVrai
MamaLeVrai force-pushed the bundle/shader-lowering branch from c1e74a3 to b372f6f Compare November 24, 2026 19:08
MamaLeVrai added a commit to MamaLeVrai/VIctory that referenced this pull request Nov 24, 2026
…#1504, verified together

Merges Marvisak#1145 Marvisak#343 Marvisak#1042 Marvisak#1303 Marvisak#477 on top of the stack of Marvisak#1504 (Marvisak#1319,
Marvisak#1402, Marvisak#1492, Marvisak#1504, on main ffe310e), each head unchanged, no conflicts
and no changes of mine. cargo clippy --workspace --all-targets --locked
-- -D warnings, with and without --all-features, is clean and cargo test
--workspace --locked passes (406 passed, 6 ignored; main has 342 passed,
6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@MamaLeVrai

Copy link
Copy Markdown
Author

Thanks for the measurement, and for the two runs that agree on #98 (this one and #1247's). #98 is out: bundle/shader-lowering is now b372f6f, the same 20 other PRs, with clippy (both runs) and cargo test --workspace clean (381 passed, 6 ignored). The PR text says why #98 was dropped. #1504 and #1511 are stacked on it and have been rebuilt on the new head: #1504 is now 9ed1660 (its tree differs from the previous one only by the removal of #98's change in wave.rs, nothing else), #1511 is 24c8a52. The measurements above for them were taken on the previous heads; I expect the counts above #1492 to hold and the 31 programs to come back, but I have not measured it, so a re-run on the new heads would confirm. AI-assisted (Claude Code); no game data.

@MamaLeVrai
MamaLeVrai force-pushed the bundle/shader-lowering branch from b372f6f to 5bbc098 Compare November 24, 2026 19:21
MamaLeVrai added a commit to MamaLeVrai/VIctory that referenced this pull request Nov 24, 2026
…#1504, verified together

Merges Marvisak#1145 Marvisak#343 Marvisak#1042 Marvisak#1303 Marvisak#477 on top of the stack of Marvisak#1504 (Marvisak#1319,
Marvisak#1402, Marvisak#1492, Marvisak#1504, on main ffe310e), each head unchanged, no conflicts
and no changes of mine. cargo clippy --workspace --all-targets --locked
-- -D warnings, with and without --all-features, is clean and cargo test
--workspace --locked passes (406 passed, 6 ignored; main has 342 passed,
6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KainanP added a commit to KainanP/VIctory that referenced this pull request Nov 24, 2026
…sak#98, Marvisak#334 to Marvisak#492, validation)

The line rebuilt on the bundles' current heads (Marvisak#1402 119b763, Marvisak#1492 5bbc098
without Marvisak#98, Marvisak#1504 1d41891, Marvisak#1511 ca601f0) with every merge replayed, and the
merges after this file's first version (Marvisak#334, Marvisak#346, Marvisak#1024, Marvisak#211, Marvisak#492): merge
order, the runner's numbers on 967d3ae (RTX 571, WARP 570 + the known Marvisak#1084
failure, all features 580; Marvisak#98's one test leaves), what is not included (Marvisak#98,
Marvisak#282 for Marvisak#346, Marvisak#693 for Marvisak#1024, Marvisak#306's latest commit), and the open pull
requests whose head is contained here (109, from the 18:24 collection).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MrEjecutor

Copy link
Copy Markdown

@MamaLeVrai thanks, measured as you suggested, offline on the same RTX 5060 Ti (translate --validate --pipelines):

AI use: Claude Code (Claude Opus 5.5); checked by mrejecutor.

@MamaLeVrai
MamaLeVrai force-pushed the bundle/shader-lowering branch from ea33d12 to 8fb97d2 Compare November 24, 2026 23:50
@MamaLeVrai MamaLeVrai changed the title [BUNDLE] Shader instruction lowering: 21 PRs, #98 #156 #162 #168 #169 #368 #379 #456 #587 #990 #1021 #1048 #1052 #1053 #1095 #1142 #1190 #1211 #1223 #1259 #1293, stacked on #1402 [BUNDLE] Shader instruction lowering: 10 PRs, #156 #162 #169 #368 #379 #990 #1021 #1048 #1052 #1053 (rebuilt on main 70564ae) Nov 24, 2026
@MamaLeVrai

Copy link
Copy Markdown
Author

MrEjecutor: thank you, and for keeping the two counts apart. A note on what moved since: main now has 28 commits of the maintainer's own (ffe310e..70564ae), and #1492 no longer builds on #1402. I rebuilt it on that main from the PRs that still merge: its head is now 8fb97d2 and it has 10 of its earlier 20 PRs (the others are listed in the body, with the file each conflicts in). Your run at 5bbc098 is therefore a measurement of the earlier version, and #1589 (#189) conflicts with the new main, so your 329 to 0 refused and 372 fewer emitted programs are for the old base.

AI-assisted (Claude Code); no game data.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Proposed close: a bundle that only re-packages other people's pull requests. This branch combines other contributors' open PRs (#156, #162, #169, #368, #379, #990, #1021, #1048, #1052, #1053) through merge commits. Its own merges add no change beyond combining both sides in valu_tests.rs and lower.rs. Each component PR is open and can be reviewed and merged on its own, which keeps review and authorship with each author. The measurements posted here are still useful on the individual PRs.

The description contains instructions addressed to agents verifying the PR (fetch, check out and run cargo); automated triage did not follow them.

This pull request will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.