Skip to content

Shaders: precompile FSPX-only compute shaders from folders - #2822

Open
CryingLaughing wants to merge 1 commit into
xcl-dev:mainfrom
CryingLaughing:fix/precompile-fspx-compute
Open

CryingLaughing wants to merge 1 commit into
xcl-dev:mainfrom
CryingLaughing:fix/precompile-fspx-compute

Conversation

@CryingLaughing

@CryingLaughing CryingLaughing commented Nov 26, 2026 •

Copy link
Copy Markdown

Part of #2453. This addresses the separate FSPX input-admission gap. #2515 covers native descriptor and cache-key parity.

Folder precompile skipped valid ACCC/FSPX compute shaders when the Xbox parser found no XDAT. Admit them as compute shaders and pass them through the same stage filter, used-shader filter, translation, and optional native pipeline build.

What is in it

  • Use the existing FSPX parser when XDAT parsing finds no shader. Preserve the stage and interface of inputs with XDAT.
  • Add an end-to-end CLI test with one synthetic ACCC-only compute shader and isolated cache directories.

Tested

  • Rebased head 70ad0a5dc718af6e6b72e18155ee32f0e2b8d229 on 8b957bec6f82495aec940944c6bf47faa02db590. Windows 11 25H2 build 26200.9974, Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, DXC/DXIL 1.8.2502.11, debug.

  • The current head passed the focused synthetic CLI check (1 passed, 0 failed, 0 ignored, no capability skips). --only ps compiled zero shaders, --only cs compiled one, and --only cs --pipelines built one native PSO, refused zero, and saved one nonempty driver blob without loading a cached blob.

  • cargo build --workspace --locked -j 4 passed. cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output reported 1,447 passed, 0 failed, 47 ignored across 38 harnesses. The pass count includes 29 explicit capability skips and 10 messages for unset optional sample inputs.

  • On the original clean parent b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, the same synthetic fixture compiled zero compute shaders and failed its focused assertion. At prior head 74843bdc52bc8503cf5a0d1565a42a76cf8e0ec9, an independent Windows RTX 5070 Ti Laptop run verified input filtering and warm driver-blob reuse. Earlier Windows run

  • On rebased head 70ad0a5 and its actual parent 8b957be, independent RX 9070 testing under Wine (Mesa 26.3.1-arch3.5) passed the focused synthetic fixture in all three head processes. The base failed all three at compute-shader admission. A 28-process CLI comparison covered filtering and native PSO cache reuse. A separate test-only prepare_for_launch fixture built one native PSO, and both fresh warm processes accepted the same 112-byte driver blob. The no-op shader used HLSL fallback when direct DXIL was enabled. Rebased Wine run

  • Independent native Windows release verification on an RTX 3080 Ti with driver 621.35 compared clean main and this exact head using XCL’s synthetic title. Main reported zero compiled shaders and one error, then exited 2 before guest entry. The head compiled one shader, made one native pipeline with zero refusals, and reached an exit-0 guest in both fresh runs. Independent launcher verification

Regression run

Matched retail smoke is pending for the rebased head. The prior-head pair retained 99.4% of baseline frames, used 97.6% of baseline peak commit, and reported zero crashes or device removals.

Not tested

  • Retail-title FSPX use, GPU dispatch from the no-op fixture, native Windows AMD and Intel adapters on the rebased head.

@ettehn

ettehn commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent Windows check on 74843bdc52bc8503cf5a0d1565a42a76cf8e0ec9 against b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. RTX 5070 Ti Laptop (621.24), Windows 11 x64 build 26200, Rust 1.97.1 MSVC, DXC/DXIL 1.8.2502.11.

  • cargo test --locked --offline -p xcl --test gpu_compute_e2e -j 2 folder_precompile_includes_fspx_only_compute -- --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored, no capability skips. The same synthetic ACCC-only input gave compiled 0, errors 0 on the base with --precompile --only cs --split 1.
  • Additional CLI checks on the head with --precompile --only cs --split 1 --used-only: a nonmatching used-pipelines.txt entry skipped the shader. With the matching key, --pipelines made 1 PSO and refused 0. The driver-cache counter was 0 on the first run and 1 on the second, in separate processes. Results matched with XCL_DIRECT_DXIL=0 and =1. With =1 the cold log explicitly showed the HLSL fallback for this container.

