[RFC] Zero-Copy GPU Compute BCPack Offload (HLSL SM 6.6 Wave32, 11.33 GB/s) + 1.25M Descriptor Paging (MIT/Apache-2.0) #2442

Open
opened 2026-11-25 19:28:08 +00:00 by POMXARK · 0 comments
POMXARK commented 2026-11-25 19:28:08 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by POMXARK on 2026-11-25T19:28:08Z.


Hi team,

Great work getting CPU hle::bcpack landing in #905 — to help offload IDStorageQueueX / BCPack texture decompression and Gfx10 detiling onto Async Compute (avoiding CPU bottlenecks & unpacked PCIe transfers) as well as NVIDIA's ~1M shader-visible descriptor heap limit (E_OUTOFMEMORY), I built a 100% clean-room, MIT OR Apache-2.0 licensed DX12 HLSL SM 6.6 + Rust implementation:

Highlights (Verified 19/19 PASS on NVIDIA RTX 5080, DX12 Debug Layer Clean — 0 errors)

  • Zero-Barrier Wave32 Multi-Lane rANS (shaders/bcpack_decode.hlsl, shaders/bcpack_bc7_rans.hlsl):
    • Dual-chunk Wave32 packing (24/32 lanes BC1, 32/32 = 100% Wave32 BC7 rANS) keeping the 64B stream window in registers via WaveReadLaneAt (0 shared-memory barriers inside the hot loop) and explicit WaveActiveBallot + countbits workaround for the DXC 1.8 -O3 prefix-count miscompile.
    • Reaches 11,327.6 MB/s (11.33 GB/s — 282.1× vs 1T CPU) on BC1 and 6,024.0 MB/s equiv (247.1× vs 1T CPU) on 16-lane BC7 rANS (0 byte/symbol mismatches vs Ahmet-Dedeler/bcpack-rs).
  • Fused AMD Gfx10 Swizzle -> Linear Detile (shaders/gfx10_detile.hlsl):
    • Inline Async Compute pass for SW_64KB_D (8B/16B) and SW_4KB_S (8B) at 432.6 GB/s (0.144 ms / 64 MiB).
  • 1.25M Virtual ResourceDescriptorHeap[] Paging (src/descriptor_paging.rs, shaders/bindless_paging.hlsl):
    • Maps 1,250,000 virtual resource IDs onto 262,144 physical Tier-3 slots via CopyDescriptorsSimple in 0.064 ms (65,536 verified readbacks, 0 mismatches).
  • Zero-Copy Shared-Device & Direct 2D Texture C-ABI (include/bcpack_gpu.h, src/ffi.rs):
    • bcpack_gpu_create_from_device shares XCL's ID3D12Device*, BcPackDecodeToBuffer / BcPackDecodeToTexture2D decode + Gfx10-detile directly into caller GPU resources (with automatic 256B RowPitch padding on small mips), and sync via GPU Queue::Wait with zero CPU readback.

Happy to adapt the shaders, Rust modules, or descriptor layout if XCL would like an optional GPU BCPack offload path!

<!-- greyfinch-sync:ivall/xcl:issue:6612069076 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2452). Originally posted by [POMXARK](https://github.com/POMXARK) on 2026-11-25T19:28:08Z. --- Hi team, Great work getting CPU `hle::bcpack` landing in `#905` — to help offload `IDStorageQueueX` / BCPack texture decompression and Gfx10 detiling onto Async Compute (avoiding CPU bottlenecks & unpacked PCIe transfers) as well as NVIDIA's ~1M `shader-visible` descriptor heap limit (`E_OUTOFMEMORY`), I built a **100% clean-room, `MIT OR Apache-2.0` licensed DX12 HLSL SM 6.6 + Rust implementation**: - **Repository:** https://github.com/POMXARK/bcpack-gpu-hlsl - **Prebuilt Release (`v0.10.0`):** https://github.com/POMXARK/bcpack-gpu-hlsl/releases/tag/v0.10.0 (`bcpack-gpu-sdk-v0.10.0-win64.zip`: `bcpack_gpu.dll`, `include/bcpack_gpu.h`, `.dxil` + `.spv`) - **AI / Systems Architecture Reference:** [`docs/AI_ARCHITECTURE.md`](https://github.com/POMXARK/bcpack-gpu-hlsl/blob/main/docs/AI_ARCHITECTURE.md) ### Highlights (Verified `19/19 PASS` on NVIDIA RTX 5080, DX12 Debug Layer Clean — 0 errors) - **Zero-Barrier Wave32 Multi-Lane rANS (`shaders/bcpack_decode.hlsl`, `shaders/bcpack_bc7_rans.hlsl`):** - Dual-chunk Wave32 packing (`24/32` lanes BC1, `32/32 = 100%` Wave32 BC7 rANS) keeping the 64B stream window in registers via `WaveReadLaneAt` (**0 shared-memory barriers inside the hot loop**) and explicit `WaveActiveBallot` + `countbits` workaround for the DXC 1.8 `-O3` prefix-count miscompile. - Reaches **11,327.6 MB/s (11.33 GB/s — 282.1× vs 1T CPU)** on BC1 and **6,024.0 MB/s equiv (247.1× vs 1T CPU)** on 16-lane BC7 rANS (`0` byte/symbol mismatches vs `Ahmet-Dedeler/bcpack-rs`). - **Fused AMD Gfx10 Swizzle -> Linear Detile (`shaders/gfx10_detile.hlsl`):** - Inline Async Compute pass for `SW_64KB_D` (8B/16B) and `SW_4KB_S` (8B) at **432.6 GB/s** (`0.144 ms` / `64 MiB`). - **1.25M Virtual `ResourceDescriptorHeap[]` Paging (`src/descriptor_paging.rs`, `shaders/bindless_paging.hlsl`):** - Maps `1,250,000` virtual resource IDs onto `262,144` physical Tier-3 slots via `CopyDescriptorsSimple` in **`0.064 ms`** (`65,536` verified readbacks, `0` mismatches). - **Zero-Copy Shared-Device & Direct 2D Texture C-ABI (`include/bcpack_gpu.h`, `src/ffi.rs`):** - `bcpack_gpu_create_from_device` shares XCL's `ID3D12Device*`, `BcPackDecodeToBuffer` / `BcPackDecodeToTexture2D` decode + Gfx10-detile directly into caller GPU resources (with automatic 256B RowPitch padding on small mips), and sync via GPU `Queue::Wait` with zero CPU readback. Happy to adapt the shaders, Rust modules, or descriptor layout if XCL would like an optional GPU BCPack offload path!
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#2442
No description provided.