Repository navigation
d3d12: stage title textures when their format or usage rules out host copies - #1894
ecox982745 wants to merge 35 commits into
Conversation
…red CFGs (ms_wave_info_s3 AMD LLPC crash)
cfg_structure.structure() wraps post-dominating join blocks after a diamond or loop in a ('guard', g, ...) node even when %pc == g is tautologically true on every incoming path. wave64_emulate_opt._unwrap_known_pc_guards already unwraps these guards for --wave64-emulate, which is why ms_wave_info_s3 passed on 32-wide NVIDIA GPUs while crashing with 0xC0000005 on native wave64 AMD RDNA2 Windows (driver 24.10.24, LLPC) where blk2's OpControlBarrier stayed trapped inside a conditional OpBranchConditional.
Move unwrap_known_pc_guards into tools/cfg_structure.py (reused by wave64_emulate_opt with zero duplication) and apply it in rdna2spirv.capped_tree() so both assemble() and needs_barrier_rounds() see post-dominating join blocks at top level.
SHADER-STRUCTURED-PC-UNWRAP
Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…nown_pc_guards Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…ches A conditional branch in the last basic block (no fallthrough block, so len(raw_edges[b]) == 1) emits OpSelect(%cond, tgt, len(blocks)) and can leave %pc at either tgt or cfg_structure.END. Compute exact per-block out_pcs in rdna2spirv._block_out_pcs (matching wave64_emulate_opt), pass it through capped_tree() into both cfg_structure.structure() (so single-target fall-off-the-end blocks also keep their dominated target guard) and unwrap_known_pc_guards(), and pass compact_out_pcs into cfg_structure.structure() in wave64_emulate_opt. Add unit and semantic regression tests covering both the loop back-edge repro reported in review and the non-loop dominated-target variant. Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…ng conditional branch A block with len(raw_edges[u]) == 1 ending in a conditional branch (no fallthrough block, so falling through writes %pc = len(blocks) = END) cannot safely sit inside a folded s_cbranch_execz/nz region whose exit unconditionally sets %pc = skip. Reject such blocks during the region walk in find_local_exec_folds (matching the existing ot succ[u] check) and add semantic regression tests covering both s_cbranch_scc1 X and s_cbranch_scc1 skip in structured and --dispatch-loop --wave64-emulate modes. Co-Authored-By: Gemini 4 Neon <noreply@google.com>
…x errors in pal_stages.py
… avoid duplicate index read
…efault, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing and atomic outcomes.tsv
A stage that raises outright (not through fail()) was swallowed by the run_build_stages exception handlers: the build stopped with exit 1 and an empty stderr, so a permission or copy failure gave no visible cause (board ProjectLeonida#1608 comment 7163281819). Report the stage name and the exception once per stage on stderr from the series loop, the wait handler and the final drain; fail()'s own diagnostics are unchanged and RuntimeError from its sys.exit is not re-reported. Tested: tests/test_leonida_tui.py UnexpectedStageExceptionTest (both overlap modes, fails without the fix); test_make_game_* and stage suites pass.
…scratch (RT-DEPTH-FORMAT-COPY-STAGED) A CopyTextureRegion of the depth plane from a D32_SFLOAT_S8_UINT image into a D32_SFLOAT one was replayed as vkCmdCopyImage. Vulkan requires depth/stencil formats to match exactly (VUID-vkCmdCopyImage-srcImage-01548), and the NVIDIA driver (RTX 4070 Laptop, 621.40) wrote past the end of the D32 image: the world-start WRITE_INVALID device loss, with the fault at the first byte after a 2560x1440 D32_SFLOAT image (VK_EXT_device_address_binding_report) and this VUID reported by the validation layer just before the loss. depth_format_pair: two depth formats with the same depth encoding but not the same VkFormat (D32 / D32S8, D16 / D16S8, X8_D24 / D24S8) take the image -> scratch -> image path depth <-> colour and A8 copies already use; the depth aspect has the same texel layout in a buffer on both sides. replay_copy_offset_test: the D32S8 -> D32 and D32 -> D32S8 depth-plane copies are staged (no vkCmdCopyImage, depth aspect, 4 bytes a texel), and D32 -> D32 keeps vkCmdCopyImage. Fails without the change (6 checks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Select the upload path after checking both format features and image usage. Keep required staging available for mapped linear textures and only retry host backing when the image supports it. Exercise both capability failures with synthetic GPU readback. AI-assisted-by: OpenAI Codex (gpt-6.2-astra)
…py-staged replay: copies between depth formats that differ go through transfer scratch (RT-DEPTH-FORMAT-COPY-STAGED)
…-pc-unwrap cfg_structure / rdna2spirv: unwrap tautological %pc guards in structured CFGs (ms_wave_info_s3 AMD crash, SHADER-STRUCTURED-PC-UNWRAP)
…ges-exception-diag make_game: report a stage that raises instead of failing silently (BUILD-STAGES-EXCEPTION-DIAG)
…y-typed-objects gamedata_reader: preserve empty polymorphic objects (GAMEDATA-EMPTY-TYPED-OBJECTS)
…ages-safety tools: handle corrupt XBCH zlib, case-insensitive extensions and index errors in pal_stages.py
tests: reject identical fenced blocks that are back to back in docs/ (OLD-9862)
…trol-flow-safety tools/ab_control_flow: handle UTF-8-SIG/CRLF inputs, subprocess encoding and atomic outcomes.tsv
…-probe-safety tools/int_hw_probe: write --json atomically and reject trailing-separator paths
d3d12: changed console heap slots are fixed without a time limit by default, not given to shaders as null (RT-CONSOLE-FIX-BUDGET-NULL)
…ta-sps1-atomic-json tools: make gamedata_sps1.py --json writes atomic, validate paths and avoid duplicate index read
…-qtable-atomic-json tools: make script_qtable.py --json writes atomic and validate paths and hex stems
|
Test report from a combined build on a second NVIDIA machine. Counts only. Machine: Windows 11, RTX 4070 SUPER, NVIDIA 621.01, 64 GB, own 1.0.2.1 copy. Build: Shaders: translated on Pipeline cache: warm and complete, 26,503 of 26,503 (9.6 GB).
Recipe:
AI-assisted (Claude Code). |
…copies too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Updated for I tested this PR ( For whoever rebases the second PR, the resolution I tested was to keep #1894's side of the conflicting hunk and replace This keeps #2020's shared zero image eligible for a later staged upload when host image copies are disabled. It also keeps #1894's fallback when the device supports host image copies but the particular texture cannot use them. The rest of the source merged automatically. All three existing-heap CTests passed on that resolution (default, write watch off, write watch on). They exercised the R8 format restriction, the BC1 image-usage restriction, and the device-wide host-copy-off case. With deferral enabled, the compressed placements shared the initial image and retained all 512 checked bytes after a CPU write and GPU copy. With |
|
Ran this on a GPU where the driver itself takes host image copy for the format but gives the HOST_TRANSFER image no memory type: Windows 10 Pro 19045, GeForce GTX 1050 Ti (Pascal, 4 GB, no Resizable BAR), NVIDIA 582.66, MSVC RelWithDebInfo. Base main Result is the same on both sides: The PR's own masked-R8 device and the This predates the PR, but the PR is the natural place for it: treat "HOST_TRANSFER leaves no memory type" like "the format refuses host transfer". For example, when AI-assisted (Claude Code). |
Check the host-transfer memory requirements before selecting the backing for a CPU-fillable title texture. Exercise the mapped linear R8 plane with a driver shim that returns no compatible memory types for the host-transfer image. Reported-by: qhukz13 (PR ProjectLeonida#1894) AI-assisted-by: OpenAI Codex (gpt-6.2-astra)
|
@qhukz13, could you rerun The runtime now checks which memory types the host-transfer image can bind before choosing its backing. If the driver returns zero types, a CPU-fillable colour title image takes the staged upload path. This includes the mapped linear R8 plane from your report. On the RTX 4090 (Windows 11, NVIDIA 616.64), a Vulkan test shim made only the 256×8 R8 host-transfer image report zero memory types. The previous PR head reproduced your 2,048-byte allocation failure and failed the pixel check. At the new head, all three CTests passed with validation off and all three passed with AI-assisted with OpenAI Codex ( |
|
Rerun at
No validation messages. So the real unmasked device is fixed, thanks. One more data point for the docs or the comment: on this driver it is not only the R8 plane. A variant of the same check that logs (a local commit of mine on top of AI-assisted (Claude Code). |
Record which title image formats have no bindable host-transfer memory type. Document the three formats observed on the GTX 1050 Ti by qhukz13. Suggested-by: qhukz13 (PR ProjectLeonida#1894) AI-assisted-by: OpenAI Codex (gpt-6.2-astra)
|
One more data point for this PR, from a full
On main the log shows AI-assisted (Claude Code). |
|
Independent check on real Pascal hardware of head Machine: Windows 10 Pro 22H2 (19045), Intel Core i7-2600, 4 GB GeForce GTX 1050 Ti, NVIDIA 582.28, MSVC 19.44 RelWithDebInfo. Setup: Before ( That is the real driver's After (
Not covered by this check: validation layers were not enabled, other tests were not run, and only the memory-type branch above was exercised (the shim-forced paths were left alone). AI-assisted (OpenCode, DeepSeek). |
…#1150) Five rows of the previous tables re-run three times each on the same GTX 1050 Ti / Windows 10 19045 host: d3d12_subresource_copy and d3d12_r9g9b9e5_uav now pass, d3d12_existing_heap needs ProjectLeonida#1894, and both remaining heap rows (d3d12_heap_properties ALLOW_ALL and the d3d12_vulkan_device HARDWARE_PROTECTED row) are the tier-1 host gate that ProjectLeonida#1389 covers. AI-assisted (OpenCode, DeepSeek).
|
I resolved the staging conflict locally using PR head I also simplified the existing RTX 4090, Windows 11, NVIDIA 616.64, Vulkan validation enabled. I ran the same synthetic texture checks on each tree, using a local driver restricted to the texture portion of the existing-heap fixture. The default, write-watch-on and write-watch-off runs all failed on main and all passed with the resolution. Shared BC1 placements preserved all 512 bytes after a CPU write and GPU copy with host image copies both enabled and disabled. The stock The public branch still needs the merge. GitHub declined the push because main brings CI workflow updates that the connected account lacks permission to publish. AI-assisted resolution and hardware verification using OpenAI Codex (GPT-6). |
Retain staging for shared BC images on devices without host copies and keep the per-image fallback for formats without usable host-transfer backing. AI-assisted-by: OpenAI Codex (GPT-6)
|
The conflict resolution is on the public branch at Windows 11, RTX 4090, NVIDIA 616.64, Vulkan validation enabled. I ran the synthetic texture portion of the existing-heap fixture in the default, write-watch-on and write-watch-off configurations. All three failed on plain AI-assisted integration and hardware verification using OpenAI Codex (GPT-6). |
Claimed as
RT-TITLE-STAGED-PER-FORMATin the coordination issue. This addresses the format-specific follow-up from the #1827 merge note.Depends on: #1827 (merged).
What and why
A Vulkan device can expose host image copy and still refuse it for a particular format or combination of image usages. In that case the runtime successfully created the image without host-transfer usage, but a subsequent title-texture refresh skipped its upload. Both a linear movie-plane fixture and a tiled compressed image returned incorrect bytes.
The runtime selects mandatory staging when the format, image usage or compatible memory types rule out host transfer. A GTX 1050 Ti reported no bindable memory type for a host-transfer R8 movie plane. Pascal hardware report A CPU-visible, single-sampled colour title image can use ordinary image memory and queue the upload when host transfer is unavailable. Images that can use either path retain the existing placement heuristic and host-backing retry. An allocation failure on an image that requires staging propagates normally.
Tested
Windows 11, NVIDIA GeForce RTX 4090 (616.64), MSVC 19.44. The test keeps host image copy enabled on the real device. A test shim masks the R8 format feature and separately rejects host-transfer usage in the BC1 image-support query.
446574e76with only the new test,d3d12_existing_heapfailed both readbacks: the persistently mapped R8 plane and the four-mip, two-slice BC1 array.14f04ce2d, both readbacks pass. All three existing heap CTests passed (default, write watch disabled, write watch enabled), including the unmasked controls.06ba2eb2d, a test shim reproduced the Pascal driver's empty memory type mask for a 256×8 R8 image. The previous head failed the pixel check. All three existing-heap CTests passed on the RTX 4090 with the fix, both with and without Vulkan validation. RTX 4090 test details2d258c8cd, the fallback logs the Vulkan format once per process for each affected format. The same three tests passed on the RTX 4090 with validation enabled and disabled (6/6). The shim produced exactly one format 9 (R8) fallback message in each test process.git diff --checkpassed.All texture inputs are synthetic. These tests exercise format-specific uploads and pixel readback on the reported GPUs.
AI-assisted: OpenAI Codex (
gpt-6.2-astra).Checklist