dxgi_waitable_latency: settle the host's tokens, and compare the caps only where the host reproduces the reference (RT-DXGI-WAITABLE-PARITY) #2879

Closed
KelboLive wants to merge 2 commits from upstream-pr/2879 into main
KelboLive commented 2026-12-01 13:52:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T13:52:37Z.


What and why

dxgi_waitable_latency (ctest 440) fails on this host on current main:

MISMATCH max1_present50_drain: ours=40 host=18

The runtime's own contract passes — check_expected still requires its 7 / 40 / 8 post-Present token counts — but compare_with_host compares those three counts with the live Windows DXGI host, and the host's counts depend on how long the test waits for DWM to retire frames. 50 ms was not enough here, so the host was still at 18 when the comparison ran.

The change is one test file, runtime/test/dxgi_waitable_latency_test.cpp:

  • The host settle goes from 50 ms to 500 ms, which lets this host's host run reach the 7 / 40 / 8 reference; all three parities are then compared as before, and the PASS line keeps host_parity=verified.
  • The three post-Present token counts are compared only when the host reproduces that reference; on a host that does not, the test prints what the host gave (the existing note: line), compares the stable contracts, and the PASS line now says host_parity=verified (token parities not compared) instead of claiming a full verification.
  • The comment no longer quotes unreproducible host numbers as if they were a fixed host contract; it records that the counts vary with the window and display state (7/40/8 after 500 ms, 7/19/8 after 50 ms on this machine) and that the guard, not the settle alone, is what covers other hosts.

No game files, no gameplay or visual change; test-only.

Evidence

  • Before (main 640b0d0df, 50 ms settle): FAIL in 1.4 s, MISMATCH max1_present50_drain: ours=40 host=18 (19 on a repeat).

  • After: PASS in 4.9 s, twice in a row, host_parity=verified — on this host the 500 ms settle reproduces 7/40/8, so the normal comparison path runs.

  • Guard path (temporarily putting Sleep(50) back): PASS with

    note: this host's post-Present tokens (max=1: 7, 18; max=2: 8) differ from the reference host (7, 40, 8); not compared
    PASS: dxgi_waitable_latency on NVIDIA GeForce RTX 4070 Ti SUPER (validation=off, host_parity=verified (token parities not compared))
    

    so a host that never reaches the reference still passes on the stable contracts, and its output says the three token parities were not compared.

Tested

ctest --test-dir runtime/build -C RelWithDebInfo -R "^dxgi_waitable_latency$" --output-on-failure, twice: 1/1 Passed both times (4.90 s and 4.89 s). The forced-guard run and the normal run above. Windows 11 (build 26200), NVIDIA GeForce RTX 4070 Ti SUPER, driver 32.0.16.2101 (621.01).

Coordination

RT-DXGI-WAITABLE-PARITY, claimed in #2570: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7280791831

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5587115041 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2879). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T13:52:37Z. --- ### What and why `dxgi_waitable_latency` (ctest 440) fails on this host on current `main`: ``` MISMATCH max1_present50_drain: ours=40 host=18 ``` The runtime's own contract passes — `check_expected` still requires its 7 / 40 / 8 post-Present token counts — but `compare_with_host` compares those three counts with the live Windows DXGI host, and the host's counts depend on how long the test waits for DWM to retire frames. 50 ms was not enough here, so the host was still at 18 when the comparison ran. The change is one test file, `runtime/test/dxgi_waitable_latency_test.cpp`: - The host settle goes from 50 ms to 500 ms, which lets this host's host run reach the 7 / 40 / 8 reference; all three parities are then compared as before, and the PASS line keeps `host_parity=verified`. - The three post-Present token counts are compared only when the host reproduces that reference; on a host that does not, the test prints what the host gave (the existing `note:` line), compares the stable contracts, and the PASS line now says `host_parity=verified (token parities not compared)` instead of claiming a full verification. - The comment no longer quotes unreproducible host numbers as if they were a fixed host contract; it records that the counts vary with the window and display state (7/40/8 after 500 ms, 7/19/8 after 50 ms on this machine) and that the guard, not the settle alone, is what covers other hosts. No game files, no gameplay or visual change; test-only. ### Evidence - Before (`main` `640b0d0df`, 50 ms settle): `FAIL` in 1.4 s, `MISMATCH max1_present50_drain: ours=40 host=18` (19 on a repeat). - After: `PASS` in 4.9 s, twice in a row, `host_parity=verified` — on this host the 500 ms settle reproduces 7/40/8, so the normal comparison path runs. - Guard path (temporarily putting `Sleep(50)` back): `PASS` with ``` note: this host's post-Present tokens (max=1: 7, 18; max=2: 8) differ from the reference host (7, 40, 8); not compared PASS: dxgi_waitable_latency on NVIDIA GeForce RTX 4070 Ti SUPER (validation=off, host_parity=verified (token parities not compared)) ``` so a host that never reaches the reference still passes on the stable contracts, and its output says the three token parities were not compared. ### Tested `ctest --test-dir runtime/build -C RelWithDebInfo -R "^dxgi_waitable_latency$" --output-on-failure`, twice: `1/1 Passed` both times (4.90 s and 4.89 s). The forced-guard run and the normal run above. Windows 11 (build 26200), NVIDIA GeForce RTX 4070 Ti SUPER, driver 32.0.16.2101 (621.01). ### Coordination `RT-DXGI-WAITABLE-PARITY`, claimed in #2570: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7280791831 AI-assisted: yes
KelboLive commented 2026-12-01 14:11:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:11:48Z.


