Shaders: lower v_cvt_norm_i16_f16 and v_cvt_norm_u16_f16 #376
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!376
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/376/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?
@LouisRiverstone on GitHub · 2026-11-24 02:43 UTC · original
LouisRiverstone:shader-cvt-norm-f16→main· +127 −0 · 2 files · 1 commits · merged 2026-11-24 08:08 UTCv_cvt_norm_i16_f16andv_cvt_norm_u16_f16(VOP1 0x63/0x64) were not lowered, so any program using them failed to translate.write_half).flt16_to_snorm16/flt16_to_unorm16, the same rule as the f32pknormconversions. I haven't measured these two ops on console hardware.Test:
v_cvt_norm_i16_and_u16_f16_round_the_exact_productinvalu_tests.rsruns both ops on the host GPU and WARP. It covers 287 f16 patterns: every 251st pattern, plus ±0, subnormals, ±0.5 (the tie), the values next to 1, ±1, ±inf and NaNs. Each result is checked against an f64 reference.dxil.dll10.0.26100 passes.lower.rschange it fails withUnsupported { what: "v_cvt_norm_i16_f16" }.cargo test --workspace, clippy andcargo xtask policyare clean.No game files.
AI-assisted (Claude Code): I reviewed the change and ran the tests above.
@jeremygold02 on GitHub · 2026-11-24 04:10 UTC · original
Thanks @LouisRiverstone for the exact-product conversion work. I tested head
ded334bb9172865a9be7acdb8a2047358a30e4dbwith:Result: 1 passed, 0 failed (69 filtered out). This exercises both signed and unsigned normalized f16 conversions against the test’s f64 reference over the synthetic edge-pattern set. It does not measure behavior on console hardware.
@Lyrnc on GitHub · 2026-11-24 06:02 UTC · original
RDNA2 hardware measurement over all 65,536 f16 patterns: the exact-product, round-to-nearest-even rule matches every one, in the FP16 mode that keeps input denormals.
AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. A HIP kernel (assembled by the AMD driver's amd_comgr) runs
v_cvt_norm_i16_f16andv_cvt_norm_u16_f16on every half (junk in the source's high half,0xdead0000preset in the destination), under FP16 denormals kept and flushed. RDNA2 desktop silicon, not the console's. No game data.v_cvt_norm_i16_f16v_cvt_norm_u16_f16denorm16= 3)denorm16= 0)0x0101for i16 and0x0081for u16 up), which flush to 0 before scaling. Your lowering matches the denormals-kept mode, the same choice as thepknormforms in #596.0xdeadon all patterns, consistent withwrite_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.