Shaders: lower v_cmp_class_f16 and v_cmpx_class_f16 #140
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!140
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/140/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?
@lordon1a on GitHub · 2026-11-24 00:53 UTC · original
feat/cmp-class-f16→main· +108 −16 · 2 files · 1 commits · merged 2026-11-24 07:51 UTCSummary
Extends
Lower::compare()incrates/victory-shader/src/emit/lower.rsto lowerv_cmp_class_f16andv_cmpx_class_f16(already decoded bygfx10/opcodes.rs), sharing the existing IEEE-754 class-mask lowering withv_cmp_class_f32.Rather than widening via
legacyF16ToF32(which would normalize f16 denormals into f32 normals and quiet f16 signalling NaNs),f16inputs are classified directly on the raw 16-bit halfword fromhalf_src(inst, 0)(exponent shift 10, sign bit 15, exponent mask0x1F, mantissa mask0x03FF, quiet bit0x0200), applying VOP3abs/negdirectly on sign bit 15 so sNaNs are preserved.Verification
Tested on Windows 11 (
rustc 1.100.0,x86_64-pc-windows-gnullvm, Intel Iris Xe8086:46a6driver32.0.101.7088):main@4c0bb89lower.rswith the new test):cargo test -p victory-shader v_cmp_class_f16_matches_rdna2-> FAILED:lower: Unsupported { offset: 44, what: "v_cmp_class_f16" }.cargo test -p victory-shader v_cmp_class_f16_matches_rdna2-> ok (all 10 IEEE-754 binary16 classes including+/-sNaN,+/-qNaN,+/-inf,+/-normal,+/-denormal,+/-0.0, plusop_sel:[1,0]high half andnegmodifier preserving sNaN).cargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan-> 69 passed, 0 failed (skipping only the pre-existingmainIntel Xemed3failure tracked in #110).cargo xtask policy: 151 files ok (synthetic GFX10 shader only; zero game data).cargo clippy -p victory-shader --all-targets: 0 new warnings.AI-assisted.
@DaviTostes on GitHub · 2026-11-24 01:05 UTC · original
Tested
1823079on Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 56 passed, 0 failed (2 test binaries), including the test this PR adds forv_cmp_class_f16/v_cmpx_class_f16.victory-gpuE0425.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
@marquezinii on GitHub · 2026-11-24 05:15 UTC · original
Ran
1823079merged ontomaind2a4bae(clean; the branch was 6 commits behind) on NVIDIA.valu_testsruns each case on the hardware device and on WARP.x86_64-pc-windows-msvc, debugv_cmp_class_f16_matches_rdna2: ok on bothcargo test -p victory-shader --lib -- --test-threads=1: 70 passed, 0 failedcargo test --workspace -- --test-threads=1: 265 passed, 0 failed, 4 ignored@Lyrnc on GitHub · 2026-11-24 06:26 UTC · original
RDNA2 hardware check of the class bits: match.
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.
v_cmp_class_f16 vcc, v4, (1 << bit)for each of the 10 mask bits, over 11 halves (junk in the high half), with FP16 denormals kept and flushed.0x0000,0x80000x0001,0x83ff0x3c00,0xbc000x7c00,0xfc000x7e00,0xfe000x7c01(sNaN)negmodifier on the high half.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.