Skip to content

Tests: a console compute shader through the D3D12.X PSO hook, dispatched and read back - #78

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:compute-e2e
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:compute-e2e

Conversation

@gefydev

@gefydev gefydev commented Nov 23, 2026

Copy link
Copy Markdown
Member

A test with no synthetic shortcut between the title and the GPU: crates/xcl/tests/gpu_compute_e2e.rs builds a console compute shader in the retail container layout (DXBC with a DXIL part, XDAT, XBCH/zlib, FSSM with the CS stage descriptor and COMPUTE_PGM_RSRC2) and gives it to CreateComputePipelineState on the backend device, as a title would. Then it dispatches the PSO the hook built and checks the memory.

The program is wave64, 128 threads per group (two waves). Each thread writes its global (x, y) from TGID and the thread ids, then reads the value of the mirrored thread through LDS after s_barrier, which is in the other wave. The test waits for the background build (pso_async::resolve_wait) and requires translated_pipelines to go up by one, so it cannot pass on a stand-in or a fallback.

runner::dispatch is split so that its body is reusable: dispatch_on(dev, pso, rs, ...) runs a pipeline and root signature built elsewhere. dispatch itself is unchanged.

On a 32-lane GPU this test needs #70. Without it, the driver rejects the pipeline:

PSO was not built from the translated shader: ["the driver rejected the compute PSO with the translated CS (0x80070057)"]

Validation on Windows 11, GTX 1650 (driver 32.0.16.2124), full workspace with --no-fail-fast:

I don't have an RDNA card, so it is not run on a native wave64 GPU yet.

It merges cleanly with #70, #71 and #72 in either order.

…hed and read back

A wave64 compute program in the retail container layout (DXBC/DXIL part,
XDAT, XBCH, FSSM with a CS stage descriptor) goes through the backend's
CreateComputePipelineState hook, then is dispatched with runner::dispatch_on
and its memory is checked: per-thread ids, TGID, LDS and s_barrier across the
two waves of a group. The translated-pipeline counter is checked, so a
fallback path cannot pass.

runner::dispatch now shares its body with dispatch_on, which takes a
pipeline and root signature built elsewhere.
@certified-retart

Copy link
Copy Markdown
Contributor

Tested 31a4001 on Windows 10 (D3D12 Agility SDK 1.620.2 / DXC 10.0.26100.0) across both wave64 AMD and wave32 NVIDIA GPUs:

Head's up on merge order: either merging PR #70 before #78, or skipping when the adapter lacks wave64 without wave32 compute translation, will keep cargo test green on NVIDIA GPUs.

@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Merged. On a native wave64 GPU (RX 9070) it passes, and also with XCL_SPLIT_WAVE64=1: #67 (merged instead of #70) runs wave64 compute on 32-lane GPUs, so it should pass on NVIDIA now too. Your 16×8 group also exercises a fix found on AMD: the driver lays 2-D groups out in 2×2 quads, so the native form now hands console thread ids to waves in arrival order (46a1c3f). Tested on Windows 11 with an RX 9070 (RDNA4): cargo test --workspace green with the retail samples (shader pack, console DLLs, texture archive), also with XCL_SPLIT_WAVE64=1 (the 32-lane split path forced on RDNA). Unicorn Overlord and XDefiant run with this round merged. Thanks!

Michael-Glaser added a commit to Michael-Glaser/xcl that referenced this pull request Nov 24, 2026
…cl-dev#104)

