Skip to content

loader/shims/tools/tests: ordinal classification, host-binding fix, import inventory, hello_pixels - #2490

Open
NolanCotter wants to merge 38 commits into
ItsNotRexed:mainfrom
NolanCotter:main
Open

NolanCotter wants to merge 38 commits into
ItsNotRexed:mainfrom
NolanCotter:main

Conversation

@NolanCotter

Copy link
Copy Markdown
Contributor

Summary

Follow-up batch after #1912 (claim: #1902 (comment)). 12 commits, all new files or small self-contained changes; no game data.

Runtime / loader

  • runtime/shims/registry.cpp: console ordinal-import classification — xaudio2_9.dll!#1 (XAudio2Create) and gameinput.dll!#1 (GameInputCreate) classify as HRESULT so unimplemented imports report E_NOTIMPL instead of faking success (+ unimplemented_policy_test checks)
  • runtime/src/pe_loader.cpp: fix — unregistered imports on shim-owned DLLs (xgameruntime, gameinput, ...) could bind to the host namesake (the live PC Gaming Services runtime). They now follow the pseudo-handle path and go unimplemented. + docs/import_routing.md (bind order, owns_dll, per-DLL outcome)

Docs

  • docs/console_libraries.md: catalogue of the console-DLL surface (d3d12_xs, xg_xs, AcpHal, dstorage_xs, chad/xapu/xcrdapi, ...) and per-module shim status
  • stale section/symbol reference fixes across docs
  • docs/hello_pixels.md + index rows
  • i18n: German + Italian community quickstarts (@NolanCotter maintainer)

Tools

  • tools/import_inventory.py: stdlib PE32+ import parser — maps dll!function / ordinal imports to shim-layer coverage per module (mirrors registry.cpp classification); 18 tests
  • tools/hello_pixels.py: package-free complement to first_light — assembles hand-written SPIR-V (spirv-as only), draws a generated quad through VKH_DRAW_MESH, writes PPM+PNG, --check oracle verifies coverage + probe pixels against the pattern's closed form

Tests (~1,400 lines): test_hello_pixels, test_import_inventory, test_run_gpu_tests_helpers, test_make_game_shader_state, test_viewer_serve additions, test_spirv_interface, test_wave64_halves_operands, and semantic fixtures for s_cmpk_* / s_wqm_b32 / ALU / f16-transcendental ops.

