perf(gpu/hwrt): GPU decode_quant24_vb compute shader in SANITIZE_HLSL (Wave 12A) #432
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/432"
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T10:52:27Z.
Summary
Moves console 24-24-16 quantized 3D position vertex buffer decoding (
TITLE_QUANT24_VFMT) from the CPU staging loop into a GPU compute shader (decode_quant24_vb) insideSANITIZE_HLSL, reading GPU-resident shadow VBs directly into BLASworkUAV buffers while retaining the CPU decoder as a fail-closed fallback.Changes
crates/victory-gpu/src/hwrt/sanitize.rs:decode_quant24_vbcompute entry point (cs_5_1,[numthreads(64, 1, 1)]) toSANITIZE_HLSLwith its own 10-dword root signature (RS_QUANT24atb1, leavingclamp_ib/copy_vbroot signatureRSuntouched).ByteAddressBuffer::Load2, applies fusedmad(scale, (float)q, bias)across all swizzle modes (0 => [c, b, a],1 => [b, c, a], default[a, b, c]), and scrubs non-finite /|x| > 1e10(0x501502F9u) coordinates to quiet NaN (0x7FC00000u) directly into theR32G32B32_FLOATUAV buffer.quant24_root_paramsandquant24_shadow_eligiblehelpers enforcing 4-byte VA/stride alignment and full[vb_va, vb_va + vbytes)shadow coverage.crates/victory-gpu/src/hwrt/decoders.rs:Quant24Header,read_quant24_header, anddecode_title_quant24_vb_with_headerso CPU header reading/finiteness validation is shared once between the GPU path and CPU fallback.crates/victory-gpu/src/hwrt.rs:decode_quant24_vbroot signature & compute PSO inHwRtManager::newalongsideclamp_ib/copy_vb.HwRtManager::decode_quant24chunked viasanitize_chunks, callingShadow::refreshandlist.keep(&sh.buffer), writing directly intowork(synchronized byflush_blas_batchUAV -> NON_PIXEL_SHADER_RESOURCE+ UAV barrier beforeBuildRaytracingAccelerationStructure, then restoredNON_PIXEL_SHADER_RESOURCE -> UAV).decode_title_quant24_vb_with_headerwhenever the VB is not shadow-backed, unaligned, out of shadow bounds, orworklease allocation fails.STATS[16]) alongside total quant24 decodes (STATS[8]).Verification
cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- hwrt: 58 passed, 0 failedcs_5_1compile checks for all 3SANITIZE_HLSLentry points, header validation tests, shadow eligibility boundary tests, root constant packing tests, anddecode_quant24_vb_gpu_shader_matches_cpu_decoder_bit_exactverifying bit-exact GPU vs CPU output across all swizzle modes, strides, non-16-bytesrc_biasoffsets,1e10/Inf scrubbing, and 131-vertex multi-group dispatch with trailing sentinel protection under the D3D12 debug layer.cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings: clean (0 warnings)cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: clean (0 warnings)cargo +1.98.1-x86_64-pc-windows-gnu xtask policy:asset policy: 368 files okImported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-04T11:01:39Z.
Triage (
5c16e97c, CIcheckPASS,MERGEABLE):decode_quant24_vbcompute shader (+766/-57acrosshwrt.rs,hwrt/decoders.rs,hwrt/sanitize.rs, zero new env toggles) movingTITLE_QUANT24_VFMTdecoding from CPU staging onto the GPU with fail-closed CPU fallback.triage: needs gpu test— awaiting Gate 2 Audit (#282) + Gate 3VICTORY_HW_RT=1GPU verification.