Repository navigation
Conversation
|
Reviewed head d027c4f locally (isolated worktree, fresh CARGO_TARGET_DIR, this machine's GPU really dispatches). What it does: Verified locally:
Findings, ranked:
LGTM. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows.
16-bit integer ops now read inline floats as f32 bits (half_int_src/half_src_bits): integer_16bit_ops_read_inline_floats_as_f32_bits pins the reinterpretation.
|
Rebased onto 70564ae. The lowering now keeps upstream's |
d027c4f to
c4d626b
Compare
half_src decoded the inline constants 240..=248 as packed f16 patterns for every 16-bit operation. Hardware only uses those patterns when the source type is F16; an integer operation sees the 32-bit value, so 1.0 is 0x3F800000 and its low half is 0 (the high half 0x3F80). Route v_cvt_f16_u16/i16, the 16-bit add/sub/mul/shift/min/max ops, and the u16/i16 compares through the 32-bit view, keeping f16 operations on f16_operand. Measured on a Radeon RX 7800 XT: v_add_nc_u16 v0, 1.0, v1 with v1 = 5 yields 5, and with op_sel selecting the high half 16261; before the change they yielded 0x3C05 and 5. Addresses VIC-BT-021 from audit Marvisak#1242. Validation: - cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests - the new GPU test on the RX 7800 XT (Agility SDK runtime) -- passed - cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings - cargo xtask policy
c4d626b to
33101a2
Compare
|
Automated triage for the maintainers. Needs work. The head is the same as at the earlier note. On your reply: the code already does what you call the documented rule. The triage has no measurement to point you to. The evidence has to come with the PR. Any of these would do:
The RX 7800 XT run executes the translated DXIL on a PC GPU, so it checks the translator against the test's own expectation, not the console's behaviour. Without a source, the smallest acceptable change is to keep the old behaviour, or to limit the PR to the low-half case and drop the op_sel assertion. The maintainer may also simply decide this one. Generated by Claude Code |
|
I looked for the source the triage asks for and found a note that points the other way, so I would rather ask than cite it as support:
That last point supports the packed path ( If the measured behaviour on the console really is the f32 bits (as the title's constants would suggest), the place to say so is a hardware row like the ones in the AnyPS5 debt page, not the assembler documentation — and I do not have one. Can you point me at the measurement or the ISA section you had in mind? With that I will put it in the PR and the change is ready; without it I would rather keep the old reading than switch to one that contradicts LLVM's documented encoding. |
|
Hardware run on an RX 7800 XT (RDNA3), Windows 10 19045 with SM 6.6 via the Agility runtime for the test binaries (#486): |
Addresses
VIC-BT-021from audit #1242.Summary
half_srcdecoded the inline float constants (240..=248) as packed f16 patterns for every 16-bit operation. Hardware only does that when the source type is F16: a 16-bit integer operation sees the 32-bit value, so1.0is0x3F800000, its low half is 0 and its high half0x3F80.half_int_src(the 32-bit view) next tohalf_src(the f16 view), sharing the op_sel/SDWA half selection.v_cvt_f16_u16/v_cvt_f16_i16, the 16-bit arithmetic/shift/min/max ops, and theu16/i16compares through it.half_fsrc,v_cvt_norm_*_f16,v_cmp_class_f16) keep the f16 decoding.Test
New hardware test
integer_16bit_ops_read_inline_floats_as_f32_bits:v_add_nc_u16 v0, 1.0, v1withv1 = 5gives 5 (low half 0), not the old0x3C05.op_selselecting the high half it gives 16261 (5 + 0x3F80), not 5.Verified on a Radeon RX 7800 XT (Agility SDK 1.616 runtime for SM 6.6): before the change the same test fails with
15365(0x3C05).Validation
cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests— passed (102 tests).cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings— passed.cargo xtask policy— passed (154 files).