Tested

  • python -m compileall -q make_game.py tools tests ✅
  • test_hello_pixels 9 ✅ · test_import_inventory 18 ✅ · test_run_gpu_tests_helpers 25 ✅ · test_make_game_shader_state 40 ✅ · test_viewer_serve 38 ✅ · test_spirv_interface 28 ✅ · test_wave64_halves_operands 23 ✅
  • python -m unittest discover -s tests/semantic — 1,694 tests OK (incl. new fixtures; expected values verified against the translator's own interpreter)
  • hello_pixels end-to-end: Mesa llvmpipe (LLVM 20.1.2), Vulkan 1.3.275, Linux — 512×512 draw, 100% coverage, all probes pass
  • test_i18n_index, test_docs_links ✅

Caveat: the registry.cpp / pe_loader.cpp changes are Windows-only C++ and were not compiled locally (Linux box) — same situation as the #1912 classifier change that adriaespii verified on MSVC. CI or a Windows check appreciated.

AI assistance

Written with AI assistance (Devin + delegated workers); all test expectations verified by execution, not hand-trust.

Checklist

  • Claimed in the coordination issue
  • No game data, keys, or protection bypasses
  • Tests added for new behavior
  • AI assistance disclosed

@umnitus

umnitus commented Nov 22, 2026

Copy link
Copy Markdown

Tested hello_pixels at 9213603 on RTX 3060 12 GB, NVIDIA 621.14, Vulkan 1.4.357, Windows 11 26H2: pass.

Ran python -B -I tools/hello_pixels.py --work --harness <same-commit-vk_harness.exe> --size 512 --run --check. Exit 0. The GPU framebuffer had 262,144/262,144 covered pixels, all seven reference probes passed, and the raw, PPM and PNG outputs were written. The harness was built with llvm-mingw Clang 23.1.6 from the tested commit. AI-assisted verification.

@adriaespii

Copy link
Copy Markdown
Contributor

Tested 9213603d on AMD Radeon RX 9070 (RDNA4), AMD driver 26.10.1 (Vulkan 1.4.359), Windows 11 Pro 24H2, MSVC 19.44 (Visual Studio 2022 Community):

Windows MSVC Build & Runtime Tests

  • Compiles cleanly on Windows with MSVC 19.44: all 46 build targets linked with 0 errors/warnings.
  • unimplemented_policy_test.exe: 101 checks passed, 0 failed (including ordinal 1 classification checks for xaudio2_9.dll and gameinput.dll).
  • Full CTest suite (ctest --test-dir runtime/build): 110/110 passed (100%), 0 failed, 6 skipped, 1 disabled.

Real Hardware Verification (hello_pixels.py)

  • Tested tools/hello_pixels.py --work <dir> --run --check end-to-end at both 256×256 and 512×512:
    • Device: AMD Radeon RX 9070 (subgroup 32..64)
    • Active extensions: VK_KHR_shader_fma, VK_KHR_fragment_shader_barycentric, VK_EXT_fragment_shader_interlock, VK_KHR_maintenance8
    • Rendered image.raw, image.ppm, and image.png with 100% test pattern coverage and all probe pixels matching closed-form predictions.

Python Test Suites

  • python -m compileall -q make_game.py tools tests: OK
  • python -m unittest discover -s tests/semantic: 2590/2590 passed (OK)
  • Unit test modules:
    • tests/test_hello_pixels.py: 9/9 passed
    • tests/test_import_inventory.py: 18/18 passed
    • tests/test_run_gpu_tests_helpers.py: 25/25 passed
    • tests/test_make_game_shader_state.py: 40/40 passed (2 skipped)
    • tests/test_viewer_serve.py: 38/38 passed (2 skipped)
    • tests/test_wave64_halves_operands.py: 23/23 passed

Note on tests/test_spirv_interface.py

In tests/test_spirv_interface.py:146, test_64_bit_vectors_may_span_two_locations fails:

spirv_interface.InterfaceError: a 64-bit vector spanning two locations needs Component 0

This is because commit 461218a6 on main tightened location_masks to reject 64-bit vectors that start on a non-zero component and span across locations (component + slots > 4 and component). For dvec2 (slots = 4) starting at component = 2, it now correctly throws InterfaceError per the Vulkan specification. Updating line 146 to expect the exception resolves it:

        with self.assertRaisesRegex(spv.InterfaceError, "Component 0"):
            dvec2.location_masks(2)

No game data used.

AI-assisted.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

Fixed in defa3f19 — test_64_bit_vectors_may_span_two_locations now expects InterfaceError("Component 0") for dvec2.location_masks(2), matching 461218a6. test_spirv_interface.py: 28/28 pass.

Thanks @umnitus (RTX 3060/Windows) and @adriaespii (RX 9070/MSVC + llvmpipe) for the hardware runs — the MSVC clean build and 110/110 CTest covers the uncompiled-locally caveat.

@CharlyRien

Copy link
Copy Markdown

Code review of the loader and inventory parts (AI-assisted), checked at defa3f1, with synthetic PE images and the repo's loader_test on Windows 11 23H2 (RTX 3090 machine). Nothing was pushed.

1. The host-binding fix is bypassed when the import's DLL name has no .dll (or ends in a dot) (proved). runtime/src/pe_loader.cpp resolve() keys on lower(dll) only. resolve_forwarder (a few lines above it) appends .dll, and library_loader.cpp's module_name() appends it and strips a trailing dot.

  • So for an import from GameInput or gameinput.dll., both shims::find and the new owns_dll gate miss. LoadLibraryExA then adds .dll itself and binds the real System32 module.
  • Loader cases added to loader_test.cpp in a private copy, with a test SHIM_TABLE {"gameinput.dll","GameInputCreate"} and the real gameinput.dll present in System32:
    import gameinput.dll   !DllCanUnloadNow -> Unimplemented owns_dll=1
    import GameInput       !GameInputCreate -> Host  owns_dll=0   (slot = host gameinput base + 0x6f10)
    import GameInput       !DllCanUnloadNow -> Host  owns_dll=0
    import GameInput       !#2              -> Host
    import gameinput.dll.  !DllCanUnloadNow -> Host
    forwarder GameInput.DllCanUnloadNow     -> Unimplemented
    
  • The registered shim is skipped too. That part predates this PR, but the new owns_dll gate inherits it. docs/import_routing.md says static imports match the GetProcAddress path, and here they don't.
  • Fix: normalise the key in resolve() the same way resolve_forwarder / module_name() do. Linkers always write .dll, so this needs a hand-made or hostile image, but it's a one-line fix.

2. tools/import_inventory.py's classify port disagrees with registry.cpp (proved). The PR adds "#1" as HRESULT for xaudio2_9(redist).dll and gameinput.dll in registry.cpp, but not in the Python port, whose docstring says it mirrors it. Result: classify("xaudio2_9.dll", "#1") and classify("gameinput.dll", "#1") give other in Python, while the C++ test expects HResult.

3. The inventory ignores delay-load imports (proved). It reads only data directory 1. The loader binds directory 13 eagerly. An image whose only import is a delay import of xgameruntime.dll!XUserAddAsync gives an empty inventory.

4. The inventory and the loader stop the descriptor table at different points (proved). The loader stops at the first descriptor with Name == 0, but the tool keeps going and reads string_at(0), the MZ header, as a DLL name:

descriptors kernel32 / Name=0 / xmem  ->  [('kernel32.dll','Sleep'), ('mz','Sleep'), ('xmem.dll','XMemAlloc')]

The loader binds only the first. An unreadable name is also skipped silently, where the loader throws.

5. The report's "unimplemented thunk" column counts host-bound imports (proved). Every unregistered import goes there, including kernel32.dll!Sleep and api-ms-win-core-synch-l1-2-0.dll!Sleep, which the loader binds to the host: total 3 … implemented 0, unimplemented thunk 3. On the real executable, that would greatly overstate what is missing, which is the number this tool exists to give.

6. MAX_ENTRIES doesn't bound the work (proved). The cap is per table (65,536 descriptors × 65,536 thunks), and shared thunk tables aren't deduplicated. A 529 KB file with 64 descriptors sharing one table took 94.5 s, gave 4,194,240 entries and peaked at 613 MiB. A global cap, or deduplicating by thunk RVA, would make the "stops a malformed image" comment true.

7. (reasoned) Ordinal 1 of the host xaudio2_9.dll is XAudio2Create (checked against System32), but I couldn't confirm it for xaudio2_9redist.dll. Host ordinals 8–10 (XAudio2CreateV2_9, …WithVersionInfo, …WithSharedContexts) also return HRESULT and stay other.

Checked and found correct, for normal .dll names:

  • The owns_dll gate in resolve() and resolve_forwarder: unregistered names and ordinals on an owned DLL go to Unimplemented, registered names go to Shim, and case is ignored.
  • Forwarders by name and by #N into owned modules never reach Host.
  • IMAGE_ORDINAL64 masking and the hint/name +2 offset, in both C++ and Python.
  • The forwarder #N parse rejects values over 0xFFFF and non-digits.
  • The PR's own tests pass: loader_test, unimplemented_policy_test and test_import_inventory. None of them covers items 1–6.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

All addressed in ffdcef4 (and 8c91167 adds a console-ABI doc). Thanks for the thorough pass — every one of these reproduced.

1. resolve() DLL-name normalisation — fixed. New dll_key() in pe_loader.cpp applies the same file-name rule module_name() / resolve_forwarder use (lower, trailing . dropped, .dll added when no extension), and both resolve() and resolve_forwarder() key on it. loader_test covers it: imports naming TestShim and testshim.dll. now bind the shim.

2. classify parity — #1 added to the xaudio2_9/xaudio2_9redist and gameinput branches in the Python port; test cases added.

3. Delay imports — directory 13 is now read (IMAGE_DELAYLOAD_DESCRIPTOR, RvaBased/IAT/INT checks matching bind_imports's throws). Fixture test included.

4. Table termination — the descriptor loop now stops at Name == 0 exactly like the loader, and unreadable descriptor/thunk names raise PeFormatError instead of silently skipping.

5. Host vs thunk — the report now mirrors the routing order: registered → implemented; unregistered on a shim-owned DLL → unimplemented thunk; anything else → host (owns_dll ported: the 8 host DLLs and api-ms-*/ext-ms-* exclusions). kernel32.dll!Sleep and the api-ms imports no longer inflate the missing count.

6. MAX_ENTRIES bound — thunk tables deduplicate by lookup-table RVA (your 64-descriptor case now walks the table once) plus a global MAX_TOTAL_ENTRIES cap that raises on a malformed image.

7. xaudio2_9 ordinals — #8–#10 added for xaudio2_9.dll only (the verified System32 table), registry.cpp and Python port both; xaudio2_9redist.dll stays other until its ordinal table is confirmed. New checks in unimplemented_policy_test.

Verified: test_import_inventory.py 24/24; cross-built on clang-cl 20 + xwin, loader_test 69 checks / 0 failed, unimplemented_policy_test 96 checks / 0 failed under Wine.

Generated with Devin

@Flyander Flyander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked at 249b7065ddb4db971e318d195da6eec96a2265ff. The existing test_import_inventory.py suite passes (24 tests), but two synthetic PE/list-input cases expose report mismatches with the loader:

  1. Shared lookup-table RVA drops later descriptors. I built a synthetic PE with gameinput.dll and other.dll descriptors pointing to the same lookup table containing GameInputCreate. pe_imports() returns only [('gameinput.dll', 'GameInputCreate')]; the second descriptor is omitted because seen_tables skips the RVA before associating its symbols with that descriptor's DLL. Loader::bind_imports() calls bind_thunks(dll, ...) for each descriptor, so it resolves each DLL's IAT separately. This hides a real import association and can produce the wrong per-DLL binding/coverage report. Please cache parsed symbols per lookup RVA, then emit them for each descriptor DLL, while keeping a bound on total work/output. The current test_shared_thunk_table_is_walked_once encodes the incomplete one-DLL result and should assert both associations.

  2. DLL-name normalization differs from the loader. parse_import_lines(['GameInput!GameInputCreate']) produces ('gameinput', 'GameInputCreate'); summarize() reports other/host, although pe_loader.cpp::dll_key('GameInput') resolves to gameinput.dll, where this import is registered and classified HRESULT. The PE path likewise only lowercases DLL names. Please apply the loader's dll_key normalization to report comparison/classification keys (and add cases for a bare name and a trailing dot).

NolanCotter and others added 10 commits November 22, 2026 16:40
Add synthetic, hardware-free unit tests for the pure helpers in
scripts/run_gpu_tests.py: the DXBC/signature/mesh-PSV0 builders, the
fragment passthrough source, check_pixel_const, frame_problem, the
LEONIDA_* flag parsers (device probe mocked) and the w64_graphics
fixture exclusion.
Hand-written .asm fixtures plus a reference implementation covering the
s_cmpk_* immediate-compare family and s_wqm_b32 nibble spread, the integer
ALU ops (v_not_b32, v_ashrrev_i32, v_min/max_i32/u32), f32 unary
transcendentals, and f16 transcendentals. Expected values were verified
against the translator's own interpreter run over the full suite
(1694 tests, OK).

Assisted-by: Devin
The package-free complement to first_light: hand-written SPIR-V
assembly (no GLSL compiler, spirv-as only), a generated VKH_DRAW_MESH
quad, RGBA32F readback to PPM and a zlib-only PNG, and a --check oracle
(coverage + 7 probe pixels against the pattern's closed form) exercised
by tests/test_hello_pixels.py without a GPU. Measured end to end on
Mesa llvmpipe 20.1.2 at 512x512.

Assisted-by: Devin
pe_loader: resolve() and resolve_forwarder() key the DLL name with
dll_key() — lower-case, trailing '.' dropped, ".dll" added when there
is no extension — the file-name rule LoadLibrary applies. Without it an
import naming "GameInput" or "gameinput.dll." missed the shim and
owns_dll lookups while LoadLibraryExA still bound a host namesake.

registry: xaudio2_9.dll ordinals 8-10 classify as hresult (host table
measured: XAudio2CreateV2_9 / WithVersionInfo / WithSharedContexts);
the redist's ordinal table is unconfirmed and stays other.

import_inventory: classify parity for the ItsNotRexed#1 ordinals; the delay-import
directory (entry 13) is read with the loader's checks; the descriptor
table stops at Name == 0 and unreadable names fail like read_string;
host-bound imports report as host instead of unimplemented thunk
(owns_dll ported); thunk tables deduplicate by RVA under a global cap.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NolanCotter

Copy link
Copy Markdown
Contributor Author

The SignalX defect is fixed on the branch: 3693ce7 lets a fence at slot 25 carry the newer-layout evidence, exactly your suggested correction (a). The mock's new check_signalx_detection reproduces your lost-signal case plus second-queue inheritance, proven-older slot-25 staying a no-op, and slot 23 forwarding without pinning. Verified again on the clang-cl/xwin cross-build under Wine: xs_proxy_mock_test PASS.

shdann's run on ItsNotRexed#2490 (Windows 11, MSVC, RTX 4090 + Radeon): two tests
that pass on main fail on this head.

queue_proxy expected E_NOTIMPL for every queue slot past the public
chain. The console contract answers those S_OK instead - frame pacing
flows through them - which xs_proxy_mock already requires. The queue
loop now expects S_OK, SignalX at slot 23 and PresentX at slot 30 are
checked as the modelled methods they are (a fence reaching 9 proves
SignalX forwarded; PresentX is handled, not refused), and the fence
tail keeps its E_NOTIMPL contract unchanged.

d3d12_debug_markers called SetMarker/BeginEvent/EndEvent through the
PC interface on what is now a console-shaped list: PC slot 56/57/58
land on console slots that map elsewhere, and the first Close failed.
The console ABI has no SetMarker or BeginEvent at all - its one marker
slot is EndEvent at console 60 - so the PC calls now go to the real
list behind each proxy via list_proxy_real_list; the proxy queue still
unwraps the proxies at ExecuteCommandLists.
shdann's source read on ItsNotRexed#2490: queue_layout is read and written in
child_slot with no synchronisation, so concurrent Signal/Wait calls on
one queue can race the detection write. The shared console_layout on
the device is already an atomic; give the per-queue cache the same
treatment - every use is a compare or an assignment, which the atomic
keeps answering.
@NolanCotter

Copy link
Copy Markdown
Contributor Author

Both regressions addressed in 8d15567 (on 40d9fed):

  1. d3d12_debug_markers: the PC marker calls now go to the real list behind each proxy via list_proxy_real_list. The console ABI has no SetMarker/BeginEvent (its one marker slot is EndEvent at console 60 -> PC 58), so there is no console slot to call them through; ExecuteCommandLists still unwraps the proxies, keeping the backend's label path under test.
  2. queue_proxy: the tail loop now expects S_OK for the console-only slots (the contract xs_proxy_mock requires), with the two modelled methods checked separately — SignalX at 23 forwards (proven by the fence reaching a value it alone signals) and PresentX at 30 answers != E_NOTIMPL (its exact status is the swapchain's). The fence tail keeps E_NOTIMPL.

Also e6aa341: your source-read observation — queue_layout is now std::atomic like the shared console_layout flag; every use is a compare or an assignment.

shdann's second case on ItsNotRexed#2490: a title reads the timestamp frequency at
start-up, before any fence call has detected the layout. Slot 18 then
went to the PC GetDesc - a struct-return write of a whole desc through
a caller that passed an 8-byte out pointer - so the frequency came
back unset (and the write overran).

While the layout is still unknown the call is served as the newer
layout's GetTimestampFrequency instead: an 8-byte write stays inside
either interpretation's buffer. A queue or device already proven
older keeps the generic GetDesc forward; slots 19 and 20 stay no-ops
because their newer interpretations write through caller pointers an
unmodelled older method might not supply.

The mock queue's slot 16 now writes a fixed frequency (unless the
argument is a mock object - then it is a newer Signal's fence), and
check_signalx_detection covers the undetected query and the post-
detection shifted path.
@NolanCotter

Copy link
Copy Markdown
Contributor Author

Slot 18 fixed in 92848ba. While the layout is still unknown, the call is served as the newer layout's GetTimestampFrequency rather than the older GetDesc — the struct-return desc write is far wider than the 8 bytes a frequency caller passes, so the frequency interpretation is the only answer that cannot overrun its argument. Your probe's expected sequence (calls[16]=1,calls[18]=0 then 2,0) now holds; the mock gained a slot-16 frequency write (skipped when the argument is a mock object — a newer Signal's fence) and check_signalx_detection covers the undetected query plus the post-detection shifted path.

On the wider ABI point from your first note: agreed that every post-shift PC method goes to the wrong slot when a caller invokes the PC interface on the console-shaped object — that is the intended shape (only title code, compiled against the console SDK, ever calls these objects). The marker test now speaks to the real list behind the proxy, which is the PC-callable object.

…ueue tail

Review findings from shdann's Windows run of the new console queue/list
work:

- d3d12_debug_markers (and every GPU harness compiled against the PC
  headers) drove lists through the console-shaped proxy, so PC slots past
  26 — including the PIX markers at 56-58, which have no console
  counterpart — reached unrelated console methods or were dropped.
  create_device_proxy gains console_lists: false hands the real
  (PC-shaped) list back from CreateCommandList. The GPU tests pass false;
  the title path keeps the console default.
- queue_proxy asserted E_NOTIMPL for the queue's console tail, but those
  slots deliberately answer S_OK now — frame pacing flows through them.
  The test's contract is updated; the fence tail stays refused.
- ChildProxy::queue_layout was a plain unsigned char read and written
  from many threads; it is atomic like the device-wide detection it
  caches.

xs_proxy_mock_test and loader_test pass under Wine; the modified test
objects compile clean under clang-cl. The GPU harnesses need a real
adapter — covered by shdann's Windows run.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NolanCotter

Copy link
Copy Markdown
Contributor Author

Both regressions and the race are addressed at head 7cc35310 (AI-assisted), on top of 8d155677/e6aa3412/92848ba9, which were already landing the same fixes in parallel — thank you for catching them.

Debug markers — 8d155677 unwrapped the two lists; 7cc35310 takes the broader route since the same trap hits every GPU harness compiled against the PC headers (~19 files calling PC slots ≥27 through a proxied list, e.g. SetGraphicsRootSignature at PC 30 → console-only slot, ClearRenderTargetView at 48 → PC 44). create_device_proxy now takes console_lists; false hands the real PC-shaped list back from CreateCommandList while every other object stays console-shaped. All the GPU tests pass false; the title path and xs_proxy_mock keep the console default. ExecuteCommandLists unwraps handle real lists unchanged, so submission through the console queue still works.

Queue tail — the E_NOTIMPL assertion predated the console contract; the queue's console-only slots deliberately answer S_OK because frame pacing flows through them (xs_proxy_mock already requires it). The merged test sweeps the tail expecting S_OK, skips the modelled slots 23/30, then verifies SignalX forwards (fence reaching value 9) and PresentX is handled rather than refused. The fence tail keeps E_NOTIMPL.

queue_layout race — e6aa3412 made it std::atomic like the device-wide flag it caches; all reads/writes now go through relaxed loads/stores.

Verified on the remote build host (clang-cl 20 + xwin, Wine): xs_proxy_mock_test PASS, loader_test 87/0, unimplemented_policy_test 96/0, and every modified test object compiles clean. queue_proxy and d3d12_debug_markers need a real adapter — they compile but I can't execute them under Wine. If you still have the setup handy, a re-run of those two plus any of the GPU suites (d3d12_draw, d3d12_present, etc.) would confirm the PC-list path end to end.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

Thanks for the confirmations — and yes, both of these are covered at the current head 7cc35310 (AI-assisted); both your runs were against 40d9fed3, which predates them.

SignalX — good to have the negative control too (the same test object on 2f851054's shim failing at line 745 is exactly what the fix changed).

Slot 18 before detection — fixed in 92848ba9, with your exact scenario as the regression check: check_signalx_detection now queries slot 18 on an undetected queue, asserts hz == 1000000 with calls[16] == 1/calls[18] == 0, then pins newer via a fence at 16 and asserts the shifted path keeps reaching the getter (calls[16] == 2).

On the design choice — rather than refuse the ambiguous slot, the shim answers it as the newer layout's GetTimestampFrequency. Refusing returns an error a title may treat as fatal at start-up, and the older interpretation (GetDesc, a struct-return write of a whole desc) overruns the 8-byte pointer a frequency caller passes — so frequency is the only answer that cannot corrupt the caller either way. Once a fence proves the layout, slot 18 keeps reaching the getter through the shifted path, so a title that queries before its first fence sees consistent behavior. Slots 19/20 stay no-ops while undetected because their newer interpretations write through caller pointers an unmodelled older method might not supply.

The command-list point — right that it is one ABI problem larger than the markers; ClearRenderTargetView at PC 48 landing on console-shifted PC 44 is the same mechanism as the marker slots. 7cc35310 fixes it at the source rather than per call site: create_device_proxy takes console_lists, and callers compiled against the PC headers (all 19 GPU harness files) get the real PC-shaped list back from CreateCommandList. The console-shaped object remains the default for the title path — that is the ABI the game itself must see.

Verified on the remote host (clang-cl 20 + xwin, Wine): xs_proxy_mock_test PASS including the new slot-18 checks, loader_test 87/0. queue_proxy and d3d12_debug_markers compile clean but need a real adapter — a re-run of those two plus any GPU suite at 7cc35310 on your Windows box would close the loop.

The doc already promised the no-SDK path — drop the pair --emit-only
produced on another machine into the work directory — but main() called
assemble() unconditionally, so a machine without spirv-as exited before
the prebuilt files could be used. shaders_into() now reuses an existing
pair only when spirv-as is absent; fresh assembly always wins when it is
on PATH, so a stale pair cannot shadow the sources. shdann's report on

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NolanCotter

Copy link
Copy Markdown
Contributor Author

Excellent comparison — thank you for running the whole suite (AI-assisted reply).

Your hypothesis is right. All six new failures are the one ABI problem: a PC-compiled caller's vtable index past slot 26 reaches a console-shifted slot. ClearRenderTargetView at PC 48 → shifted PC 44 is the same mechanism as ClearDepthStencilView at PC 50 in the D24/typeless clears (d3d12_vulkan_device), the marker slots, and the earlier d3d12_present/xbox_present stops — those tests die at their first draw because root-signature/viewport/render-target setup silently no-ops or lands on the wrong method. d3d12_f16_halves stopping at the first ps_packed case is the same: the draw setup's ≥27 slots were dropped, so the first readback sees wrong pixels.

All of it is fixed at 7cc35310 — create_device_proxy takes console_lists, and every GPU harness file compiled against the PC headers (including the four you named — d3d12_vulkan_device, d3d12_f16_halves, d3d12_present, xbox_present, plus 15 others with the same exposure) now passes false and gets real PC-shaped lists from CreateCommandList. The console-shaped list stays the default for the title path — that is the ABI the game must see. queue_proxy was fixed in 8d155677/7cc35310 (tail is S_OK by contract; SignalX/PresentX checked as modelled methods), and queue_layout is atomic per e6aa3412.

hello_pixels — real tool bug, not just docs: main() called assemble() unconditionally before anything could reuse a prebuilt pair. Fixed at 3cfc666e: the work directory's vs.spv/ps.spv are used when spirv-as is absent; assembly always wins when it is present (a stale pair can never shadow fresh sources). Verified both paths — your exact invocation now prints "spirv-as not found; using the prebuilt vs.spv and ps.spv in the work directory" and proceeds; an empty work dir still fails with a message that names both remedies. Doc updated to describe the mechanism.

Expected at 3cfc666e: the suite should return to main parity — the four new failures resolve and d3d12_present/xbox_present should get back to the known window-size-check failures you see on main. If you can re-run the same CTest comparison at 3cfc666e when you get a chance, that would close this out.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@NolanCotter Two of the fixes work. I checked them on Windows 11, MSVC 14.51:

  • Queue slot 18 at 92848ba: before the first fence, my unchanged probe now gets 1000000, PC slot 16 gets one call and PC slot 18 gets zero calls. At 40d9fed the same probe got 0 and called PC slot 18. After the fence detection, the result is still 1000000.
  • hello_pixels.py at 3cfc666: it now uses the prebuilt vs.spv and ps.spv without spirv-as. With an existing vk_harness, --size 512 --run --check exits with 0 on the RTX 4090 (driver 32.0.16.2101) and on the AMD Radeon iGPU (driver 32.0.21043.5001). The nine hello_pixels unit tests pass.

This head also changes the C++ GPU tests. I will compare the full CTest result with main again (the four regressions in my earlier comment) and report only if the result changes.

AI-assisted.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

Thanks — glad both hold up on real hardware (AI-assisted). The dual-GPU hello_pixels run is a nice bonus: it means the prebuilt-pair path and the pixel oracle both work on NVIDIA and AMD out of the box.

Standing by for the CTest comparison — the expected result at 3cfc666e is main parity, with d3d12_present/xbox_present back to the known window-size-check failures rather than the earlier stops.

…rebuilt .spv magic

Two leftovers from the console-ABI review round:

- PC GetDesc shares console slot 18 with the newer layout's
  GetTimestampFrequency; the proxy deliberately serves the frequency
  getter while the layout is undetected, so the GLOBAL_REALTIME
  priority check reads the desc on the real queue instead of trusting
  an 8-byte frequency written into a desc-shaped out-buffer.
- shaders_into() accepted any two files named vs.spv/ps.spv when
  spirv-as was absent; a stray file would reach vk_harness and fail
  far from the cause. The prebuilt pair is now checked against the
  SPIR-V magic first.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NolanCotter

Copy link
Copy Markdown
Contributor Author

@shdann Thanks — that's a decisive comparison. Resolutions:

  • d3d12_debug_markers / queue_proxy — fixed in 8d155677, which landed after the 40d9fed3 you ran: the marker calls go through list_proxy_real_list (the console list has no SetMarker/BeginEvent at all, only EndEvent at 60→58), and the queue tail contract is S_OK for console-only slots with modeled checks for SignalX (proven to forward) and PresentX (!= E_NOTIMPL).
  • d3d12_vulkan_device clears / d3d12_f16_halves / d3d12_present / xbox_present — your hypothesis was right: every list-> PC call past the shared prefix landed on a shifted console slot, so the clears recorded nothing. 7cc35310 gives create_device_proxy a console_lists: false flag so PC-compiled callers get real PC-shaped lists back; the GPU harnesses pass false. That covers all four (the earlier per-list failures were the same root cause).
  • One queue case the flag doesn't reach — PC GetDesc shares console slot 18 with the newer layout's GetTimestampFrequency, and the proxy deliberately serves the frequency getter while undetected (the slot-18 fix you reported). f4e0cf2b reads the GLOBAL_REALTIME desc on the real queue instead of trusting an 8-byte frequency written into a desc-shaped out-buffer.
  • hello_pixels — 3cfc666e implements the documented no-SDK path (prebuilt pair used when spirv-as is absent), and f4e0cf2b checks the SPIR-V magic so a stray vs.spv/ps.spv fails before reaching the harness rather than inside it.

f4e0cf2b compiles clean under the clang-cl/xwin toolchain; xs_proxy_mock_test still passes under Wine. The GPU sections need your hardware to confirm, but the clear-mismatch mechanism is the one your probe measured.

AI-assisted.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Offer for this pull request: the list tail slot names of D3D-445. An AI tool helped me to write and to test this change. I do not claim D3D-445, and I do not open a separate pull request. The coordinator marked D3D-445 as "waiting for #2490" (#4257 (comment)). @TreXito also offered to send this change (#4257 (comment)). @TreXito, if you already have a patch, tell us, and @NolanCotter can use the one that is better.

@NolanCotter, use this patch, change it, or ignore it. It applies to the head f4e0cf2b.

What the change does

  • It adds a table of names for the measured list tail slots. The key of the table is the slot number of the older layout (section 5.3 of docs/d3d12_xs_console_abi.md).
  • list_tail_name(slot, console_layout) uses the device-wide console_layout flag. With the newer layout, it subtracts 2 from the slot number before the lookup.
  • Thus slot 85 of the newer layout and slot 83 of the older layout both get the name CopyTextureRegionX. The other seven measured pairs (86 and 84, 87 and 85, 90 and 88, 91 and 89, 92 and 90, 95 and 93, 96 and 94) get one name for each pair. Their methods have no measured name, thus the name is tail method, older slot N.
  • A slot gets no name when the layout is not known, or when the slot is not a measured tail slot of that layout. Then the log line is the same as before. Thus slot 83 of the newer layout does not get the name CopyTextureRegionX.
  • The first-call log line of a list slot shows the name: list slot 85 (CopyTextureRegionX) first call (...).
  • The change is only for names. It does not forward a new slot. console_to_pc_list_slot is not changed. The names of slots that are not in the tail are not changed.

Files

  • runtime/shims/d3d12_xs_device.cpp: the table, list_tail_name, and one more argument for note_list_slot.
  • runtime/shims/d3d12_xs_device.h: list_tail_slot_name and the two layout constants for the tests.
  • runtime/test/xs_proxy_mock_test.cpp: check_list_tail_names.

Tests

Windows 11, MSVC 14.51, Ninja, RelWithDebInfo, NVIDIA GeForce RTX 4090. No game files.

  • xs_proxy_mock_test passes with the change.
  • Negative control: with kListTailShift set to 0, the test fails at the check list_tail_slot_name(85, newer) is CopyTextureRegionX.
  • The new checks cannot fail on the head without the change, because they call a function that the head does not have. The negative control replaces that run.
  • Full ctest at 7cc35310, with and without the change, in one build folder:
Build Tests Failures
7cc35310 133 d3d12_vulkan_device (SEGFAULT), d3d12_present, xbox_present
7cc35310 with the change 133 d3d12_vulkan_device (SEGFAULT), d3d12_present, xbox_present, and one time run_tiny_game_dir

run_tiny_game_dir failed one time in the full run with the change ("GAME: did not resolve to the game folder"). It passed in three more runs with the change. winhttp_offline failed one time in three more runs without the change. I think that these two tests are not stable on this computer when tests run in parallel. d3d12_present and xbox_present fail on this computer because of its window manager. Ignore them.

d3d12_vulkan_device stops with a SEGFAULT at 7cc35310 with and without the change. This is not related to the tail names, and your commit f4e0cf2b corrects it.

At the head f4e0cf2b with the change, I built all targets and ran these six tests: xs_proxy_mock, queue_proxy, d3d12_debug_markers, d3d12_f16_halves, d3d12_vulkan_device and run_tiny_game_dir. All six pass. I did not run the full ctest again at f4e0cf2b. The commits after 7cc35310 change only two test files, tools/hello_pixels.py and docs/hello_pixels.md.

Limits

  • The patch does not detect the layout from list calls. It reads the flag that the queue proxy sets. If a list call comes before the queue detects the layout, its log line has no name.
  • The first-call line is printed one time for each slot. If the first call comes before the layout is known, that slot keeps the line without a name.
Patch (git diff against f4e0cf2)
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp
index b5549820..3c3cf672 100644
--- a/runtime/shims/d3d12_xs_device.cpp
+++ b/runtime/shims/d3d12_xs_device.cpp
@@ -1277,14 +1277,47 @@ struct ListStats {
     static inline std::atomic<bool> first[kListSlots];
 };
 
-void note_list_slot(unsigned slot, std::uint64_t a1, std::uint64_t a2, std::uint64_t a3, std::uint64_t a4) {
+// The list tail (D3D-445). From CopyTextureRegionX on, the newer console layout sits two slots later than the older
+// one (docs/d3d12_xs_console_abi.md 5.3). The table is keyed by the older-layout slot. Only CopyTextureRegionX has a
+// measured name; the other measured pairs are named by their older slot, so that both layouts print the same text
+// for the same method.
+struct ListTailName {
+    unsigned older_slot;
+    const char* name;
+};
+constexpr ListTailName kListTailNames[] = {
+    {83, "CopyTextureRegionX"},         {84, "tail method, older slot 84"}, {85, "tail method, older slot 85"},
+    {88, "tail method, older slot 88"}, {89, "tail method, older slot 89"}, {90, "tail method, older slot 90"},
+    {93, "tail method, older slot 93"}, {94, "tail method, older slot 94"},
+};
+constexpr unsigned kListTailShift = 2;
+static_assert(kConsoleLayoutOlder == ChildProxy::kQueueLayoutOlder &&
+                  kConsoleLayoutNewer == ChildProxy::kQueueLayoutNewer,
+              "the list tail names use the queue proxy's layout values");
+
+// Null while the layout is unknown, and for a slot that is not a measured tail slot of that layout: a slot number
+// never gets the other layout's name.
+const char* list_tail_name(unsigned slot, unsigned char console_layout) {
+    if (console_layout != kConsoleLayoutOlder && console_layout != kConsoleLayoutNewer) return nullptr;
+    const unsigned shift = console_layout == kConsoleLayoutNewer ? kListTailShift : 0;
+    if (slot < shift) return nullptr;
+    for (const ListTailName& entry : kListTailNames)
+        if (entry.older_slot == slot - shift) return entry.name;
+    return nullptr;
+}
+
+void note_list_slot(unsigned slot, std::uint64_t a1, std::uint64_t a2, std::uint64_t a3, std::uint64_t a4,
+                    unsigned char console_layout = 0) {
     if (slot >= kListSlots) return;
     ListStats::hits[slot].fetch_add(1, std::memory_order_relaxed);
     bool expected = false;
-    if (ListStats::first[slot].compare_exchange_strong(expected, true, std::memory_order_relaxed))
-        std::fprintf(stderr, "[rt] d3d12_xs: list slot %u first call (args 0x%llx 0x%llx 0x%llx 0x%llx)\n", slot,
-                     static_cast<unsigned long long>(a1), static_cast<unsigned long long>(a2),
-                     static_cast<unsigned long long>(a3), static_cast<unsigned long long>(a4));
+    if (ListStats::first[slot].compare_exchange_strong(expected, true, std::memory_order_relaxed)) {
+        const char* name = list_tail_name(slot, console_layout);
+        std::fprintf(stderr, "[rt] d3d12_xs: list slot %u%s%s%s first call (args 0x%llx 0x%llx 0x%llx 0x%llx)\n", slot,
+                     name ? " (" : "", name ? name : "", name ? ")" : "", static_cast<unsigned long long>(a1),
+                     static_cast<unsigned long long>(a2), static_cast<unsigned long long>(a3),
+                     static_cast<unsigned long long>(a4));
+    }
 }
 
 // The interfaces the console list answers: the base chain, ID3D12CommandList and every graphics-command-list
@@ -1373,7 +1406,7 @@ std::uint64_t WINAPI list_slot(ListProxy* self, std::uint64_t a1, std::uint64_t
         return hr_to_u64(proxy_query_interface(self->device, reinterpret_cast<const IID*>(a1),
                                                reinterpret_cast<void**>(a2)));
     } else {
-        note_list_slot(Slot, a1, a2, a3, a4);
+        note_list_slot(Slot, a1, a2, a3, a4, self->device->console_layout.load(std::memory_order_relaxed));
         constexpr unsigned pc = console_to_pc_list_slot(Slot);
         if constexpr (pc == kListNotForwarded) {
             if constexpr (Slot == kConsoleAllocateUpload) {
@@ -2004,6 +2037,9 @@ ID3D12CommandList* list_proxy_real_list(const void* list) {
     return static_cast<const ListProxy*>(list)->real;
 }
 
+const char* list_tail_slot_name(unsigned slot, unsigned char console_layout) {
+    return list_tail_name(slot, console_layout);
+}
 std::uint64_t list_slot_hits(unsigned slot) {
     return slot < kListSlots ? ListStats::hits[slot].load(std::memory_order_relaxed) : 0;
 }
diff --git a/runtime/shims/d3d12_xs_device.h b/runtime/shims/d3d12_xs_device.h
index a23ac061..76bbf537 100644
--- a/runtime/shims/d3d12_xs_device.h
+++ b/runtime/shims/d3d12_xs_device.h
@@ -118,6 +118,15 @@ bool is_allocator_proxy(const void* allocator);
 bool is_list_proxy(const void* list);
 ID3D12CommandList* list_proxy_real_list(const void* list);
 std::uint64_t list_slot_hits(unsigned slot);
+// The diagnostic name of a command-list slot on the list tail, where the newer console layout sits two slots later
+// than the older one from CopyTextureRegionX on (docs/d3d12_xs_console_abi.md 5.3: newer->older pairs 85->83,
+// 86->84, 87->85, 90->88, 91->89, 92->90, 95->93, 96->94). `console_layout` is the device-wide layout the queue
+// proxy detects (kConsoleLayoutOlder or kConsoleLayoutNewer). Null when the layout is not known yet or the slot is
+// not a measured tail slot of that layout, so that a slot number is never given the other layout's name. Naming
+// only: no slot is forwarded because of it.
+inline constexpr unsigned char kConsoleLayoutOlder = 1;
+inline constexpr unsigned char kConsoleLayoutNewer = 2;
+const char* list_tail_slot_name(unsigned slot, unsigned char console_layout);
 // The wrapped allocator (no reference added), or null when `allocator` is not an allocator proxy.
 ID3D12CommandAllocator* allocator_proxy_real_allocator(const void* allocator);
 unsigned allocator_proxy_slot_count(const void* allocator);
diff --git a/runtime/test/xs_proxy_mock_test.cpp b/runtime/test/xs_proxy_mock_test.cpp
index f0958452..e99702c8 100644
--- a/runtime/test/xs_proxy_mock_test.cpp
+++ b/runtime/test/xs_proxy_mock_test.cpp
@@ -925,6 +925,43 @@ int run_fault_mode(const char* mode) {
     return 2;
 }
 
+// ---- 9. List tail slot names (D3D-445) ---------------------------------------------------------------------
+// From CopyTextureRegionX on, the newer layout sits two slots later than the older one (d3d12_xs_console_abi.md
+// 5.3). A diagnostic name follows the device-wide layout, so slot 85 of the newer layout and slot 83 of the older
+// layout are both CopyTextureRegionX, and neither number gets that name under the other layout.
+
+int check_list_tail_names() {
+    const unsigned char older = xs::kConsoleLayoutOlder, newer = xs::kConsoleLayoutNewer;
+    const auto same = [](const char* a, const char* b) { return a && b && std::strcmp(a, b) == 0; };
+    EXPECT(same(xs::list_tail_slot_name(83, older), "CopyTextureRegionX"));
+    EXPECT(same(xs::list_tail_slot_name(85, newer), "CopyTextureRegionX"));
+    // The same numbers under the other layout are different methods.
+    EXPECT(!xs::list_tail_slot_name(83, newer));  // not a measured slot of the newer layout
+    EXPECT(xs::list_tail_slot_name(85, older) && !same(xs::list_tail_slot_name(85, older), "CopyTextureRegionX"));
+    // Every measured newer->older pair has one name, and the eight names differ.
+    const unsigned pairs[][2] = {{85, 83}, {86, 84}, {87, 85}, {90, 88}, {91, 89}, {92, 90}, {95, 93}, {96, 94}};
+    for (const auto& pair : pairs) {
+        EXPECT(same(xs::list_tail_slot_name(pair[0], newer), xs::list_tail_slot_name(pair[1], older)));
+        for (const auto& other : pairs)
+            EXPECT(pair[1] == other[1] ||
+                   !same(xs::list_tail_slot_name(pair[1], older), xs::list_tail_slot_name(other[1], older)));
+    }
+    // Slots outside the measured set have no tail name in either layout, and no slot has one before the layout is
+    // known: the log then prints the slot number only, as before.
+    for (unsigned slot = 0; slot < 160; ++slot) {
+        bool older_tail = false, newer_tail = false;
+        for (const auto& pair : pairs) {
+            newer_tail = newer_tail || slot == pair[0];
+            older_tail = older_tail || slot == pair[1];
+        }
+        EXPECT((xs::list_tail_slot_name(slot, older) != nullptr) == older_tail);
+        EXPECT((xs::list_tail_slot_name(slot, newer) != nullptr) == newer_tail);
+        EXPECT(!xs::list_tail_slot_name(slot, 0));
+        EXPECT(!xs::list_tail_slot_name(slot, 3));
+    }
+    return 0;
+}
+
 }  // namespace
 
 // A failure ends the process with a message on stderr, never in a dialog a test run would wait on: abort() (an
@@ -946,7 +983,8 @@ int main(int argc, char** argv) {
     if (argc == 2) return run_fault_mode(argv[1]);
     if (argc != 1) return 2;
     if (check_tail(true) || check_levels() || check_fence1() || check_create_failures() || check_open_shared() ||
-        check_alloc_failures() || check_allocators() || check_lists() || check_signalx_detection())
+        check_alloc_failures() || check_allocators() || check_lists() || check_signalx_detection() ||
+        check_list_tail_names())
         return 1;
     std::printf("xs_proxy_mock_test: PASS (%d allocations refused on purpose)\n", g_failed_news);
     return 0;

D3-445, contributed by shdann (tested on Windows 11, MSVC 14.51, RTX
4090; xs_proxy_mock passes, negative control fails as designed).

From CopyTextureRegionX on, the newer console layout sits two slots
later than the older one (docs/d3d12_xs_console_abi.md 5.3). A table
keyed by the older-layout slot gives every measured pair one name, so
list slot 85 under the newer layout and 83 under the older both log
"CopyTextureRegionX"; the seven unmeasured pairs print "tail method,
older slot N". A slot gets no name while the layout is unknown or when
it is not a measured slot of that layout, so a number never wears the
other layout's name. Naming only - console_to_pc_list_slot and the
forwarding are untouched.

Co-Authored-By: shdann <28006689+shdann@users.noreply.github.com>

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@NolanCotter

Copy link
Copy Markdown
Contributor Author

@shdann Patch applied as 9b693ecd — taken as-is, it's clean work: the table keyed on the older-layout slot, the -2 shift under newer, no naming before detection or for unmeasured slots, and check_list_tail_names covering the pair set and the 0-159 sweep. Credited to you in the commit trailer.

Also noting your 7cc35310 CTest data: the d3d12_vulkan_device SEGFAULT matches the mechanism behind f4e0cf2b — PC GetDesc is a struct-return call expecting the out-buffer back in rax, and the undetected slot-18 path was answering the frequency getter instead. That commit makes the test read the desc on the real queue.

Built under clang-cl/xwin and xs_proxy_mock_test passes under Wine, check_list_tail_names included.

@TreXito — shdann's patch landed first since it arrived complete and tested; if yours covers something it doesn't (names beyond the measured pairs, or layout detection from list calls), happy to take a follow-up.

AI-assisted.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

Taken — thank you (and noted @TreXito's standing offer; shdann's landed first). The patch is in at 9b693ecd, verbatim with your co-author credit (AI-assisted as you noted).

Reviewed it on the merits before applying — the eight pairs match docs §5.3 exactly, the subtract-shift-then-lookup approach means a slot number can never wear the other layout's name, and naming-only keeps it zero-risk for the forwarding path. Verified here under Wine on the clang-cl/xwin build: xs_proxy_mock_test PASS including check_list_tail_names, loader_test 87/0. The documented limits (no name before detection; first-call line keeps whatever it printed) are the right trade for a diagnostic — the alternative of keying names off per-call heuristics would risk mislabeling, which is worse than no name.

Also confirmed your read on d3d12_vulkan_device: the SEGFAULT was the GetDesc/frequency collision on undetected slot 18, corrected in f4e0cf2b by reading the desc on the real queue. With that plus the console_lists fix, the six tests you ran at f4e0cf2b passing is exactly the expected state.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested f4e0cf2 on NVIDIA GeForce RTX 4090 (driver 32.0.16.2101), Windows 11, MSVC 14.51: the full CTest result now has the same status as main 03b09a08 for every test that the two have.

  • This head: 122 pass, 2 fail, 9 skip, 1 disabled. Main: 123 pass, 2 fail, 9 skip, 1 disabled (main also has large_module_gate).
  • The four regressions from my earlier comment pass now: d3d12_vulkan_device, d3d12_debug_markers, d3d12_f16_halves and queue_proxy.
  • d3d12_present and xbox_present fail at the same window-size checks as on main (a window-manager effect on this computer).
  • With LEONIDA_VK_DEVICE=Radeon (AMD Radeon(TM) Graphics, driver 32.0.21043.5001), the eight proxy and device tests that I repeated pass.
  • The ten changed Python test files: 205 passed, 5 skipped. tools/hello_pixels.py --size 512 --run --check with the prebuilt synthetic shaders passes on the two GPUs; a pair with four invalid bytes per file fails before the harness starts, which is correct.

This result is for f4e0cf2. The new commit 9b693ec (names for the tail slots) is not included. AI-assisted.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

@shdann Confirmed on our side too — parity with 03b09a08 on every shared test, the four regressions cleared, and the two present failures matching main's known window-manager behavior is the right result. Thanks for running the AMD pass and the invalid-.spv negative check as well.

9b693ecd on top is naming-only for the tail slots (your patch — xs_proxy_mock already covers it, no forwarding touched), so a re-run shouldn't be needed unless you want the first-call log lines verified on hardware.

AI-assisted.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

That closes the round — thank you for the thorough verification (AI-assisted reply).

Parity confirmed: all four regressions resolve, the present tests return to the known window-manager failures, and the dual-GPU re-run + Python suite are clean. 9b693ecd is names-only (verified independently under Wine here and in your own xs_proxy_mock run), so this f4e0cf2b result covers the behavioral surface.

Current head state: every console-ABI change in this PR is now mock-verified and hardware-verified — SignalX detection, slot-18 disambiguation, the PC/console list separation, the S_OK queue tail, and the atomic layout cache.

@2-CD

2-CD commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Windows + GPU check (independent). Hardware: NVIDIA GeForce RTX 5080 + RTX 3070 Ti (driver 621.01) and AMD Radeon 610M iGPU (Ryzen 9 9950X3D, driver 32.0.13018.6). OS: Windows 11. Toolchain: MSVC (VS BuildTools 18) + Ninja, single-config RelWithDebInfo; llvm-mc 21.1.8; SPIRV-Tools (spirv-as/spirv-val). Configured with -DLEONIDA_LLVM_MC and -DLEONIDA_SPIRV_AS/VAL so the shader-fixture GPU tests register.

Tested head 9b693ec (base aa2988c, which is 4 commits behind current main 03b09a0; this head does not carry large_module_gate).

Build: 252/252 targets, 0 errors/warnings. The author's caveat (pe_loader.cpp / registry.cpp / d3d12_xs_device.cpp are Windows-only C++ not compiled on the Linux author box) is resolved - all of it compiles and links clean on MSVC.

Targeted PR tests, --repeat until-fail:3 on the RTX 5080 (12 tests x3 = 36 runs, all pass): loader, unimplemented_policy, queue_proxy, xs_proxy_mock (no_reserve / no_protect / no_handler), d3d12_vulkan_device, d3d12_debug_markers. The three regressions flagged earlier in this thread (d3d12_vulkan_device SEGFAULT, d3d12_debug_markers, queue_proxy) are green x3 here.

New Python suites (the PR's added/changed test files): test_import_inventory, test_hello_pixels, test_make_game_shader_state, test_run_gpu_tests_helpers, test_viewer_serve, test_spirv_interface, test_wave64_halves_operands - 218 tests OK, 5 skipped (the end-to-end GPU-draw cases). New semantic fixtures (test_scalar_cmpk_wqm, test_valu_f16_trans, test_valu_f32_unary, test_alu_int_misc): 30 OK.

Full runtime suite, ctest -C RelWithDebInfo -j 6, excluding the 4 windowed present tests:

  • RTX 5080: 149 run, 149 passed, 0 failed; 10 skipped/disabled (game-file corpus, bink, fsr, rgb9e5, first_light, vk_sync_validation, hw-oracle, SDL3 gameinput).
  • Radeon 610M iGPU (LEONIDA_VK_DEVICE=Radeon): 149 run, 149 passed, 0 failed; 10 skipped/disabled.
    (My build registers more tests than a plain -DLEONIDA_VULKAN_HEADERS_FETCH=ON configure because the shader-fixture GPU tests are enabled here.)

Windowed present tests, run serially --repeat until-fail:3 on each GPU: d3d12_present and xbox_present pass x3 on both the RTX 5080 and the Radeon 610M. (On shdann's box these two hit the known window-manager size failures; they present cleanly here.)

hello_pixels.py --run --check (the PR's new package-free pixel tool), 512x512, against the built vk_harness.exe:

  • RTX 5080 (subgroup 32..32): exit 0, coverage + probe oracle pass; enabled VK_KHR_shader_fma, fragment_shader_barycentric, fragment_shader_interlock, maintenance8.
  • Radeon 610M (subgroup 32..64): exit 0, oracle pass; enabled barycentric + interlock (no shader_fma / maintenance8 on this driver) - a cross-vendor pass.

Full semantic suite (CPU), python -m unittest discover -s tests/semantic:

Net: the PR's unstable CI state did not reproduce locally on either GPU. The Windows-only loader / shim / D3D12-ABI changes compile clean and the loader / queue / proxy tests are green x3; full-suite parity with main on both GPUs; the new pixel tool passes on NVIDIA and AMD.

Synthetic fixtures only, no game files. AI-assisted (opencode); runs on my machine.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

Thank you — an impressively thorough pass (AI-assisted reply).

Two of your data points settle open questions from this thread:

The cross-vendor hello_pixels result is also a good early signal for the descriptor/extension probing: the same draw path picks a different extension set on Radeon (barycentric + interlock, no shader_fma/maintenance8) and still lands the oracle. That is the behavior the real title will depend on.

Between your run and shdann's, every console-ABI change in this PR is now hardware-verified on three NVIDIA cards and two AMD iGPUs, at CTest parity with main.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

@2-CD Thank you — that's thorough coverage. The 252-target MSVC build clears the Linux-author caveat, the x3 repeats on both vendors settle the earlier regressions, and the present tests passing on your box confirms the window-manager explanation for shdann's failures rather than a code issue. The identical semantic failure set vs 03b09a08 is expected — those belong to #3883/#3995/#4004/#3885.

Good data point on the Radeon 610M feature set too (barycentric + interlock but no shader_fma/maintenance8) — the cross-vendor paths in hello_pixels holding up there is exactly what it's for.

AI-assisted.

@Vonsek

Vonsek commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 9b693ec 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). Full MSVC build of this head, then the whole ctest (154 tests) on each GPU: Radeon 153/153 passed and RTX 5080 153/153 passed, 0 failed (skipped as on main: shader_library_corpus, bink_decode, bink_play_headless, fsr_dispatch, bvh_builder, bink_audio, vk_sync_validation, d3d12_first_light, plus d3d12_rgb9e5_rtv on the 5080; gameinput not built). python -I tools/hello_pixels.py --run --check with LEONIDA_VK_HARNESS set to the built vk_harness: exit 0 on both (device lines: AMD Radeon(TM) Graphics (subgroup 32..64), NVIDIA GeForce RTX 5080 (subgroup 32..32); 256x256 image written, the check printed nothing else). pytest on the new/changed Python tests (test_hello_pixels, test_import_inventory, test_make_game_shader_state, test_run_gpu_tests_helpers, test_viewer_serve, test_wave64_halves_operands, test_alu_int_misc, test_scalar_cmpk_wqm, test_valu_f16_trans, test_valu_f32_unary): 209 passed, 1 skipped. No game files.

AI-assisted.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

Thank you — third independent green at 9b693ecd (AI-assisted reply).

The RDNA2 result carries extra weight for this PR specifically: the console's GPU is RDNA2, so a 153/153 on a desktop RDNA2 part means the descriptor encoding, barrier paths, and subgroup handling the console-ABI layer feeds into are verified on the target's own ISA family — not just on NVIDIA and newer-AMD hardware.

That puts the current head at three independent testers, five GPUs (RTX 4090, RTX 5080, RTX 3070 Ti, Radeon 610M, Radeon RDNA2 iGPU), all at parity with main.

@NolanCotter

Copy link
Copy Markdown
Contributor Author

@Vonsek Thanks — 153/153 on both the RDNA2 iGPU and the 5080 at 9b693ecd closes the loop on the tail-names commit too (it was naming-only but hadn't had a full-suite run on hardware until now). Three independent multi-GPU validations at parity with main now.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants