Repository navigation
Runtime: preserve D3D12 fence rewinds across CPU and GPU signals (D3D-472) - #4577
gabrielsteglich wants to merge 914 commits into
Conversation
# Conflicts: # docs/design.md
# Conflicts: # docs/design.md
# Conflicts: # docs/character_skeleton.md
# Conflicts: # docs/design.md
# Conflicts: # docs/design.md
# Conflicts: # docs/design.md
# Conflicts: # docs/design.md
- replay_cpu_bench: ItsNotRexed#3693 moved a draw's render targets and vertex buffers into Draw::views (D3D-391); the bench builds a DrawViews block instead of writing the old inline arrays. - xgameruntime_user_test links file_system.cpp, which now defines rt::fs::game_dir that xgameruntime.cpp calls. - check_sparse_queue_family: a vkCreateInstance refused because the api_dump/validation layer is not installed is the documented "layer absent" skip (77), not a failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Defer reserved-buffer tile updates and copies alongside held command batches and signals. Keep sparse backing alive, resolve source mappings at submission order, and carry waits past no-op or rejected binds. Compare all tile readbacks with native D3D12 for CPU and COPY queue signals, and test wait forwarding with a fake incomplete Vulkan producer.
- test_bary_fallback: ItsNotRexed#3647 (BUILD-1046) made a missing input folder exit 2 with "does not exist"; the test from ItsNotRexed#1379 still expected exit 1. - test_format_decode_branch: the f16 reference uses the interpreter's pinned half_to_float (a NaN half widens to the canonical quiet NaN) instead of struct's '<e', whose NaN payload changed in Python 3.14 (CPython gh-130317). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kam471
left a comment
There was a problem hiding this comment.
Built the five targets at e9715504 on Windows 11, RTX 5070 Ti, RelWithDebInfo, and ran each: exit 0 for all.
d3d12_fence_timing_test:NVIDIA GeForce RTX 5070 Ti: COPY fence value 4, DIRECT after Wait(8) completed early 0;WARP: CPU fence 10 -> 4 -> 12, old event retained 1, new event set early 0;WARP: CPU signals 15 -> 20, queued signal then 10, old event retained 1, new event set early 0;WARP: COPY fence value 4, DIRECT after Wait(8) completed early 0.d3d12_queue_handover_test: Vulkan layer 373 cases, every one exact; host D3D12 371 cases, every one exact;COPY rewound 10 -> 4; DIRECT waited for 12 and read the exact texture and buffer.vk_fence_dispatcher_sync_test: stable queue scan, latched waits, CPU rewind, re-entrantcancel(),mark_device_lost()wake andDEVICE_LOSTdrain all ok.vk_sparse_queue_order_test: deferred no-op and rejected mappings preserve GPU waits (the two expectedheld tile mapping failed when it was releasedlines are printed).d3d12_buffer_tiles_test: 12 full tiles match across all readbacks on the held-batch CPU-signal and copy-queue-signal paths.
git diff --check clean. The numbers match the PR body (373/371, and the baseline early-release case is covered).
Two coordination notes:
- The branch carries #4224 (
bc15a8bb), which is still open (MERGEABLE). That dependency is declared and works here, but #4577 can only land after #4224, and merging it before would bring the sparse-mapping commit with it. - #4557 and #4570 also edit
runtime/src/vulkan_backend.haround the execute/Signal paths, and #4557 editsruntime/test/d3d12_queue_handover_test.cpp; all three need a rebase/fresh run whichever lands first.
|
Verified PR #4577 on Windows 11 (25H2
Code review of AI-assisted (Gemini, Antigravity). |
Flyander
left a comment
There was a problem hiding this comment.
The per-physical-queue prefixes preserve ordering within one Vulkan queue, but the final publication loop still treats pending_ insertion order as completion order across distinct queues. D3D12 allows a fence to be rewound and specifies that when signals race across queues, the value from the last Signal to complete remains. Please preserve or explicitly serialize that cross-queue completion order and add a deterministic regression.
| const auto prefix = std::find_if(completed_prefixes_.begin(), completed_prefixes_.end(), | ||
| [physical](const auto& entry) { return entry.first == physical; }); | ||
| if (prefix != completed_prefixes_.end() && i <= prefix->second) { | ||
| publish_locked(signal.value, signal.point, ready); |
There was a problem hiding this comment.
[P2] Preserve completion order across different physical queues. If pending_ contains Q1 Signal(10) followed by Q2 Signal(4), and Q2 completes first while Q1 completes last, a poll that sees both timeline counters complete publishes 10 then 4 here and leaves completed_ == 4. D3D12 requires the last completing signal to win, so the expected value is 10 (and a new Wait(8) must not be released from the stale 4 state). The prefix calculation proves ordering only within one VkQueue; it gives no ordering between Q1 and Q2. Please preserve that ordering or serialize these signals, with a deterministic two-queue regression. Microsoft documents the rewind/race rule: https://learn.microsoft.com/en-us/windows/win32/direct3d12/user-mode-heap-synchronization
Merges that each passed alone but clash together: - v_cmp_class_f64: the earlier cmp_class_f64 (685d16e) (operand-form checks, test_cmp_class_f64) and the later f64 branch in cmp_class both handled the opcode; f64 goes to cmp_class_f64 again, f16 stays in cmp_class. - rdna2spirv CLI tests: spirv-as/spirv-val now run in the output folder with the staging file's bare name, so the test doubles resolve it against cwd; assemble_spirv decodes the output only when it is bytes. (The doubles had been writing .spirv-*.tmp files into the repository root.) - ps_w64 fixtures (TEST-722): an 18th fixture (ps_w64_a_discard) landed; its killed lanes export nothing and keep the clear value. - first_light: a run without an OBJ removes mesh.bin, and harness_env reads manifest["files"]; batch_glb's stats name failures and dropped textures; run_gpu_tests reports a frame never written as a missing readback (TEST-837). - make_game TRANSLATION_SOURCES and runtime.yml's paths include spirv_opt.py and report_paths.py (and wave64_emulate_opt.py), which the translator imports. Repo rules: stdout guard on six tools; encoding on two opens (gen_gdk_runtime_classes' helper is read_utf8); newline on one write; anim_skeleton_match's joaat encodes like hashdict.joaat; test_feature_scan's new test is listed with the others its globals() runner reaches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/runtime_imports.md # runtime/CMakeLists.txt # runtime/shims/xgameruntime.cpp # runtime/test/xmem_test.cpp # tools/rdna2spirv.py
- rdna2spirv: %fmt_size_tab (main's typed-load size table) registers its length and entry constants when a load
first uses it; created at assembly, %c128 came after the OpTypeArray naming it and spirv-val refused
buffer_store_format_d16 modules (test_u16_high_half).
- test_vs_packed_inputs matches main's wording of the same SHADER-644 rule ("mixed component types").
- test_mutations: the v_mul_legacy_f32 anchor follows the SHADER-340 flushes (it had stopped matching on main).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ItsNotRexed#2887 added the fixture to the M2 build; with no entry in OTHER_HARNESS the GPU suite reported it as "no checker defined". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
AI-assisted (Claude Code).#4576 (Report Vulkan pipeline statistics write failures). POSTED.Tested
AI-assisted (Claude Code). |
|
Tested
No game files. AI-assisted. |
|
Tested |
|
Tested c7cc36b on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran AI-assisted. |
Claimed as D3D-472 in the coordination issue.
Depends on: #4224
What and why
The Vulkan layer used one monotonically increasing timeline for each D3D12 fence. After
Signal(4)on a fence at10, it still reported10and released a newWait(8)before the producer supplied the data. A CPU signal could also be deferred behind an outstanding GPU signal.ANYregistrations. A deterministic regression covers two D3D12 queues that share a Vulkan queue but use separate progress semaphores.The fence changes are in
e9715504. The branch includes #4224’sbc15a8bbfor the sparse-queue integration.Tested
Windows 11 Pro build 26300, MSVC 19.44.35229, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0, RelWithDebInfo. NVIDIA GeForce RTX 3090, driver 621.01. Vulkan validation enabled, with implicit layers disabled.
10 → 4 → 12, events registered before and after the rewind, CPU15 → 20while GPU10is pending, and COPY signaling4while DIRECT waits for8.ANYcancellation, and sparse waits carried through rejected mappings and consumer queue destruction.Checklist
AI-assisted (OpenAI Codex).