Repository navigation
NVIDIA D3D12 fixes & shader translation improvements (dynamic descriptors, Wave32 compute, untracked masks) - #1845
Conversation
…iptor_data When a wide `s_load_dword*` loads multiple adjacent descriptors or a descriptor used by `s_buffer_load_dword*`, `descriptor_data()` previously inspected only the first `Role::Resource` match and rejected `Fields::Smem` uses with "a scalar memory read as data". Group descriptor uses per `first` dword offset, prefer Image/Buffer over Smem when a slice is shared, reconstruct buffer record counts via `dx.op.getDimensions` for `Fields::Smem` SRV/UAV slices (using RawBuffer or StructuredBuffer properties matching `stride`), and isolate unsupported or CBV slice errors so sibling slices remain usable. Add unit tests covering `s_buffer_load_dword` SRV size reads and wide `s_load_dwordx8` loads mixing CBV and SRV descriptors, validated with `IDxcValidator`.
…data In `descriptor_data()`, buffer descriptors previously only populated dword 2 (`num_records`), and array image descriptors omitted dword 5 (`BASE_ARRAY`), leaving both to fail with a generic "a descriptor's address or format read as data" error. - Add `only_high_bits_read()` to verify that every non-descriptor read of a buffer's dword 1 discards bits `[15:0]` (`base_address_hi`). When true for raw or structured buffers, emit `(stride & 0x3FFF) << 16` using the compile-time buffer stride (`props.1` for structured buffers, `0` for raw) so no GPU virtual address bit is ever fabricated. - Populate image dword 5 (`BASE_ARRAY = 0`) for 1DArray and 2DArray views, matching the existing `base_level = 0` host-view invariant. - Split remaining unmodeled descriptor dword errors into base address, format/metadata, and unused wide-load slot diagnostics. Add unit tests covering stride extraction via `s_bfe_u32`/`s_lshr_b32`, rejection of low-bit address reads, format/metadata reporting, and 2DArray `BASE_ARRAY` queries, validated with `IDxcValidator`.
…e table prefixes On NVIDIA GPUs, D3D12 caps shader-visible view heaps at `PORTABLE_VIEWS` (1,000,000), which previously fell back to `MIN_DYNAMIC` (65,536) dynamic slots — running dry seconds into the world and dropping thousands of draws. In addition, `draw::State::tables()` keyed `fresh_tables` by `(table, hash)` of the exact entry count `n`, causing stages or draws binding a shorter prefix of the same unchanged table to allocate duplicate dynamic copies. - Add `capped_split()` in `descriptor/host.rs` so capped view heaps keep full `DYNAMIC` (262,144) headroom (`737,856` static + `262,144` dynamic for a 1,245,184-view title heap) while preserving all title slots when `MIN_DYNAMIC` still fits, and log `static_slots`/`dynamic_slots`. - Replace `fresh_tables` hashing in `draw.rs` with `FreshTables`, matching copied `[u32; 3]` descriptor records by exact prefix so stages and draws reusing an unchanged prefix share the same dynamic slots. - Add unit tests for `capped_split` and `FreshTables`.
On NVIDIA GPUs (`WaveLaneCountMax = 32`), D3D12 rejected every compute pipeline declaring `WaveSize(64)` with `E_INVALIDARG` even when the shader only used wave-size-agnostic HLSL wave operations or single-wave LDS without `s_barrier`. - Query `D3D12_FEATURE_D3D12_OPTIONS1` (`WaveLaneCountMin`/`Max`) in `victory-gpu::host` and expose `max_wave_size()`. - Include `max_wave` in `shader_cache`'s BLAKE3 build fingerprint so 32-lane and 64-lane GPUs never share disk cache entries, and pass it through `translate_for_wave()` / `emit_for_wave()`. - In `victory-shader::emit::lower`, when a compute shader's console wave size exceeds `max_wave`, omit `WaveSize(64)`, switch `mask_data` to `MaskData::Host` (supporting whole-wave reductions/prefixes and wave-size-agnostic ballot ops), return a clean error in `cross_lane()` for genuinely wave64-dependent instructions, and insert deadlock-free group barriers (`sync_lds`) between conflicting LDS accesses in uniformly reached blocks when a single 64-thread console wave splits across two 32-lane host warps. - Add unit tests for `sync_lds`, `MaskData::Host` compute ballots, wave64 cross-lane refusal (all validated with `IDxcValidator`), and cache key isolation.
…d phis - Track non-EXEC-derived lane masks (s_cselect, constants, scalar logic, and split 32-bit Wave64 halves) in `Structured::other_masks` via `Structured::select_mask()`, keeping `masks` untouched for scalar ops - Resolve back-edge `Atom::Phi` mask arguments during `Lanes::finish()` - Handle `NULL` and inline `0`/`-1` constants in `v_cndmask_b32` and `v_*_co_ci_u32`, and use `select_mask()` in `pending_masks` - Add Wave32 and Wave64 unit tests validated with `IDxcValidator`
|
For the reviewers, where this stack (5 commits on
Splitting it along those lines would let each part be compared with the PR it overlaps. AI-assisted (Claude Code). |
catminou4
left a comment
There was a problem hiding this comment.
Mixed PR: victory-shader part is macOS-testable (in batch), victory-gpu part is Windows-only. Static review of the GPU half; shader half tested separately.
NVIDIA D3D12 fixes & shader translation improvements (dynamic descriptors…): gpu+shader bundle — review the shader half via its macOS tests if the batch reaches it; GPU half Windows-only. Flagging as a mixed PR.
|
Tested This branch is based on
All 14 tests this PR adds pass on this card. Among them are What this can't show: 4 of #1744's 5 NVIDIA failures on |
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
This PR bundles 5 clean-room fixes targeting NVIDIA D3D12 compatibility and GFX10-to-DXIL shader translation:
victory-shader: SMEM buffer descriptors & multi-slice loadsdescriptor_data.victory-shader: descriptor format & stride reconstructionstride(d1) andBASE_ARRAY(d5) metadata for descriptor loads (+5 shaders translated).victory-gpu: NVIDIA dynamic descriptor budget &FreshTablesFreshTables, eliminating dropped draws (8,192+ dropped draws → 0).victory-shader,victory-gpu: Wave64 → Wave32 compute loweringvictory-shader: uniform and constant lane masks in selects and phiss_cselect, constants, scalar logic, split 32-bit Wave64 halves) inStructured::other_masks, resolve back-edgeAtom::Phimask arguments, and handleNULL/inline constants inv_cndmask_b32andv_*_co_ci_u32(75 previously failing shaders now translate).Validation
cargo test), including new Wave32/Wave64 unit tests validated withIDxcValidator.VICTORY_D3D12_DRED=1andVICTORY_GPU_TIMING=1(0 host pipeline refusals, 0 untracked mask errors).Fully done by AI ( Gemini Neon)