The checks used a synthetic shader. No retail smoke run. OpenAI Codex (6.2sol) assisted with verification.

@Anon64

Anon64 commented Nov 26, 2026

Copy link
Copy Markdown

Regression run of 74843bd on a newer retail title: no device removal, no crash, frames and commit within the limits.

Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main b49be18 (this PR's base) and of this PR's exact head, scripts/smoke.ps1 -Game <title> for 60 s with XCL_NETWORK=0 and A pressed every 4 s from 20 s. Main ran before and after this PR and peaked at 24,953 and 25,032 MB.

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1461 (PresentX 1461)
presents per 2 s (last 3): 10 6 5
device removals: 0
crashes: 0
peak commit: 24953 MB

this PR:

xcl-smoke v1
commit: 74843bdc52bc8503cf5a0d1565a42a76cf8e0ec9
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1452 (PresentX 1453)
presents per 2 s (last 3): 13 4 1
device removals: 0
crashes: 0
peak commit: 24351 MB

99 % of main's frames, 97 % of its peak commit. One run each.

Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.

AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.

@SzczepanGrela

SzczepanGrela commented Nov 26, 2026 •

Copy link
Copy Markdown

RX 9070 / Wine recheck after the rebase, including the current pre-entry shader-preparation path.

Tested

  • Rebased head 70ad0a5dc718af6e6b72e18155ee32f0e2b8d229 against main 8b957bec6f82495aec940944c6bf47faa02db590.
  • RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, Mesa 26.3.1-arch3.5, GE-Proton11-12 Wine 11.0 Staging, vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, release x86_64-pc-windows-gnu.
  • Explicit RX 9070 selection and XCL_NETWORK=0; private enabled XCL/vkd3d/Mesa caches and one DXC/pipeline worker in the persistent CLI and startup checks.
  • The upstream integration-test file is unchanged from the earlier head. Main receives that test/helper file. Both trees also append the same local cfg(test) startup fixture; removing it reconstructs the pinned production-source hashes. No original assertion was changed.

This updates the existing report for 74843bdc52bc8503cf5a0d1565a42a76cf8e0ec9 / b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, whose paired CLI results were the same. The additional startup check below targets the API now present in main.

Original integration fixture

folder_precompile_includes_fspx_only_compute, three fresh processes per revision:

  • Head: 1 passed / 0 failed / 0 ignored each time. PS filter compiles zero, CS filter compiles one, and CS with --pipelines makes one native pipeline, refuses zero and saves a nonempty driver blob.
  • Main control: 0 passed / 1 failed / 0 ignored each time, at CS admission (compiled 0, already cached 0, errors 0). It does not reach that fixture's native-pipeline branch.

Persistent CLI checks

The retained 160-byte synthetic ACCC/FSPX input contains only S_ENDPGM, no XDAT. SHA-256: dde5396609bd1736b06900fa7d4ab84765b41da792274aa4616c23da4a351dc7.

Seven fresh-process cases per revision with both XCL_DIRECT_DXIL=0 and 1, 28 CLI processes total:

Case Main Head
--only ps compiled 0 compiled 0
--only cs, translation only compiled 0 compiled 1
CS native cold made 0, cache loaded 0 made 1, cache loaded 0
CS native warm made 0, cache loaded 0 made 1, cache loaded 1
Nonmatching --used-only key input not admitted compiled 0, passed over 1, made 0
Matching --used-only, cold/warm made 0 made 1, cache loaded 0/1

All CLI processes exit 0 with zero errors/refusals. Each head native-cache family holds one 112-byte .pso; warm processes report acceptance of the supplied blob and retain its filename and SHA-256. Main writes none. With direct flag 1, cold translation explicitly logs direct DXIL fallback stage=CS, not a console shader container, HLSL path. These flag-1 checks do not establish direct-lowering coverage.

Pre-entry preparation, no guest launch

The added test calls the existing prepare_for_launch on a private directory containing only the same input as shaders/compute.dxbc. It uses four runtime memory windows, HLSL, an explicit RX 9070 adapter, and one cold process followed by two fresh warm processes sharing its private cache.

  • Head: 1/0/0 in each process; total=1, done=1, Ok(()); compiled 1, errors 0, native pipelines 1, refused 0. Driver-cache acceptance is 0, 1, 1. The same 112-byte blob persists unchanged.
  • Main: 0/1/0 in each process; total=1, done=1, then Shader preparation stopped: 1 record failures, 0 refused pipelines, 0 over the size cap. Compiled 0, native pipelines 0; no driver blob.

All 12 libtest summaries, 28 CLI logs, input bytes, persistent cache files, cold/warm identities, source inventories and executable hashes were independently checked. No runtime capability skips or ignored tests. These are 40 top-level processes, with the main-control failures above intentional admission checks.

Build: cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --test gpu_compute_e2e --no-run. Under GE-Proton Wine: integration executable with folder_precompile_includes_fspx_only_compute --exact --nocapture --test-threads=1; local unit fixture with shaders::workflow_fspx_launch_preparation_synthetic --exact --nocapture --test-threads=1. CLI: xcl.exe shaders <owned-fixture-folder> --precompile --only cs --split 1 [--pipelines] [--used-only]; PS control uses --only ps. Inherited XCL_* flags are cleared before the explicit settings.

Not tested

GPU dispatch/output from the no-op shader, a guest or preparation UI launch, retail inputs, scripts/smoke.ps1, full suite, native Windows, other GPUs, cross-driver cache reuse, performance or FPS. Native PSO construction and cache acceptance are the hardware checks.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the rebased diff, ran the original fixture and paired CLI matrix, added the local synthetic startup fixture, independently verified the evidence and updated this report. Publication authorized by the account owner.

Recognize ACCC/FSPX compute inputs when the metadata parser finds no XDAT. Keep the existing stage filter, runtime translation, and native pipeline cache path. Part of xcl-dev#2453.
@CryingLaughing
CryingLaughing force-pushed the fix/precompile-fspx-compute branch from 74843bd to 70ad0a5 Compare November 26, 2026 15:39
@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

NVIDIA test report for 70ad0a5: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, DXC 1.8.2502.11, debug.
Head 70ad0a5 on main 8b957be (merge-base 8b957be).
cargo test -p xcl --test gpu_compute_e2e folder_precompile_includes_fspx_only_compute -- --test-threads=1: 3 of 3 runs passed, not skipped.
cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4: 1309 passed, 0 failed, 27 ignored. SKIPPED: 21 no wave64, 3 per-lane forms the translator refuses, 1 needs Developer Mode.
No driver resets. Lib tests only; no title run.
AI-assisted (Claude Code, Claude Sonnet 5.5).

@thehollowedone

Copy link
Copy Markdown

Independent normal-launch check on current head 70ad0a5 against clean main 8b957bec. I used a scratch copy of XCL's own console test title with the 160-byte synthetic ACCC/FSPX compute shader from this PR's fixture. No retail files were used.

Windows 11 build 26300, RTX 3080 Ti 12 GB (621.35), Ryzen 7 9800X3D, rustc 1.99.1 MSVC, DXC 1.8.2502.11, release builds. cargo build --offline --locked --release -p xcl --bin xcl passed on both revisions. Both launches used XCL_ADAPTER=NVIDIA, XCL_NETWORK=0, XCL_PREPARE=0, XCL_PSO_PRELOAD=0, XCL_DXC_THREADS=2, and isolated data/DXIL cache folders.

  • On main, scripts/smoke.ps1 -Game <synthetic title> -Seconds 60 -StartupTimeoutSeconds 30 reached pre-entry preparation, then reported compiled 0, errors 1 and exited 0x2 before the guest started. The smoke script could not print a block because XCL did not print a log path on this error path.
  • On the head, xcl run <same synthetic title> -- --hello with a fresh cache reported compiled 1, already cached 0, errors 0; pipelines made on the GPU 1, refused 0. The test title finished with failures 0, and XCL exited 0x0. A second run with another fresh cache/data root gave the same result.

This exercises pre-entry shader admission in the normal launcher, beyond the xcl shaders CLI test. It is not a paired xcl-smoke regression run: the test title exits after its checks, before the timer can record numeric frames and peak commit. Retail-title use of this FSPX path and the resulting compute shader's GPU output were not tested.

AI use: Codex (GPT-6.2 Sol) inspected the diff, prepared the synthetic fixture, ran and checked these builds and launches, and drafted this report. I checked every claim before posting.

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.

6 participants