Repository navigation
Conversation
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Update for head The new GPU test fails on an RTX 3060 (Ampere), passes on an RX 9070 XT. On the 3060 the 16-bit result is right but the destination's upper half is overwritten instead of kept. Head
The failure ( So the low half Whole Not tested: other ops / lanes past the first failing assertion on the 3060, other NVIDIA generations. |
Part of xcl-dev#1401 Part of xcl-dev#1833 Lower 16-bit integer `CLAMP=1` saturation in `Lw::valu16` (`crates/xcl/src/gpu/dxil/lower_wide.rs`): - When `m.clamp` is set on 16-bit integer `valu16` ops (`v_add_nc_u16`, `v_add_u16`, `v_sub_nc_u16`, `v_sub_u16`, `v_subrev_nc_u16`, `v_subrev_u16`, `v_mad_u16`, `v_add_nc_i16`, `v_sub_nc_i16`, `v_mad_i16`), compute the untruncated 32-bit integer result (zero `Int64Ops` needed: max unsigned `0xFFFF * 0xFFFF + 0xFFFF = 0xFFFF_0000` fits in `u32`, and signed `[-1_073_741_824, 1_073_774_591]` fits in `i32`) and saturate to `[0, 0xFFFF]` or `[-32768, 32767]` before `OP_SEL` / SDWA writeback. - For signed ops (`v_add_nc_i16`, `v_sub_nc_i16`, `v_mad_i16`), mask `low = t & 0xFFFF` before selecting `0x7FFF` / `0x8000` via `icmp sgt` / `icmp slt` instead of `IMax(IMin(t, 0x7FFF), -32768) & 0xFFFF`, avoiding an NVIDIA Ampere driver miscompilation that drops the post-clamp `& 0xFFFF` mask and leaks `0xFFFF` into the preserved upper 16 bits on negative results. - Add pure-CPU DXIL validation/disassembly test verifying `0` `Int64Ops`, clamp emission iff `CLAMP=1`, and no `IMax`/`IMin` on the signed clamp path, plus a `wave32_supported()`-guarded GPU test checking overflow, underflow, boundary values, and `OP_SEL` half preservation across all six RDNA2 VOP3 16-bit integer ops (`CLAMP=0` and `CLAMP=1`). Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Thanks for testing on Ampere Looking closely at the failing case ( Updated the branch to
If you have a moment to re-run |
b9efbd9 to
e9d7aef
Compare
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Part of #1401
Part of #1833
What is in it
Implement RDNA2
CLAMP=116-bit integer saturation in Direct DXILLw::valu16(crates/xcl/src/gpu/dxil/lower_wide.rs):m.clamp):v_add_nc_u16,v_add_u16, andv_mad_u16compute the exact 32-bit unsigned sum/product-sum (0xFFFF * 0xFFFF + 0xFFFF = 0xFFFF_0000, nou32overflow and zeroInt64Ops) and saturate withumin(t, 0xFFFF).v_sub_nc_u16,v_sub_u16,v_subrev_nc_u16, andv_subrev_u16saturate underflow to0viaselc(cmp(ULt, lhs, rhs), 0, lhs - rhs).m.clamp):v_add_nc_i16,v_sub_nc_i16, andv_mad_i16sign-extend 16-bit inputs toi32(si(self, i)), compute the exact 32-bit signed result ([-1_073_741_824, 1_073_774_591], noi32overflow and zeroInt64Ops), masklow = t & 0xFFFFupfront, and select0x7FFF/0x8000viaicmp sgt i32 %t, 32767/icmp slt i32 %t, -32768, preservingOP_SELhigh-half merging and SDWA writeback.and 0xFFFF+icmp sgt/slt+selectinstead ofIMax(IMin(t, 0x7FFF), -32768) & 0xFFFFavoids an NVIDIA Ampere driver miscompilation reported by@DarkPanda69(RTX 3060 driver32.0.16.1088), where the driver dropped& 0xFFFFafterIMax(IMin(...))on negative results (-2 = 0xFFFF_FFFE), clobbering the preserved upper 16 bits (0xBEEF_0000 | 0xFFFF_FFFE -> 0xFFFF_FFFE).valu16_clamp_tests):valu16_int_clamp_emits_32bit_saturation_without_i64: pure-CPU DXC 1.9 validation and disassembly test confirming0Int64Ops/i64ops in@main, thatUMin(op 40),icmp ult i32,icmp sgt i32, andicmp slt i32are emitted iffCLAMP=1, and thatIMax/IMin(ops 37/38) are not emitted on the signed clamp path.gpu_valu16_int_clamp_matches_reference:wave32_supported()-guarded GPU execution test across 8 overflow/underflow/boundary lanes covering all six RDNA2 VOP3 16-bit integer ops (V_ADD_NC_U16,V_SUB_NC_U16,V_ADD_NC_I16,V_SUB_NC_I16,V_MAD_U16,V_MAD_I16) withCLAMP=0,CLAMP=1, andOP_SEL=0b1011high-half/low-half preservation.(Rebased onto
origin/mainbe67bfcf.)Tested
cargo test -p xcl --lib gpu::dxil::lower_wide::valu16_clamp_tests::valu16_int_clamp_emits_32bit_saturation_without_i64 -- --exact --nocaptureon68a284a5):0 passed, 1 failed(CLAMP=1 must emit @dx.op.binary.i32(i32 40,).cargo test --release -p xcl --lib gpu::dxil::lower_wide::valu16_clamp_tests -- --test-threads=1 --nocaptureon NVIDIA GeForce RTX 4060 (driver621.14, DXC1.9.2609.5):2 passed, 0 failed, 0 ignored(0.46 s,0skipped).XCL_ADAPTER="Microsoft Basic Render Driver"cargo test --release -p xcl --lib gpu::dxil::lower_wide::valu16_clamp_tests -- --test-threads=1 --nocapture:2 passed, 0 failed, 0 ignored(0.05 s; pure-CPU/DXC 1.9 test ran with0skips, GPU test cleanlySKIPPED).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocaptureon RTX 4060):24test binaries,1318 passed, 4 failed, 46 ignored— all170/170gpu::dxil::*tests passed (0failures); the 4 failures areorigin/mainbe67bfcf's pre-existing#2074test (a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, tracked by Tests: the bridged mask write checks for no barrier past the first branch #2379) plus 3 unrelated parallel#1978title_textures/vramglobal-mutex flakes (placed_title_textures_share_vram_and_preserve_pixelspoisoningtransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory);29pre-existing hardware/debug-layerSKIPPEDlines (0invalu16_clamp_tests).Regression run
Base (
origin/mainbe67bfcfe8143e21a62bbfd5d279d292229e27f9):PR head (
e9d7aefc3a18bc5223790a9d928b1574bc1198c9):Not tested
621.14, where both the original and updated lowering pass; re-verification on Ampere driver32.0.16.1088is welcome).d3d12SDKLayers.dllis not installed on this host).AI use
Google Antigravity (Gemini 4 Neon) assisted with implementing 32-bit saturating integer
CLAMP=1lowering inLw::valu16, switching the signed clamp to Ampere-safeicmp sgt/slt+ pre-maskedselect, adding DXIL disassembly and GPU execution tests, and running the verification suite.