Skip to content

Expand bounded GPU compatibility coverage - #83

Closed
bmjask wants to merge 18 commits into
xcl-dev:mainfrom
bmjask:codex/gpu-compatibility
Closed

bmjask wants to merge 18 commits into
xcl-dev:mainfrom
bmjask:codex/gpu-compatibility

Conversation

@bmjask

@bmjask bmjask commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • complete bounded scalar, vector, memory, image, lane, and control-flow compatibility for the measured validation corpus
  • add structural descriptor validation and deterministic aggregate coverage reporting
  • add validation-only two-wave scheduling, checked per-slot lowering, and checked two-pass recording prerequisites
  • add checked guest-to-host read-only mapping and bounded scalar, buffer, image, sampling, and gather operations
  • move validation vector state to checked buffer-backed scratch while preserving fail-closed production eligibility
  • add transformed SDWA/DPP sources, relative vector access, compact image forms, and formatted buffer loads
  • connect console dispatch to the existing checked compute-to-mesh two-pass recorder when translated pipeline metadata is present
  • reject out-of-range compute and mesh group counts before command-list borrowing or ABI allocation
  • add opt-in redacted pipeline diagnostics for validation tests

Verification

  • full rebuilt workspace suite: 619 library tests passed, 16 ignored, 0 failed
  • all integration suites passed, including 6 GPU pipeline tests and 2 end-to-end tests
  • aggregate decoder survey: 9,282/9,282 programs decoded and structurally validated, with 0 decode failures and 0 unsupported opcodes/forms
  • aggregate validation-shell survey: 9,282/9,282 accepted, 0 rejected, with empty rejection and first-unlowered histograms
  • measured validation per-slot vector coverage: 5,556,444/5,556,444 decoded instructions (100%)
  • measured validation per-slot scalar coverage: 1,868,367/1,868,367 decoded instructions (100%)
  • live Wave64 tests cover two-wave scheduling, fault isolation, buffer-backed state, control flow, rendezvous, lane and relative operations, transformed sources, arithmetic, checked memory, buffer/image loads, point sampling, and four-tap gathers
  • production routing tests exercise the actual console dispatch entry, zero-work behavior, checked limits, command ordering, shared result binding, and existing compute fallback
  • a non-zero synthetic GPU route invokes the actual console entry, captures graphics constants, prepares process UMA, executes both passes, and verifies shared records plus rendered pixels
  • route console-specific indexed draws through translated graphics ABI binding, fail closed for two-pass metadata, and restore temporary index state
  • a live indexed-draw test verifies shader-observed graphics constants, rendered geometry, and restored native index bindings
  • unify standard draw and graphics-indirect preparation so ABI binding precedes pending draw state and two-pass pipelines fail closed before native calls
  • a live standard-draw test verifies actual graphics arguments and the ABI-before-draw-state ordering
  • synchronize bound pipelines and root arguments across command-list creation, reset, clear-state, and release while preserving in-flight UMA ownership
  • make command-list reset transactional so native failure preserves tracked recording state and successful reset transfers ownership exactly once
  • define a fail-closed, privacy-preserving runtime evidence contract for any future expansion of real-program eligibility
  • add an opt-in bounded structural JSONL sink with pseudonymous identifiers, fixed categories, strict caps, and latched I/O failure isolation
  • add an offline fail-closed trace validator for schema, bounds, sequence, epochs, lifecycle, outcomes, and categories
  • validate a release runtime trace end to end, including exact active-list rebind epochs and suppression of unscoped release hooks
  • trace command-list close and queue submission ordering across ordinary, copy, wrapper, and internal kickoff paths, rejecting submit-before-close and commands-after-close
  • public diff, paths, and commit metadata scanned for local paths, logs, retired labels, and identifying asset names

Current boundary

The measured validation compatibility shell is corpus-complete. The explicit two-pass console dispatch route is now connected for translated pipelines with checked metadata, while ordinary translated compute dispatch remains unchanged. Broader production eligibility and title-specific dispatch derivation remain fail-closed where executable/runtime evidence is unavailable.

Notes

This is compatibility-layer work only. It contains no protected content, keys, package decryption, or title-specific data.

@bmjask
bmjask force-pushed the codex/gpu-compatibility branch 9 times, most recently from 6da693f to fa3d5a9 Compare November 23, 2026 04:31
@bmjask
bmjask force-pushed the codex/gpu-compatibility branch from fa3d5a9 to be0c78f Compare November 23, 2026 05:36
Validate dispatch limits before allocation and preserve the existing compute path.
Exercise the production console dispatch entry with synthetic GPU pipelines and checked cleanup.
Prepare graphics ABI state before console-specific indexed draws and restore temporary index bindings.
Reject incompatible pipelines before native calls and apply pending draw state after ABI binding.
Synchronize initial pipelines and root arguments across creation, reset, clear-state, and release lifecycles.
Preserve tracked recording state when native reset fails and commit ownership changes only after success.
Record validated coverage, production routing, lifecycle guarantees, and the remaining evidence boundary.
Document the optimized build and release-mode synthetic launcher result.
Document release-mode pipeline and launcher verification.
Document the complete release-mode test result.
Document the redacted evidence and validation gates required before broader production eligibility.
Capture opt-in redacted lifecycle and command evidence with strict caps and failure isolation.
DIMASIK1502 pushed a commit to DIMASIK1502/xcl that referenced this pull request Nov 23, 2026
…ist layouts