On newer GDK runtimes (QUEUE_SHIFTED), 20 command list console methods shift up by +2 via NEWER_LIST_SLOTS, leaving 11 older slots (xcl-dev#59, xcl-dev#60, xcl-dev#68, xcl-dev#69, xcl-dev#78, xcl-dev#81, xcl-dev#84, xcl-dev#88, xcl-dev#89, xcl-dev#93, xcl-dev#94) without another shifted method taking their old index. Those slots remained wired directly to the older layout's handlers, so a newer-layout call hit the wrong method.

Wrap those orphaned slots in make_layout_split so newer-layout title calls go to a logged stub while older-layout titles keep the handler and non-title callers keep their PC target (including cl_execute_indirect at xcl-dev#59 and the original base-table stub for slots >= scanned). Slot xcl-dev#10 (Reset) stays Reset on both layouts and is not orphaned.

Assisted-by: Antigravity (Gemini 4 Neon)
vincentes added a commit to vincentes/xcl-wasm that referenced this pull request Nov 24, 2026
In the software D3D12.X device:

- The console's frame clock (device xcl-dev#78–xcl-dev#81): SetFrameIntervalX,
  ScheduleFrameEventX, WaitFrameEventX (the origin hands out the frame's
  token; S_FALSE at the timeout) and GetFrameStatisticsX, on guest time.
  The ancillary handles of an event are not signalled.
- PresentX (queue xcl-dev#30) goes through the queue like everything else; when
  the queue gets to it the frame is flipped for the statistics and the
  back buffer's memory is kept as `d3d.frame` (width, height, format,
  pixels) for the host to show. Textures are linear in this device: the
  console's tiling is not modelled.
- ClearRenderTargetView (list xcl-dev#52) fills a target of 8 bits a channel;
  CreateRenderTargetView remembers which resource a descriptor shows.
- The device answers QueryInterface for IDXGIDevice / 1 / 2 with an
  object of that layout; its adapter has the device's LUID and no output.

Measured on macOS (aarch64): the test title's "frame clock + PresentX of
the title's back buffer" passes, 41 checks in all. `cargo test -p
xcl-guest`: 47 passed, 0 failed, run on the staged tree in a separate
copy: the working tree does not build at the moment (another agent's
half-written crates/xcl/src/hle/export_names.rs).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Michael-Glaser added a commit to Michael-Glaser/xcl that referenced this pull request Nov 24, 2026
…vall#104)

On newer GDK runtimes (QUEUE_SHIFTED), 20 command list console methods shift up by +2 via NEWER_LIST_SLOTS, leaving 11 older slots (ivall#59, ivall#60, ivall#68, ivall#69, ivall#78, ivall#81, ivall#84, ivall#88, ivall#89, ivall#93, ivall#94) without another shifted method taking their old index. Those slots remained wired directly to the older layout's handlers, so a newer-layout call hit the wrong method.

Wrap those orphaned slots in make_layout_split so newer-layout title calls go to a logged stub while older-layout titles keep the handler and non-title callers keep their PC target (including cl_execute_indirect at ivall#59 and the original base-table stub for slots >= scanned). Slot ivall#10 (Reset) stays Reset on both layouts and is not orphaned.

Assisted-by: Antigravity (Gemini 4 Neon)
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
…ep-88)

Doc-only. The synthetic title has zero static d3d12 imports (dynamic
d3d12_xs.dll load); console slots are reached by raw vtable index via
xslot (tests/testtitle/src/gpu.rs:108). Queue ordered per
keep-d3d12-behavior.md K-D3D-06 with in-tree caller refs; next
unrouted slot is queue xcl-dev#30 PresentX + device xcl-dev#78-81 frame clock,
consumer present_x_frame (gpu.rs:312) — the M1 first-frame gate,
behind XCL_VULKAN_BACKEND (null stays default). Full spec table in
.ralph/specs/linux-port/m1-slot-queue.md (loop-local). Retail
SKIPPED (drive unmounted).
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 27, 2026
…81 stay unrouted (zero d3d12 on abort path)

Retail abort path still issues no console-slot calls (SIGSEGV +0x2237320,
20 stubs zero d3d12), so routing moves nothing; Linux PresentX needs a
frame_linux twin + windowed present when the frontier gets there.
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 27, 2026
…nd backend

1d split 1 of 2 (honest split: route halves stay under the line budget).
Device frame-clock slots route on Vulkan objects only: xcl-dev#78
SetFrameIntervalX, xcl-dev#79 ScheduleFrameEventX (with ancillary handle routing),
xcl-dev#80 WaitFrameEventX, xcl-dev#81 GetFrameStatisticsX — thin adapters over the Linux
twin (d3d12x_frame_linux). register_ancillary remembers the schedule block's
handles per type (E_INVALIDARG past the 63-handle cap, like Windows; Linux
trusts the block — readable() is windows-only); the clock thread signals
each with kernelx SetEvent at fire. Unscheduling clears. Null device keeps
logging stubs: no behavior change while XCL_VULKAN_BACKEND is unset. Queue
xcl-dev#30 PresentX + the real present follow in 1d(ii).

Failing-first: the routing test failed pre-fix (E0599 no VulkanQueue;
then E_FAIL at xcl-dev#81 with PresentX still stubbed); passes now (slots +
ancillary-signal asserts, serialised on CLOCK_SERIAL with the twin's tests).
Gates: check -p xcl --tests EXIT 0 (40 pre-existing warnings, none new);
check --workspace EXIT 0; lib 794 passed/0 failed/1 ignored (+1 new).
Title e2e + retail controls run at 1d(ii).
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 27, 2026
…nd backend

1d split 2 of 2 (honest split: a real WSI staging present is indivisible
at ~350 lines — slicing further would leave dead code or fake success).
Queue xcl-dev#30 PresentX routes on Vulkan queues only (VulkanQueue from a Vulkan
device; null queues keep the logging stub): plane 0's resource bytes
(R8G8B8A8 2D texture; committed Map backing or placed title memory,
unmodelled shapes present nothing) upload through the new
vulkan_present::present_rgba_image — X window + swapchain, staging-buffer
copy, one acquire/submit/present — then mark_flipped(token) for xcl-dev#81.
Headless ('no ' display/WSI/device) still flips + S_OK: a console present
never fails. Null default unchanged.

Failing-first: the 1d routing test failed pre-route (E_FAIL at xcl-dev#81, no
flip); passes now end to end (set/schedule/wait/token/present/stats), and
present_rgba_image proved REAL on hardware (Intel Arc split-32, 2x2 frame
presented in 0.11s, no SKIPPED).
Gates: check -p xcl --tests EXIT 0 (40 pre-existing warnings, none new);
check --workspace EXIT 0; lib 795 passed/0 failed/1 ignored
(--test-threads=4; default-thread full runs flake pre-existing, base too).
Title e2e delta 0 (12 FAILs null, stashed baseline 12; 10 on Vulkan, both
baselines); FAIL #2 still-failing: the title dies at DXGI GetAdapter/GetDesc
before reaching the routed slots (no xcl-dev#78/PresentX in xcl.log) — next slice.
Retail HOLDS (SIGSEGV exe+0x2237320, exit 139, called_stubs 20, 0 d3d12,
xgr exactly XAsync/XNetworking/XUser).
rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 27, 2026
Part 1 of an honest split (197 lines): a Vulkan device answers the DXGI
device IIDs with a wrapper (Kind::DxgiDevice, holding the device) whose
slot 7 returns an adapter (Kind::DxgiAdapter) whose slot-8 GetDesc carries
the device's LUID (== Device_GetAdapterLuid) plus the Vulkan adapter name,
so the title's IDXGIDevice1 path reaches the routed xcl-dev#78-81/xcl-dev#30 slots. The
null device keeps answering queries with itself: no behavior change while
XCL_VULKAN_BACKEND is unset. IIDs are written-out windows-crate GUID bytes
(verified against the registry source); unknown IIDs get E_NOINTERFACE,
never the device. EnumOutputs/output objects follow in part 1b (slot 7 is
the DeviceChild default until then — tolerated, SetFrameIntervalX ignores
the output).

Failing-first: the new routing test failed pre-change (no Dxgi kinds/IIDs);
passes now (null QI pinned to self, wrapper identity, D3D12 round trip,
LUID match, slots 78-81 route instead of stubbing).
Gates: check -p xcl --tests EXIT 0 (no warnings naming this file);
check --workspace EXIT 0; lib 796 passed/0 failed/1 ignored
(--test-threads=4; +1 new). Title e2e, fresh roots: null 13 FAILs,
byte-identical to the stashed baseline (argv path artifact only);
Vulkan 11->10, the frame-clock + PresentX FAIL is gone and xcl.log shows
'D3D12.X Vulkan: presented 640x360 (token 0x1)' on Intel Arc Split32.
Retail HOLDS (SIGSEGV exe+0x2237320, exit 139, called_stubs 20, 0 d3d12).
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.

3 participants