Shaders: lower s_absdiff_i32, s_sext_i32_i8/i16 and s_pack_ll/lh/hh_b32_b16 #120
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!120
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-120"
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?
@tedin7 on GitHub · 2026-11-24 00:40 UTC · original
tedin7:vic-s-pack-2→main· +66 −0 · 1 files · 1 commits · openWhat
s_absdiff_i32(|a - b| of the wrapped difference, SCC = result != 0),s_sext_i32_i8,s_sext_i32_i16, ands_pack_ll_b32_b16,s_pack_lh_b32_b16,s_pack_hh_b32_b16(halves picked as in the GFX10 ISA).Why
sop()rejected them, so any shader using one failed to translate withUnsupported.Tested
cargo test -j4 -p victory-shader scalar_packwith the lowering disabled (test only): fails withUnsupported { offset: 16, what: "s_absdiff_i32" }.cargo test -j4 -p victory-shaderafter the change: 56 passed (origin/main237f2e8), 0 failed (the new test included).cargo clippy -j4 -p victory-shader --tests: no new warnings (existing: dead_codeconstant_colorin emit/mod.rs, a boolean-simplification note in resource.rs).rustfmt --edition 2024 --checkon lower.rs: clean.lowers()helper in the tests module.@lordon1a on GitHub · 2026-11-24 00:51 UTC · original
Verified
cb40cdcc2on Windows 11 (x86_64-pc-windows-gnullvm,rustc 1.100.0, applied cleanly tomain@4c0bb89): pass.cargo xtask policy: 151 files okcargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan: 69 passed, 0 failed (skipped the pre-existingmainIntel Iris Xemed3failure tracked in #110).AI-assisted.
@DaviTostes on GitHub · 2026-11-24 01:10 UTC · original
Tested
cb40cdcon Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 56 passed, 0 failed (2 test binaries), including the 1 test this PR adds.s_absdiff_i32/s_sext_i32_i8/i16/s_pack_*, and is open; one of the two should be closed.victory-gpuE0425.@Lyrnc on GitHub · 2026-11-24 06:26 UTC · original
RDNA2 hardware check of the new scalar instructions: all match, including
s_absdiff_i32on the wrapped difference.Setup. AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. Hand-written instructions in a HIP kernel (assembled by the AMD driver's amd_comgr). RDNA2 desktop silicon, not the console's. No game data. 141 operand pairs: all pairs of
0, 1, 2, 0x7fffffff, 0x80000000, 0xffffffff, 0x40000000, 0xc0000000, 0x12345678, plus 60 random. SCC was read right after each instruction.s_absdiff_i32:|a - b|of the difference wrapped to 32 bits, SCC = result != 0: 141/141. For example,|1 - 0x80000000|gives0x7fffffff(not0x80000001), and|0 - 0x80000000|gives0x80000000, as your lowering computes.s_pack_ll_b32_b16,s_pack_lh_b32_b16,s_pack_hh_b32_b16:{lo/hi(src1), lo/hi(src0)}: 141/141 each.s_sext_i32_i8/s_sext_i32_i16, measured for #142: sign extension, SCC unchanged.AI use: Claude Code (Claude Opus 5.5) wrote the probes, ran them on the GPU above and drafted this comment; the numbers come from the hardware run.
@alexdeliu on GitHub · 2026-11-24 17:22 UTC · original
Merged onto
main@ffe310eb, this PR (cb40cdcc) no longer compiles its tests.crates/victory-shader/src/emit/lower.rs:7391calls thelowers(&words)test helper. Since25b0f888it islowers(words, rsrc2); main's tests pass0.Checked with CI's steps (both clippy runs with
-D warnings,cargo test --workspace) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87@Marvisak on GitHub · 2026-11-25 00:25 UTC · original · edited 2026-11-25 01:14 UTC
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.