Direct DXIL: decode inline float constants as f32 for v_cvt_f16_u16 and v_cvt_f16_i16 #1870
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1870
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1870"
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?
@emirduran707 on GitHub · 2026-11-24 22:19 UTC · original
emirduran707:dxil-cvt-f16-int-inline-const→main· +30 −1 · 2 files · 1 commits · openLw::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=4on1506f4b(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.v_cvt_f16_u16andv_cvt_f16_i161506f4baa4`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)@frenziedcoder on GitHub · 2026-11-24 22:23 UTC · original · edited 2026-11-24 22:26 UTC
NVIDIA test report for
d0cd5aa: full suite green, its own testv_cvt_f16_int_decodes_inline_float_constants_as_f32passes, and a clean smoke pair on the retail title (1653 vs 1654 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact headd0cd5aac7a736db220f9bff4f584c27c10a19439, no local changes.cargo build --workspace && cargo test --workspace -- --test-threads=4(debug): 960 passed, 0 failed, 43 ignored; the PR's own testv_cvt_f16_int_decodes_inline_float_constants_as_f32passes. SKIPPED:gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu(no wave64),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 packed, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 compares, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 conversions, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 rounding, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 three-source, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 transcendentals, wave64: no wave64),gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu(f64, wave64: no wave64),gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer carries, wave64: no wave64),gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).test_title_draws_with_a_root_signature_under_the_debug_layerreports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.Regression run (
scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen;XCL_PSO_PRELOAD=0for both builds, because this machine's preload list holds the program of #1307)base (
1d027e5, this PR's merge base withmain):this PR:
Not tested: this code in the title: it is on the opt-in direct-DXIL path (
XCL_DIRECT_DXIL), which the smoke runs leave unset (default HLSL backend), so they show only that nothing else regressed; the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD.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.
@upipibi on GitHub · 2026-11-24 22:28 UTC · original
NVIDIA run, since the description lists it as untested: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
d0cd5aaonmain689f2db.v_cvt_f16_int_decodes_inline_float_constants_as_f32: passes, 2 of 2 runs.dxil::core_tests: 13 passed, 0 failed, 1 ignored.On the rule itself: AnyPS5's translator reads these the same way, as an independent implementation (not a hardware measurement).
v_cvt_f16_u16/v_cvt_f16_i16read their source withreadU16AsU32, the low 16 bits of the f32 inline pattern, so 1.0 gives 0. Only instructions with an f16 source go through its f16 inline table (readF16SourceBits: 1.0 →0x3c00).AI-assisted (Claude Code). Synthetic tests only.
@raylitebull on GitHub · 2026-11-25 01:08 UTC · original
Both AMD and NVIDIA verification look good on
d0cd5aa. This is currentlyDIRTYwith merge conflicts againstmain— please rebase ontomainand letBuild and test (Windows, no GPU)run cleanly so we can merge.@raylitebull on GitHub · 2026-11-25 01:36 UTC · original
Build and test (Windows, no GPU)andPR descriptionboth passed onc076305, and#1922just landed onmaintouching the same spot at the end ofcrates/xcl/src/gpu/dxil/core_tests.rs. Please rebase ontomainto clear theDIRTYconflict so we can merge.@DavidM1911 on GitHub · 2026-11-25 01:45 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@JJAutoCompare on GitHub · 2026-11-25 03:04 UTC · original
PR #1870 Arc A770 parity test
Tested
1506f4baa4e8cb24e02c1093a2062c854fbd63edbefore and after the run, verified from the public PR page andgit ls-remote origin refs/pull/1870/head. The assigned detached checkout was clean at that SHA before and after the GPU run. The five visible discussion comments contained no Arc result. The earlier RTX 5080 and RTX 3070 reports usedd0cd5aa. RTX 5080 report · RTX 3070 report26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver32.0.101.9175, Rust1.100.0(0ef1bc386,x86_64-pc-windows-msvc), Cargo1.100.0(3acc79c0c), unoptimized test profile with debug info disabled. The run logged DXC and DXIL1.9.2609.5(DXC build01b62ad4).SKIPPEDlines). The exact filter excluded 1,114 tests. The GPU command exited 0 after the test completed in 0.22 s. The wrapper logged acquisition and release of the Arc A770 mutex.cs_6_6in wave32, then compared all 32 bits of lane 0'sv0,v1, andv2across the backends.v0used unsignedV_CVT_F16_U16withSRC0=242(+1.0f32, low 16 bits0x0000).v1used signedV_CVT_F16_I16withSRC0=243(-1.0f32, low 16 bits0x0000).v2used unsignedV_CVT_F16_U16withSRC0=248(1/(2π)f32, low 16 bits0xF983). The signed opcode therefore exercised a zero integer input. The checked-in assertions compare against HLSL readback. Fixture at tested commitProcess environment used
XCL_ADAPTER=A770,XCL_DXC_DIR=$env:LOCALAPPDATA/XclTooling/dxc-1.9.2609/bin/x64,CARGO_BUILD_JOBS=2,CARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0,CARGO_TARGET_DIR=L:/XclTooling/pr1778-2e2ee55-20261125-020159/target, andTEMPandTMPset toL:/XclTooling/pr1870/temp.Prebuild outside the mutex:
GPU run in a fresh PowerShell process launched with
-NoProfile -ExecutionPolicy RemoteSigned. The prebuild's Cargo JSON identified the executable.Raw logs use the prefix
L:/XclTooling/pr1870/pr1870-1506f4b-20261125T030129487Zwith suffixes.build.jsonl,.build.stderr.log,.arc.stdout.log,.arc.stderr.log, and.arc.exitcode.log.Not tested
AI use
gpt-6.2-sol) ran the checked-in test and wrote this report from the logs and fixture.@DavidM1911 on GitHub · 2026-11-26 00:34 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.