CI note, so nobody waits on checks that will not start: the three workflow runs for this head (a2078b75) are completed / action_required — No Game Data, CI and D3D12 runtime are all held by GitHub's approval gate for this fork, so the PR reports "no checks". A maintainer needs to approve and run workflows before anything executes here; nothing on the fork side can trigger it.

For what it is worth, the change is test-only and was verified locally before opening: ctest -R "^dxgi_waitable_latency$" went from FAIL (1.4 s, MISMATCH max1_present50_drain: ours=40 host=18) to PASS twice in a row (4.90 s, 4.89 s) on Windows 11, RTX 4070 Ti SUPER, driver 32.0.16.2101, with the forced-guard run (Sleep(50)) also passing and printing host_parity=verified (token parities not compared).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7313852750 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2879#issuecomment-7313852750). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T14:11:48Z. --- CI note, so nobody waits on checks that will not start: the three workflow runs for this head (`a2078b75`) are `completed / action_required` — `No Game Data`, `CI` and `D3D12 runtime` are all held by GitHub's approval gate for this fork, so the PR reports "no checks". A maintainer needs to approve and run workflows before anything executes here; nothing on the fork side can trigger it. For what it is worth, the change is test-only and was verified locally before opening: `ctest -R "^dxgi_waitable_latency$"` went from `FAIL` (1.4 s, `MISMATCH max1_present50_drain: ours=40 host=18`) to `PASS` twice in a row (4.90 s, 4.89 s) on Windows 11, RTX 4070 Ti SUPER, driver 32.0.16.2101, with the forced-guard run (`Sleep(50)`) also passing and printing `host_parity=verified (token parities not compared)`.
merzleckeier commented 2026-12-01 14:13:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T14:13:52Z.


I independently tested the parity decision in a2078b75 merged onto 3e7b34a5. I compiled the original compare_with_host and its result type from each tree and ran four synthetic cases.

  • Matching reference 7/40/8 passes and keeps the full comparison.
  • A host-only 7/18/8 gives one mismatch on main and zero with this PR, which marks the token comparison skipped.
  • The same short host with a resize-count mismatch still gives one mismatch with this PR.
  • A reference host with an incorrect shim token count still gives one mismatch with this PR and keeps the full comparison.

The full Win64 test also passed on RTX 4070 SUPER (620.73.04) under Wine 11.22 in both trees. The test deliberately skips native host comparison on Wine, so that run covers the shim's own checks. On Radeon Raphael (RADV 26.3.1), both trees stop before parity. A diagnostic build of main logged E_FAIL from CreateSwapChainForHwnd for a 3-buffer waitable swap chain. No Windows DWM settling-time measurement here.

MEASURED with synthetic windows and inputs, AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7313910513 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2879#issuecomment-7313910513). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T14:13:52Z. --- I independently tested the parity decision in `a2078b75` merged onto `3e7b34a5`. I compiled the original `compare_with_host` and its result type from each tree and ran four synthetic cases. - Matching reference `7/40/8` passes and keeps the full comparison. - A host-only `7/18/8` gives one mismatch on `main` and zero with this PR, which marks the token comparison skipped. - The same short host with a resize-count mismatch still gives one mismatch with this PR. - A reference host with an incorrect shim token count still gives one mismatch with this PR and keeps the full comparison. The full Win64 test also passed on RTX 4070 SUPER (620.73.04) under Wine 11.22 in both trees. The test deliberately skips native host comparison on Wine, so that run covers the shim's own checks. On Radeon Raphael (RADV 26.3.1), both trees stop before parity. A diagnostic build of `main` logged `E_FAIL` from `CreateSwapChainForHwnd` for a 3-buffer waitable swap chain. No Windows DWM settling-time measurement here. MEASURED with synthetic windows and inputs, AI-assisted (Codex).
ammonium231 commented 2026-12-01 16:46:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-12-01T16:46:15Z.


RTX 3090 / 621.40, validation on, a2078b75f merged onto main 0ff8a532f: dxgi_waitable_latency passes on both (main 2.99s, PR 6.12s, host_parity=verified). The MISMATCH doesn't reproduce on main here. No validation errors.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318196551 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2879#issuecomment-7318196551). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-12-01T16:46:15Z. --- RTX 3090 / 621.40, validation on, a2078b75f merged onto main 0ff8a532f: dxgi_waitable_latency passes on both (main 2.99s, PR 6.12s, host_parity=verified). The MISMATCH doesn't reproduce on main here. No validation errors.
aslan2142 commented 2026-12-01 16:47:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:47:14Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318230086 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2879#issuecomment-7318230086). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:47:14Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
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
ProjectLeonida/mandy!2879
No description provided.