Repository navigation
Direct DXIL: sign-extend D16 image_store halves for SINT textures - #1920
emirduran707 wants to merge 1 commit into
Conversation
|
NVIDIA counterpart to the Radeon run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, AI-assisted (Claude Code). Synthetic tests only. |
towiice
left a comment
There was a problem hiding this comment.
Verified on Windows 11 (NVIDIA GeForce GTX 1650 SUPER, 4 GB Turing TU116, wave32, driver 610.88, DXC 1.9.2609.5):
- \cargo test -p xcl --lib gpu_direct_image_store_d16_sint_sign_extends: 1 passed; 0 failed (0.58s; DXIL translation and \dxil.dll\ validation succeeded, GPU execution skipped with
o wave64\ on Turing)
Sign-extending \hp\ via \self.sx16(hp)\ when \cls == 2\ (SINT) in \Lw::image_store\ matches the \D16\ \�uffer_store_format_*\ handling in \lower_mem.rs.
towiice
left a comment
There was a problem hiding this comment.
Verified on Windows 11 (NVIDIA GeForce GTX 1650 SUPER, 4 GB Turing TU116, 32-lane waves, driver 610.88, DXC 1.9.2609.5, Rust 1.100.0 gnullvm, debug):
cargo test -p xcl --lib gpu_direct_image_store_d16_sint_sign_extends: 1 passed, 0 failed (0.58 s). NoSKIPPEDline was printed, so the GPU part ran here as well as the translation and validation.
Not tested: the test on main without the fix (to see it fail), the rest of the suite, AMD/Intel.
AI use: an AI assistant (Antigravity) ran the test and drafted this; the result is from that run.
|
Both AMD and NVIDIA verification look good on |
c56f06d to
5f0e965
Compare
|
|
`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. Assisted-by: Antigravity (Gemini 4 Neon, Claude Opus 5.5)
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
5f0e965 to
a1e0ee8
Compare
TestedI ran Intel Arc A770 driver $env:RUSTUP_TOOLCHAIN = 'stable-x86_64-pc-windows-msvc'
$env:CARGO_BUILD_JOBS = '2'
$env:CARGO_INCREMENTAL = '0'
$env:CARGO_PROFILE_DEV_DEBUG = '0'
$env:CARGO_PROFILE_TEST_DEBUG = '0'
$env:CARGO_TARGET_DIR = 'L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target'
$env:TEMP = 'L:/XclTooling/pr1920/temp'
$env:TMP = $env:TEMP
$env:XCL_ADAPTER = 'A770'
$env:XCL_DXC_DIR = 'C:/Users/ljensen/AppData/Local/XclTooling/dxc-1.9.2609/bin/x64'
cargo test -p xcl --lib --no-run --locked -j 2 --message-format=json-render-diagnostics
$env:XCL_PR1920_TEST_EXE = 'L:/XclTooling/pr1844-71f2ceb-t3-737e5ee5/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe'
$env:XCL_REQUIRE_GPU = 'wave64'
$child = @'
& 'L:/XclTooling/Invoke-ArcTest.ps1' -WaitMinutes 30 -Test { & $env:XCL_PR1920_TEST_EXE 'gpu::dxil::core_tests::gpu_direct_image_store_d16_sint_sign_extends' --exact --nocapture --test-threads=1 }
exit $LASTEXITCODE
'@
& "$PSHOME/powershell.exe" -NoProfile -ExecutionPolicy RemoteSigned -Command $childThe prebuild exited 0 outside the Arc lock. The GPU invocation acquired and released the lock and exited 0 in 1.88 s of test execution with 1 passed, 0 failed, 0 ignored, 0 skipped and 1,114 filtered out. The exact shader backend and values are verified by the fixture and its passing readback assertions. The PR was still open at the same head after the run. Seven visible comment blocks contained no comparable Arc A770 result. Not testedHLSL #1194, normalized texture loads, other signed formats and masks, a pre-fix baseline, the workspace suite, retail smoke, and other GPU vendors. AI useT3 Code / Codex ( |
# Conflicts: # crates/xcl/src/gpu/dxil/core_tests.rs
|
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 names a GPU. Tested exact head Tested
Not tested
AI use
|
In the Direct DXIL translator,
image_storewithD16=1unpacked each 16-bit half with& 0xFFFFand passed it unchanged to theRWTexture<int4>store for SINT formats. A negative half such as -1 (0xFFFF) became 65535, and the R16 SINT store clamped it to 32767. The D16buffer_store_format_*path inlower_mem.rsalready sign-extends SINT halves withsx16;image_storenow does the same when the T# format class is SINT. (#1194 makes the same change in the HLSL recompiler,recomp/emit.rs; this is the Direct DXIL path.)What is in it
crates/xcl/src/gpu/dxil/lower_image.rs: in the D16storearm, selectsx16(half)when the format class is SINT (2).crates/xcl/src/gpu/dxil/core_tests.rs: GPU testgpu_direct_image_store_d16_sint_sign_extends: lane 0 stores the halves (-1, -100, 42, -32768) to a 16_16_16_16_SINT texture with D16 and the test checks the texture contents.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on a1e0ee8 (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).gpu_direct_image_store_d16_sint_sign_extendsbefore the change failed (left: [32767, 32767, 42, 32767],right: [-1, -100, 42, -32768]); passes 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.