Repository navigation
Direct DXIL: decode inline float constants as f32 for v_cvt_f16_u16 and v_cvt_f16_i16 - #1870
Conversation
|
NVIDIA test report for Tested
Regression run ( base ( this PR: Not tested: this code in the title: it is on the opt-in direct-DXIL path ( AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it. |
|
NVIDIA run, since the description lists it as untested: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
On the rule itself: AnyPS5's translator reads these the same way, as an independent implementation (not a hardware measurement). AI-assisted (Claude Code). Synthetic tests only. |
|
Both AMD and NVIDIA verification look good on |
d0cd5aa to
c076305
Compare
|
|
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
… and `v_cvt_f16_i16`
`Lw::valu16` passed `name.contains("f16")` as `src_f16` to `self.sources()`,
decoding inline float constants (`240..=248`) as f16 bit patterns for
`v_cvt_f16_u16` and `v_cvt_f16_i16`. Both instructions take a 16-bit integer
source (not f16), so inline constants decode as f32 bit patterns per the RDNA2
ISA and `emit.rs` (e.g. `v_cvt_f16_u16 v0, 1.0` produced `0x7380` instead of
`0x0000`).
Exclude `v_cvt_f16_u16` and `v_cvt_f16_i16` from `src_f16`, matching
`recomp/emit.rs`, and add a GPU parity test against HLSL.
Assisted-by: Antigravity (Gemini 4 Neon)
c076305 to
1506f4b
Compare
PR #1870 Arc A770 parity testTested
Process environment used Prebuild outside the mutex: & "$env:USERPROFILE/.cargo/bin/cargo.exe" test -p xcl --lib --no-run --locked --message-format=jsonGPU run in a fresh PowerShell process launched with & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
& 'L:/XclTooling/pr1778-2e2ee55-20261125-020159/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe' 'gpu::dxil::core_tests::v_cvt_f16_int_decodes_inline_float_constants_as_f32' --exact --nocapture --test-threads=1
}Raw logs use the prefix Not tested
AI use
|
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
|
NVIDIA and AMD full-suite run, to go with the reports above by JJAutoCompare, since none of them covers AMD. Tested exact head Tested
Not tested
AI use
|
|
merge-check Optional test assertion, verified locally on this head (1 passed)diff --git a/crates/xcl/src/gpu/dxil/core_tests.rs b/crates/xcl/src/gpu/dxil/core_tests.rs
@@
("V_CVT_F16_U16", "ENC_VOP1", &[("VDST", 2), ("SRC0", 248)], None), // f32 1/(2pi) = 0x3E22_F983 -> low16 = 0xF983
("V_CVT_F16_I16", "ENC_VOP1", &[("VDST", 3), ("SRC0", 248)], None), // low16 = -1661 as i16
@@
- for r in 0..=2 {
+ for (r, want) in [0x0000, 0x0000, 0x7bcc, 0xe67d].into_iter().enumerate() {
assert_eq!(direct.vgpr[0][r], hlsl.vgpr[0][r], "v{r}: {:#x} vs {:#x}", direct.vgpr[0][r], hlsl.vgpr[0][r]);
+ assert_eq!(direct.vgpr[0][r] & 0xffff, want, "v{r}: independent low-half result"); |
|
merge-check claim |
|
merge-check |
…nts as f32 Direct DXIL: decode inline float constants as f32 for `v_cvt_f16_u16` and `v_cvt_f16_i16` (1506f4b): `Lw::valu16` passed `name.contains("f16")` as `src_f16` to `self.sources()`, decoding inline float constants (`240..=248`) as f16 bit patterns for `v_cvt_f16_u16` and `v_cvt_f16_i16`. Both instructions take a 16-bit integer source (not f16), so inline constants decode as f32 bit patterns per the RDNA2 ISA and `emit.rs` (e.g. `v_cvt_f16_u16 v0, 1.0` produced `0x7380` instead of `0x0000`). Exclude `v_cvt_f16_u16` and `v_cvt_f16_i16` from `src_f16`, matching `recomp/emit.rs`, and add a GPU parity test against HLSL. From #1870 (merge 5fc135a). Taken as is. (cherry picked from commit 5fc135a) Assisted-by: Antigravity (Gemini 4 Neon) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`image_store` with D16 unpacked each 16-bit half with `& 0xFFFF` and passed it unchanged to the `RWTexture<int4>` store for SINT formats, so a negative half such as -1 (0xFFFF) became 65535 and the R16 SINT store clamped it to 32767. Sign-extend the half when the T# format class is SINT, as the D16 `buffer_store_format_*` path in `lower_mem.rs` already does. From #1920 (merge a7dac48). It conflicted when applied alone to the stack; on top of the #1870 port it applies without changes. (cherry picked from commit a7dac48) Assisted-by: Antigravity (Gemini 4 Neon, Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nts as f32 Direct DXIL: decode inline float constants as f32 for `v_cvt_f16_u16` and `v_cvt_f16_i16` (1506f4b): `Lw::valu16` passed `name.contains("f16")` as `src_f16` to `self.sources()`, decoding inline float constants (`240..=248`) as f16 bit patterns for `v_cvt_f16_u16` and `v_cvt_f16_i16`. Both instructions take a 16-bit integer source (not f16), so inline constants decode as f32 bit patterns per the RDNA2 ISA and `emit.rs` (e.g. `v_cvt_f16_u16 v0, 1.0` produced `0x7380` instead of `0x0000`). Exclude `v_cvt_f16_u16` and `v_cvt_f16_i16` from `src_f16`, matching `recomp/emit.rs`, and add a GPU parity test against HLSL. From #1870 (merge 5fc135a). Taken as is. (cherry picked from commit 5fc135a) Assisted-by: Antigravity (Gemini 4 Neon)
`image_store` with D16 unpacked each 16-bit half with `& 0xFFFF` and passed it unchanged to the `RWTexture<int4>` store for SINT formats, so a negative half such as -1 (0xFFFF) became 65535 and the R16 SINT store clamped it to 32767. Sign-extend the half when the T# format class is SINT, as the D16 `buffer_store_format_*` path in `lower_mem.rs` already does. From #1920 (merge a7dac48). It conflicted when applied alone to the stack; on top of the #1870 port it applies without changes. (cherry picked from commit a7dac48) Assisted-by: Antigravity (Gemini 4 Neon, Claude Opus 5.5)
Lw::valu16passedname.contains("f16")assrc_f16toself.sources(), which decoded inline float constants (240..=248) as f16 bit patterns forv_cvt_f16_u16andv_cvt_f16_i16. Both instructions take a 16-bit integer source (not f16), so inline constants decode as f32 bit patterns per the RDNA2 ISA andrecomp/emit.rs(for example,v_cvt_f16_u16 v0, 1.0wrote0x7380instead of0x0000).Lw::valu16now excludesv_cvt_f16_u16andv_cvt_f16_i16fromsrc_f16, matchingrecomp/emit.rs.What is in it
crates/xcl/src/gpu/dxil/lower_wide.rs: setsrc_f16 = name.contains("f16") && !matches!(name, "v_cvt_f16_u16" | "v_cvt_f16_i16")inLw::valu16.crates/xcl/src/gpu/dxil/core_tests.rs: GPU parity testv_cvt_f16_int_decodes_inline_float_constants_as_f32against HLSL (SRC0 = 242,243,248).Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on 1506f4b (rebased ontomain2aa2d1a): 1136 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpu;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record)gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) fail identically on unmodifiedmain2aa2d1aon this GPU (seeds 722 and 1599).v_cvt_f16_int_decodes_inline_float_constants_as_f32before the change failed (v0: 0x7380 vs 0x0); passes and matches HLSL afterRegression run
main:
this PR:
Not tested
AI use
main2aa2d1a(a conflict incrates/xcl/src/gpu/dxil/core_tests.rs; both tests kept, this PR's now besideps_get_lod_with_a_static_sampler) and reran the suite and smoke runs above.