Skip to content

Olympus: harden DXIL cache identity and validation - #9

Merged
ivall merged 5 commits into
xcl-dev:mainfrom
bmjask:codex/olympus-dxil-cache
Nov 21, 2026
Merged

ivall merged 5 commits into
xcl-dev:mainfrom
bmjask:codex/olympus-dxil-cache

Conversation

@bmjask

@bmjask bmjask commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • validate freshly compiled DXIL before caching or returning it
  • include the actual loaded DXC toolchain metadata in cache identity
  • normalize cache aliases before disk, in-process flight, and named-mutex coordination
  • use file size and modification time rather than hashing entire toolchain binaries

Validation

  • DXIL cache tests: 8 passed
  • xcl library tests: 203 passed, 13 ignored, 0 failed

This is the fresh, narrowly scoped follow-up requested after the reviewed media/package PR. It contains no package decryption or DRM handling.

@ivall
ivall merged commit 895abb0 into xcl-dev:main Nov 21, 2026
@ivall

ivall commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks – merged. Size + mtime for the toolchain id is exactly it. Note for anyone pulling: the cache key changes, so the DXIL cache rebuilds once.

ivall added a commit that referenced this pull request Nov 21, 2026
From slot 44 on the console device's vtable holds its extensions; a title
call there no longer runs the PC method at that index.

