Repository navigation
Conversation
Console compute programs are wave64, and the compute path always emitted [WaveSize(64)]. On an adapter without 64-lane waves (NVIDIA) the driver refuses that pipeline (E_INVALIDARG), so every translated console compute shader failed there and its dispatches were skipped. On such an adapter a wave64 compute program now runs as two native wave32 halves, the same split mesh programs use (xcl_half, xcl_logical_wave64); a program that needs both halves at once (whole- wave masks, cross-lane exchange, …) is refused with the same hazard check. Adapters with wave64 are unchanged.
|
Validated on native Windows 11 (not Wine/vkd3d-proton): RTX 4060 (Ada, lane range 32..32), MSVC, DXC 1.8.2502.11 from SDK 10.0.26100.
No TDR, no device removal. Nothing from a game package was used. AI-assisted. |
…pute e2e through the PSO hook (not for merge)
|
Verified
|
|
Heads-up for the reviewer and @gefydev: #67 solves the same problem (wave64 programs on 32-lane GPUs) another way, and it conflicts with this PR and with #71 / #72. The difference: #67 also runs programs whose halves must exchange values (through groupshared), which this PR still refuses. I ran both on the same RTX 5070 Ti, merged onto current |
|
Thanks – closing this as superseded by #67 (merged), which runs wave64 compute (and mesh / ES+GS) as two wave32 halves that exchange masks and lane values through groupshared, so programs with cross-half semantics run too instead of being refused. Your |
Since #117 translated shaders declare every cube T# as a TextureCubeArray, but dev_create_srv_x forwarded a title's own SRV description unchanged: a D3D12_SRV_DIMENSION_TEXTURECUBE view was bound to a shader that declares a cube array, a dimension mismatch D3D12 leaves undefined (the risk noted on #117). It now becomes TEXTURECUBEARRAY { First2DArrayFace 0, NumCubes 1 } with the view's mips and LOD clamp; format, mapping and every other view dimension are forwarded as before. Device #70 (views of memory) goes through the same path. Test srv_tests::a_cube_view_becomes_the_cube_array_of_one_cube. Co-Authored-By: Claude Code <[email protected]>
…cl-dev#248) Stacked on xcl-dev#269 (which moves 64 KiB-aligned kept-in-step title textures onto shared 64 KiB pages in vram::Book). What remains after xcl-dev#269: - Overwritten placements stayed registered in title_textures forever, continuing to be scanned/uploaded and holding extra tiles / leftover pages in vram::Book even when a newer texture replaced their memory. - real::resource_at (device xcl-dev#70/xcl-dev#71 by-address SRV/UAV creation) stored every created ID3D12Resource in MADE forever and never released superseded entries (including unaligned committed textures). - Device / queue release did not clear MADE, title_textures state, upload queues, or vram::Pages::waited. - XCL_ACTIVITY memory lines lacked title-texture active/covered/retired/ released counters. This commit adds O(log N + k) overlap retirement in title_textures, detaches retired entries from vram::Book, cools and releases superseded entries in real::resource_at (2 s cooling + MADE_MAX cap), cleans up on device/queue release, and logs title-texture counters on XCL_ACTIVITY. Assisted-by: Antigravity CLI (Gemini 4 Neon)
The null device becomes `win::d3d12x`, a device that does the memory side of D3D12.X for real and still renders nothing: - Unified memory, as on the console: a resource's GPU address is its address in the title's address space. Committed resources and heaps get graphics memory, placed resources lie in their heap, and CreatePlacedResourceX (xcl-dev#44) puts one on memory the title allocated; Map returns that address. Read-back buffers up to 64 MiB come from the fourth 4 GiB of the region, where XCL's Windows runtime keeps them. - Command lists record; a queue runs what it is given, in order, at every turn of the scheduler (`pump`): buffer copies, the console's memory commands (CopyMemoryToMemoryX xcl-dev#60, FillMemoryWith32BitValueX xcl-dev#61, Write32 / 64BitValue…X xcl-dev#69 / xcl-dev#70 / xcl-dev#89 with the GPU timestamp) and Wait32 / 64BitValueX (xcl-dev#71 / xcl-dev#72), which hold the queue until another thread writes the value. KickoffX (xcl-dev#93) starts a list before it is closed. A fence moves, and its events are signalled, when the queue gets to its Signal. - The console's layouts: device extensions from slot 44 (CreateCommandQueueX, CreateCommandListX with the DMA engine's own list interface, page pools, pipeline-state creation as objects, …), the graphics command list's console slots, AllocateUploadMemory (xcl-dev#148). - CheckFeatureSupport zeroes the whole structure; a raytracing acceleration structure view writes the console's descriptor words. Draws, pipelines, other views, PresentX and the frame clock do nothing or are missing. Dev builds optimise `xcl-emu` (the title test: 37 s → 3.3 s). Measured on macOS (aarch64): the test title passes 40 of its checks (9 of D3D12.X's 16); the 6 that fail before it aborts in its XG texture check need HLSL compilation and rendering, the frame clock, or DirectStorage. `cargo test -p xcl-guest`: 38 passed, 0 failed (the title test now checks every check by name; the staged tree was built and tested apart from the working tree). Inside the wasm64 module (1.2 MB, Node 24) the same run takes 4.4 s: 115 M instructions, most of them the 80 MiB upload check. Co-Authored-By: Claude Fable 5.2 <[email protected]>
A retail title gives the GPU only addresses in a GPU view of its memory (PAGE_NOACCESS on the CPU; with the 16-window layout it lies in the view windows). The device's views and placed buffers took such an address as memory nobody has: a constant buffer view was left empty, a buffer placed there became a committed resource of its own that stayed zero (so its GPU address, the buffer views of it, indirect arguments, copies and vertex buffers read zeros), and a view made by address carried the address but never asked for the tiles behind it, so the shader read zeros there too. Each now asks for the tiles of exactly the range it covers (view_want::want): views by address (device xcl-dev#70 / xcl-dev#71, the range buffer_words_at computes), constant buffer views, views of buffer resources, the acceleration-structure view (from the root on; its size is not known) and a Map read of a buffer in the view. A constant buffer view and an acceleration-structure view in a view window carry the address. A buffer placed in a GPU view goes over the view window's tiles through sparse::place_buffer, as one in a sparse window does, and may run on into the next view windows; when that is refused it is a resource of its own as before, logged once. A Map read of such a buffer reads back what the GPU wrote into its CPU view, and its release does not wait as one over CPU pages does. Without the 16-window layout no address is in a view window and nothing changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
resource_at keys the resources it makes for views by address (device xcl-dev#70, xcl-dev#71) by (address, 0x38-byte resource desc) and cleared only 0x34.. of it. Bytes 0x04..0x08 are the padding between Dimension and Alignment (the same for every dimension: the desc is one D3D12_RESOURCE_DESC); the title leaves stack bytes there, so the same view at the same address made a second resource whenever they differed. view_resource_key clears both. On amd-dev's placed SRVs this was 31 % of the entries in a 200 s run. Test: a_view_by_address_ignores_the_padding_of_its_desc. Ported from amd-dev c093211 by Greem (the same fix there is in format_alias.rs prepare_placed_srv_desc / prepare_placed_uav_desc).
On NVIDIA (32-lane waves only) every translated console compute shader fails. The compute path always emits
[WaveSize(64)], since console compute programs are wave64, and the driver refuses that pipeline:translated_compute_psothen records a translation error and the title's dispatches with that pipeline are skipped. The README mentions this ("console wave64 compute … programs are mostly refused there").Mesh programs already have the fix for the same problem (#39): a logical wave64 runs as two native wave32 halves (
xcl_half,xcl_logical_wave64), andgeometry_wave32_hazardsrefuses programs that need both halves at once. This PR uses that for compute:Options::compute_wave32andtranslate_compute, the compute counterpart oftranslate_mesh: the same hazard check, with "compute program requires unsupported cross-half wave64 semantics" in the error.[WaveSize(32)], withxcl_half = (gi >> 5) & 1andlane_id = WaveGetLaneIndex() + 32 * xcl_half, as in mesh mode.numthreads, thread ids, group ids, TG_SIZE and LDS are unchanged.translated_compute_psopassesgeometry_wave32_required(this), the same adapter check console mesh pipelines use. On adapters with wave64 (RDNA) it is false and the generated HLSL is unchanged.This doesn't cover programs with cross-half semantics (DPP/swizzle reductions, whole-wave mask counts, …). Those are still refused, as for mesh. #33 is working on a groupshared rendezvous for those. This PR is the smaller step that lets everything else run.
Validation
GTX 1650 (Turing, wave32 only), Windows 11, NVIDIA driver 32.0.16.2114, MSVC debug build:
cargo test --workspacehas 0 failures, as onmainon this machine, and the three new tests ran and passed. I first worked on it on the same GPU on Linux (Wine + vkd3d-proton 2.14.1), where the results are the same.gpu_compute_wave64_as_wave32_halves: the program fromgpu_compute_mode_dispatch_abi(two wave64s per group, LDS +s_barrierbetween them) translated split. Same results as the wave64 test checks.gpu_compute_mode_dispatch_abinow shares its program and check with it.gpu_compute_wave32_halves_keep_their_exec_bits:v_cmpxkeeps lanes 0..39, so the high half has 8 live lanes. Withlane_idleft atWaveGetLaneIndex()it fails (lane 32 gives 0 instead of 33).split_compute_refuses_cross_half_semantics(no GPU):s_bcnt1_i32_b64on VCC is refused split and translates with wave64.CreateComputePipelineState: 0x80070057, i.e. whatmaindoes.cargo test -p xcl --lib: 0 failed on the GTX 1650 (41 GPU tests skipped with "no wave64", as before) and without a GPU.Not tested on RDNA: there the split tests run
[WaveSize(32)], which RDNA supports, and nothing else changes.