Unicorn Overlord runs on a newer console D3D12 runtime from its own game OS.
It reports the same SDK version (0x20004) as XDefiant and Minecraft, but some
vtables are laid out differently:

- Command queue: there are two more methods before Signal. Signal is at xcl-dev#16,
  Wait xcl-dev#17, GetTimestampFrequency xcl-dev#18, SignalX xcl-dev#25 and PresentX xcl-dev#32. The
  title's Signal used to land on GetTimestampFrequency, which wrote 100 MHz
  over the fence's vtable, and the game crashed. queue_dispatch now handles
  the title's queue slots from xcl-dev#14. A fence passed to xcl-dev#16 or xcl-dev#17 marks the
  newer layout; the older layout never passes one there.
- Command list: the console methods from CopyTextureRegionX onward sit two
  slots later (xcl-dev#85 instead of xcl-dev#83). The texture uploads used to hit
  SetPredicationBufferX, so every texture stayed zero and the screen showed
  only shapes and gradients. guard::make_layout_split now picks the method
  at each call and leaves the argument registers, xmm ones included,
  untouched.

Also:
- Console-only resource state bits (0x100000 on the 4K display target) are
  masked off when a resource is created. The PC refused the resource and
  the title threw.
- The title commits 2046 of 2048 MB of unified memory at start. XCL's
  per-draw arena now has its own 64 MB pool at the end of window 0, so
  draws are no longer skipped.
- FENCES is a read-write lock. end_title reads it while the title's threads
  are suspended, so a suspended reader no longer blocks it.

Diagnostics:
- XCL_WATCH=rva sets a write watchpoint in the exe; the calling thread is
  armed at once.
- XCL_WATCH_FENCE=n watches the n-th fence.
- The log now shows the device's SDK version, console-only interface
  requests, the title's file opens with their flags, DirectStorage
  requests, unified-memory use, and (in traces) whether title textures hold
  data in memory.

README: Unicorn Overlord is listed as fully playable. Bink's GPU-assisted
mode is no longer listed as missing: it needs no Bink-specific support.
Hull, domain and amplification shaders are dropped from the list too, since
none of the games use them.
Validate bounded trace schema, sequence, epochs, lifecycle, and categories without exposing raw input.
Adds fail-closed active-list rebind validation, suppresses unscoped release records, and records release trace-to-validator evidence.
@certified-retart

Copy link
Copy Markdown
Contributor

Tested head \385442b5\ on a dual-GPU Windows 10 setup (NVIDIA RTX 5070 + AMD Radeon 9800X3D iGPU) with D3D12 Agility SDK 1.619.1 (#75) so SM 6.6 / wave64 GPU tests run live:

NVIDIA RTX 5070 (\XCL_ADAPTER=0, wave32-only)

  • \xcl\ lib suite: 624 passed, 1 failed, 16 ignored (46 wave64-only GPU tests \SKIPPED\ as expected on NVIDIA).
  • The single failure is \gpu::recomp::mesh_vector::tests::decoded_final_float_math_edges_match_actual_u6\ at \mesh_vector.rs:9072\ (\�ssert!(f32::from_bits(actual).is_nan())), which tests \V_FRACT_F32(+inf)\ in register 3 — this looks like the same NVIDIA \min(NaN, 0x3F7FFFFF)\ behavior fixed in Console UAV barriers for all resources; v_fract_f32 of ±inf / NaN gives NaN (NVIDIA) #68.

AMD Radeon(TM) Graphics (9800X3D Raphael RDNA2 iGPU, \XCL_ADAPTER=1, wave32..64)

  • Full \xcl\ lib suite hit a **GPU device removal (\

Adds bounded close and submission events with fail-closed lifecycle validation and release-level synthetic evidence.
Documents bounded command-list close and queue submission coverage in the runtime evidence contract.
@bmjask

bmjask commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed against the current head: the reported NVIDIA V_FRACT_F32(+inf) failure is the existing fract_f clamp behavior, not introduced by this PR. PR #68 contains the exact compare/select correction plus a dedicated live GPU edge-case regression, and is open and mergeable against current main. To avoid duplicating contributor-owned work (and pulling its unrelated barrier change into this branch), this PR should be tested after #68 or rebased once #68 lands.

Documents the existing floating-point edge failure and its contributor-owned upstream fix.
@bmjask

bmjask commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the cross-vendor run. The AMD section of the report appears truncated after “GPU device removal,” so there is not enough evidence yet to identify the failing test or removal reason. If reproducible, please add the first failing test name plus the D3D12 device-removed reason (and whether it also occurs on current main); bounded output is sufficient. That will let us separate a branch regression from an adapter/Agility baseline issue.

@certified-retart

Copy link
Copy Markdown
Contributor

Sorry about the truncated earlier comment — PowerShell double-quoted backtick escaping ate the rest of it. Here are the full details on AMD Radeon(TM) Graphics (Ryzen 7 9800X3D iGPU, RDNA2, wave64) with Agility SDK v620 (XCL_ADAPTER=1, --test-threads=1):

1. Does it happen on current main?

No. On current main (9284dcd), running cargo test -p xcl --lib -- --test-threads=1 on the exact same AMD Radeon iGPU + Agility SDK v620 gives:

  • 393 passed, 0 failed, 16 ignored, 0 skipped, 0 device removals.

All failures and device removals below are specific to PR #83 (bdfc8530, tested locally with the Agility SDK loader from main merged in so the iGPU exposes SM 6.6).

2. First failing test & exact GetDeviceRemovedReason HRESULT

There are two distinct failure classes in gpu::recomp::mesh_epoch_hlsl::tests:

A. GPU device removals (DXGI_ERROR_DEVICE_HUNG, 0x887A0006) — 2 tests

  1. First TDR trigger (reproduces in isolation):
    • gpu::recomp::mesh_epoch_hlsl::tests::descriptor_xy_xyz_xyzw_indexed_forms_convert_and_commit_atomically (mesh_epoch_hlsl.rs:3849)
  2. Second TDR trigger (hit when skipping the first):
    • gpu::recomp::mesh_epoch_hlsl::tests::formatted_vector_buffers_decode_convert_alias_and_commit_atomically_live

On both tests, after WaitForSingleObject:

  • ID3D12Fence::GetCompletedValue() returns 0xffffffffffffffff (u64::MAX)
  • ID3D12Device::GetDeviceRemovedReason() returns HRESULT(0x887A0006) (DXGI_ERROR_DEVICE_HUNG):

    "The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application."

Runner subtlety: runner.rs checks if gpu.fence.GetCompletedValue() < gpu.value, which evaluates to false when D3D12 returns u64::MAX on device removal. Without also checking completed == u64::MAX / GetDeviceRemovedReason(), descriptor_xy_xyz_xyzw_indexed_forms_convert_and_commit_atomically appears to fail with a readback mismatch at mesh_epoch_hlsl.rs:3851 (left: (1065353216, 1065353216), right: (1017159841, 1019265217)), and then the next test (f32_integer_converts_match_cpu_rounding_sdwa_and_wave64, which passes in isolation) and every subsequent GPU test fail in CreateComputePipelineState with DXGI_ERROR_DEVICE_REMOVED (0x887A0005).

B. Non-TDR assertion mismatches (10 tests in mesh_epoch_hlsl)

Skipping only the 2 hanging tests above, cargo test -p xcl --lib gpu::recomp::mesh_epoch_hlsl -- --test-threads=1 finishes cleanly with 45 passed, 10 failed, 0 device removals:

  1. d16_image_load_packs_halves_and_commits_atomically — first failing test in alphabetical order, reproduces in isolation (mesh_epoch_hlsl.rs:3976: left: (0, 0), right: (2147499008, 97280))
  2. d16_image_sample_implicit_and_explicit_zero_lod_match — reproduces in isolation (mesh_epoch_hlsl.rs:4160: left: (1061158912, 0), right: (1061158912, 1061158912))
  3. float_math_family_matches_mature_domains_and_wave64 — reproduces in isolation (mesh_epoch_hlsl.rs:2492: assertion failed: close(at(absolute_lane, 9), input.log2()))
  4. float_remainder_matches_cpu_ordering_edges_and_wave64 (mesh_epoch_hlsl.rs:3124: assertion failed: same(at(absolute_lane, 5), a.ceil()))
  5. fma_mix_modes_match_cpu_fused_edges_and_wave64
  6. scalar_binary64_family_matches_cpu_pairs_aliases_and_wave64
  7. scalar_exec_transforms_match_cpu_masks_and_following_exec_wave64
  8. scalar_get_pc_uses_byte_next_pc_for_two_waves_and_pair_destinations
  9. scalar_hardware_configuration_is_inert_in_bounded_shell_live
  10. transformed_binary_and_scalar_compare_sources_match_wave64 (wave 0 SGPR0 ballot at lane 8)

(Side note: after the recent merges to main, PR #83 also has merge conflicts in crates/xcl/src/gpu/recomp/pso.rs, crates/xcl/src/gpu/recomp/runner.rs, and crates/xcl/src/hle/d3d12x/list_x.rs.)

@bmjask bmjask closed this Nov 23, 2026
@bmjask
bmjask deleted the codex/gpu-compatibility branch November 23, 2026 12:09
@bmjask

bmjask commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

The reviewed updates are now in replacement PR #112. GitHub automatically closed this PR when its stale conflicted head was replaced with a clean commit based on current main, and it does not permit reopening a PR after that head-ref recreation. The discussion and AMD report here remain the basis for the follow-up in #112.

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