- CreatePlacedResourceX (#44): buffers at title addresses in unified
  memory are placed in that memory (GPU VA = the address)
- CreateCommandQueueX (#48) / CreateCommandListX (#73) and #8 / #9 / #12:
  the DMA type and list IID, console queue priorities
- graphics PSO X (#60), CreatePipelineState (#86), CreateSamplerX (#61),
  GetCopyableFootprints (#38) and command signatures (#41) with console
  descs, descriptor heap type 4
- SetDebugFlagsX, pipeline (de)serialisation, page pools; any other
  extension slot is a logged S_OK stub
- test title: a DMA copy of a buffer placed at its own graphics memory
ivall added a commit that referenced this pull request Nov 21, 2026
From runs of the user's XDefiant dump (each was a stop of the title after a
failed D3D12 call):
- D: is mounted on the game folder by default (d:\hunter\...); new default
  mounts are merged into existing configs;
- the title's unhandled-exception filter goes behind XCL's; crash records
  have all registers, the vtable module of the objects they point at and
  the callers on the stack;
- CheckFeatureSupport with the console's larger structures (D3D12_OPTIONS
  0x40 bytes) is retried with the PC size;
- device #25 GetResourceAllocationInfo called the C way (return buffer
  first) no longer writes over the device;
- the DMA list has its own vtable: Close #9, Reset #10, CopyBufferRegion
  #11, CopyTextureRegion #12, CopyResource #13, CopyTiles #14;
- the PC runtime writes its vtable into a copy list on Reset: XCL's is put
  back;
- device #27 CreateCommittedResource from console code: buffers and
  textures in unified memory (the title clears a texture through its GPU
  address).
It now stops where the title's inline D3D12.X code writes graphics records
into the command list object. Diagnostics: XCL_WATCH_DEVICE / XCL_WATCH_DMA
(hardware write watchpoints), XCL_D3D12_DEBUG (debug layer messages into
the log).

Console shader kernels: local arrays indexed per lane, switch in nested
loops, 16-bit floats and integers (11 kernels, all the same as the PC).
Lum7nt added a commit to Lum7nt/xcl that referenced this pull request Nov 23, 2026
… and add console stubs

Scarlett GDK uses subobject type 23 for Amplification Shaders (AS) and 24 for Mesh Shaders (MS), whereas PC Direct3D 12 uses slot 24 for AS and 25 for MS. Console streams passing an MS container in slot 24 previously failed pipeline stream translation as an unsupported AS, returning E_INVALIDARG.

- Disambiguate slot 24 in real.rs and null.rs by checking shader container stage and NGG hardware stage.
- Direct console slot 24 MS containers to mesh shader translation and fallback.
- In fallback_stream, rewrite console slot 24 to PC slot 25 with dummy mesh bytecode so PC drivers accept the SM 6.5 stream.
- Add unit tests for subobject payload and fallback stream rewriting.
- Add console stubs for command list xcl-dev#75, xcl-dev#126, #131, xcl-dev#132, xcl-dev#142, allocator xcl-dev#9, and queue xcl-dev#31 extension.
heretic1321 pushed a commit to heretic1321/xcl that referenced this pull request Nov 23, 2026
… and add console stubs

Scarlett GDK uses subobject type 23 for Amplification Shaders (AS) and 24 for Mesh Shaders (MS), whereas PC Direct3D 12 uses slot 24 for AS and 25 for MS. Console streams passing an MS container in slot 24 previously failed pipeline stream translation as an unsupported AS, returning E_INVALIDARG.

- Disambiguate slot 24 in real.rs and null.rs by checking shader container stage and NGG hardware stage.
- Direct console slot 24 MS containers to mesh shader translation and fallback.
- In fallback_stream, rewrite console slot 24 to PC slot 25 with dummy mesh bytecode so PC drivers accept the SM 6.5 stream.
- Add unit tests for subobject payload and fallback stream rewriting.
- Add console stubs for command list xcl-dev#75, xcl-dev#126, #131, xcl-dev#132, xcl-dev#142, allocator xcl-dev#9, and queue xcl-dev#31 extension.
ivall pushed a commit that referenced this pull request Nov 23, 2026
Console code calls descriptor heap #9 / #10 (GetCPU / GetGPUDescriptorHandleForHeapStart)
with only `this` and takes the handle in rax, as the real backend already answers it
(real.rs heap_cpu_start_x). The null device used the PC form and wrote the handle through
rdx, whatever the caller had left there. Under Wine 11.22 with no D3D12 device (no GPU),
the test title runs its GPU checks on the null device: its rdx pointed into its read-only
.rdata and the title ended with 0xC0000005 in Heap_GetHandleStart (where rdx happens to
be writable, the stray write goes unnoticed). The handle now comes back in rax and rdx is
not touched. Windows: the same for the null device (no D3D12 device or graphics = "null");
the real backend is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019twRmXSjLgBbFAokwc63ad
ivall pushed a commit that referenced this pull request Nov 23, 2026
…gnature

The test for descriptor heap #9 / #10 called them through a two-argument fn pointer
(`this` plus a stray pointer) although they take only `this`: a Rust call through a fn
pointer of another signature is undefined behaviour, even where Win64 lets it pass. Its
checks were also weak: a start that is not 0 and not the stray pointer, so #9 / #10
returning the constant 1 still passed.

The test now creates two heaps and reads each heap's start from the object
(CreateDescriptorHeap's handle range: not 0, a different one per heap), then calls #9 and
#10 as `fn(this) -> u64` and wants exactly that start. On x86_64 Windows it also calls them
through a small asm shim that passes `this` in rcx and leaves a writable sentinel pointer in
rdx, as console code can: the sentinel must be unchanged and rax the exact start. Checked
under Wine: #9 / #10 returning 1 fails the test, and so does the old PC form that wrote the
handle through rdx. Test only, the null device is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019twRmZMiGWQ8zSxFiGaz6b
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or
partially-committed source ranges:
- Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src,
  row_pitch, slice_pitch) so src is no longer misinterpreted as pitch.
- Validate row_pitch, 3D slice_pitch, and destination span before
  copying.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or
partially-committed source ranges:
- Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src,
  row_pitch, slice_pitch) so src is no longer misinterpreted as pitch.
- Validate row_pitch, 3D slice_pitch, and destination span before
  copying.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or
partially-committed source ranges:
- Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src,
  row_pitch, slice_pitch) so src is no longer misinterpreted as pitch.
- Validate row_pitch, 3D slice_pitch, and destination span before
  copying.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or
partially-committed source ranges:
- Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src,
  row_pitch, slice_pitch) so src is no longer misinterpreted as pitch.
- Validate row_pitch, 3D slice_pitch, and destination span before
  copying.
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or
partially-committed source ranges:
- Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src,
  row_pitch, slice_pitch) so src is no longer misinterpreted as pitch.
- Validate row_pitch, 3D slice_pitch, and destination span before
  copying.
