Repository navigation
Shaders: lower v_cvt_pknorm_{i16,u16}_{f32,f16} in pure 32-bit DXIL - #2100
geiyiliyabumo wants to merge 1 commit into
Conversation
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at Overlap, from reading: #596 (open, conflicting with AI-assisted (Claude Code). |
|
I replayed two of Lyrnc's native gfx1036 measurements on
These two inputs would make regression cases for a 32-bit implementation that preserves the native result. Rounding the product to f32 first changes each converted half by one. For the f16 forms, the 422-input native sample in #596 did not distinguish the rounding rules. I compared both models over all 65,536 half encodings on CPU; only four encodings per signedness distinguish them. If someone still has the native probe, one input covers both forms: put half AI-assisted. Synthetic inputs only. Tested f32-only alternative that keeps Int64 off. After NaN handling and clamping, take the magnitude I checked every nonnegative binary32 encoding from 0 through 1 against an exact-product reference for each scale. An experimental lowering passed 94 packed readbacks each on RTX 3050 Laptop and WARP, including the two native f32 witnesses above. SFI0 Int64 stayed clear. The same probe failed on the unmodified PR at the first native witness. This experiment leaves the f16 decision open. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
144 passed / 0 failed / 2 ignored. v_cvt_pknorm_{i16,u16}_{f32,f16} lowered in pure 32-bit DXIL — packed-normalization converts.
|
Confirmed the two packed f32 rounding differences on an RTX 5080 (driver 621.40) at Both adapters passed all 56 round/clamp/pack readbacks and all 8 source-modifier readbacks in the PR. I then ran the two additional inputs below, putting the same f32 bit pattern in both source registers and reading back the packed 32-bit destination.
Each adapter completed both extra dispatches. Relative to the native measurements, each signed half is one high and each unsigned half is one low. This reproduces the earlier RTX 3050 Laptop result on Blackwell. Native Radeon measurements · Earlier RTX 3050 Laptop replay |
Offline measurement on a retail dumpResult: no count change against I merged head de026e8 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. The new
The PR body cites no hardware or compiler evidence for its rounding rule, and the f16 forms are still unsettled. To change the verdict, round from the exact product (a 32-bit way is described in the comments) and add those witnesses as test cases. #596 lowers the same four instructions with exact rounding (conflicting with Generated by Claude Code |
Summary
v_cvt_pknorm_i16_f32(0x368),v_cvt_pknorm_u16_f32(0x369),v_cvt_pknorm_i16_f16(0x312), andv_cvt_pknorm_u16_f16(0x313) incrates/victory-shader/src/emit/lower.rsusing pure 32-bit DXIL without enablingInt64/WIDE_OPS.f32clamping ([-1.0, 1.0]->32767.0fori16,[0.0, 1.0]->65535.0foru16), ties-to-even rounding, NaN ->0, VOP3abs/negsource modifiers, andop_selhalf selection for_f16, while rejecting unsupportedclampandomod.crates/victory-shader/src/emit/valu_tests.rscovering boundary values (0.0,-0.0,±1.0,±0.5,±2.0,±inf,NaN),abs/negmodifiers,op_selhalf selection, output modifier rejection, and verifyingInt64is not set.Verification
cargo xtask policy: passedcargo clippy -p victory-shader --tests -- -D warnings: passedcargo test -p victory-shader --lib v_cvt_pknorm -- --test-threads=1with Microsoftdxil.dll: 3/3 passed on AMD Radeon RX 9060 XT (RDNA4) and Microsoft Basic Render Driver (WARP)