themaoci pushed a commit to themaoci/xcl that referenced this pull request Nov 24, 2026
CopyFromSubresource (vtable slot xcl-dev#9) takes an extra u32 argument before
src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old
6-argument signature, src was decoded as row_pitch and rows were copied
far outside dst, causing access violations (xcl-dev#477, xcl-dev#662).

Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch,
3D slice_pitch, and destination span readability before writing (logging
a bounded warning and returning E_INVALIDARG on invalid spans), and add
2D, 3D, and invalid-span unit tests.

Fixes xcl-dev#477
Part of xcl-dev#662

(cherry picked from commit e56dbc3)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
Integrates upstream PR xcl-dev#684 while retaining read_committed on sparse or
partially-committed source ranges:
- Fix vtable slot xcl-dev#9 signature to (dst, plane, sub, arg4, src,
  row_pitch, slice_pitch) so src is no longer misinterpreted as pitch.
- Validate row_pitch, 3D slice_pitch, and destination span before
  copying.
mastrr9 pushed a commit to mastrr9/xcl that referenced this pull request Nov 24, 2026
CopyFromSubresource (vtable slot ivall#9) takes an extra u32 argument before
src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old
6-argument signature, src was decoded as row_pitch and rows were copied
far outside dst, causing access violations (ivall#477, ivall#662).

Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch,
3D slice_pitch, and destination span readability before writing (logging
a bounded warning and returning E_INVALIDARG on invalid spans), and add
2D, 3D, and invalid-span unit tests.

Fixes ivall#477
Part of ivall#662
rdj415 added a commit to rdj415/xcl that referenced this pull request Nov 24, 2026
koboshchan added a commit to koboshchan/xcl that referenced this pull request Nov 24, 2026
XGTextureAddressComputer::CopyFromSubresource (vtable xcl-dev#9) takes an 8-argument ABI (this, dst, plane, sub, sample, src, row_pitch, slice_pitch), unlike CopyIntoSubresource (xcl-dev#8) which takes 7 arguments. Omitting sample shifted src/row_pitch/slice_pitch by one slot, interpreting the low 32 bits of the source pointer as row_pitch and crashing with a write access violation on row 1.

Add the sample parameter to xg::copy_from, add a unit test covering vtable xcl-dev#8/xcl-dev#9 round-trip ABI, and update xg_oracle to exercise both XCL and the console library on CopyFromSubresource.

Assisted-by: Antigravity CLI (Gemini 4 Neon)
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

xcl-dev#53 / xcl-dev#54 now go to `list_x::clear_uav_uint_x` / `clear_uav_float_x`
(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
The retail title calls ID3D12CommandAllocator xcl-dev#9 each time it takes an
allocator from its pool (title+0x188501), with two arguments: a callback
in its own code (title+0x555df10) and a context pointer. The return value
is not read. The callback takes a size (4th argument), an alignment (5th)
and the context (7th), and returns a block of the title's memory: the
console runtime asks the title for command memory through it.

A traced run (90 s, RTX 5070) saw over 1024 calls on 68 allocators, all
with the same callback and context. A PC allocator gets its memory from
the driver, so XCL never calls the callback: xcl-dev#9 answers S_OK and logs the
first registration, on real and null devices, instead of the generic
"not on PC" stub.

Assisted-by: Claude Code (Claude Opus 5.5)
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
CopyFromSubresource (vtable slot xcl-dev#9) takes an extra u32 argument before
src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old
6-argument signature, src was decoded as row_pitch and rows were copied
far outside dst, causing access violations (xcl-dev#477, xcl-dev#662).

Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch,
3D slice_pitch, and destination span readability before writing (logging
a bounded warning and returning E_INVALIDARG on invalid spans), and add
2D, 3D, and invalid-span unit tests.

Fixes xcl-dev#477
Part of xcl-dev#662
wilu222 added a commit to wilu222/xcl that referenced this pull request Nov 25, 2026
The retail title calls ID3D12CommandAllocator xcl-dev#9 each time it takes an
allocator from its pool (title+0x188501), with two arguments: a callback
in its own code (title+0x555df10) and a context pointer. The return value
is not read. The callback takes a size (4th argument), an alignment (5th)
and the context (7th), and returns a block of the title's memory: the
console runtime asks the title for command memory through it.

A traced run (90 s, RTX 5070) saw over 1024 calls on 68 allocators, all
with the same callback and context. A PC allocator gets its memory from
the driver, so XCL never calls the callback: xcl-dev#9 answers S_OK and logs the
first registration, on real and null devices, instead of the generic
"not on PC" stub.

Assisted-by: Claude Code (Claude Opus 5.5)
raylitebull pushed a commit that referenced this pull request Nov 25, 2026
Part of #480.

Add integration tests comparing D3D12.X runtime wrappers against host
ID3D12Device objects and console ABI contracts across:
- ID3D12Resource Map, Unmap, GetGPUVirtualAddress (including lazy
  TITLE_ADDRESS texture fallback and UMA buffer placement), and
  WriteToSubresource
- ID3D12DescriptorHeap console slot #9/#10 start handles and
  console_heap::start lifecycle on host and console #14 heaps
- ID3D12CommandQueue GetDesc, GetTimestampFrequency,
  GetClockCalibration (host parity and pre/post-QUEUE_OLDER console
  calls), ExecuteCommandLists, Wait, Signal, and SignalX (#23)
- ID3D12Fence slot #12 64-byte-aligned completed-value cell and CPU
  Signal updates, plus ID3D12CommandAllocator::Reset (#8)

Verified on AMD Radeon RX 9070 XT (debug, release, XCL_D3D12_DEBUG=1),
AMD Radeon(TM) Graphics, and WARP.
IvyNotFound pushed a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
…rgument

A retail game crashed during its world loading, every run: an
access violation in a memcpy writing to title memory that was never
reserved, mapped or committed. The writer was XCL's
XGTextureAddressComputer::CopyFromSubresource (vtable xcl-dev#9), called by the
game as (linear dst, plane, subresource, 0, tiled src, row pitch, slice
pitch): its library has a 32-bit argument before the source pointer,
which the library the oracle test uses (XDefiant's) does not. Read the
6-argument way, the source was the 0 dword with the stack slot's old
upper half, and the row pitch the low half of the real source pointer,
so the second row went gigabytes past the destination.

The game calls both forms, so they are told apart per call: a value of
16 bits or less in the fourth slot with address space in use at the
fifth is the newer form (address space, not readable memory: title pages
are committed on first use). A nonzero added argument is logged once and
ignored; its meaning is not known.

New test: both forms tile the same bytes and read them back, with
garbage in the upper half of the added argument's slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
emirduran707 added a commit to emirduran707/xcl that referenced this pull request Nov 25, 2026
…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rtfmbrah pushed a commit to rtfmbrah/linux-xcl-nvidia that referenced this pull request Nov 26, 2026
CopyFromSubresource (vtable slot xcl-dev#9) takes an extra u32 argument before
src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old
6-argument signature, src was decoded as row_pitch and rows were copied
far outside dst, causing access violations (xcl-dev#477, xcl-dev#662).

Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch,
3D slice_pitch, and destination span readability before writing (logging
a bounded warning and returning E_INVALIDARG on invalid spans), and add
2D, 3D, and invalid-span unit tests.

Fixes xcl-dev#477
Part of xcl-dev#662

(cherry picked from commit e56dbc3)
rtfmbrah pushed a commit to rtfmbrah/linux-xcl-nvidia that referenced this pull request Nov 26, 2026
CopyFromSubresource (vtable slot xcl-dev#9) takes an extra u32 argument before
src: (dst, plane, sub, arg4, src, row_pitch, slice_pitch). With the old
6-argument signature, src was decoded as row_pitch and rows were copied
far outside dst, causing access violations (xcl-dev#477, xcl-dev#662).

Update copy_from and xg_oracle to the 7-argument ABI, validate row_pitch,
3D slice_pitch, and destination span readability before writing (logging
a bounded warning and returning E_INVALIDARG on invalid spans), and add
2D, 3D, and invalid-span unit tests.

Fixes xcl-dev#477
Part of xcl-dev#662

(cherry picked from commit e56dbc3)
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.

2 participants