build: startup_runtime target and runtime preset for a title run #2827

Manually merged
github merged 3 commits from github-bot/gh-2827 into gh-pr/2827/base 2026-11-27 22:23:56 +00:00 AGit
Owner

@⁠tedin7 on GitHub · 2026-11-26 12:12 UTC · original
tedin7:x2w-startup-runtime-target → main · +66 −3 · 4 files · 3 commits · merged 2026-11-27 22:22 UTC

Part of #870

Fixes #2826

What this unblocks: running a title needs only the eight stand-in DLLs and the build revision stamp, so cmake --build --preset runtime replaces a full build of every test executable.

What changed

  • CMakeLists.txt: a custom target startup_runtime that depends on xmem_shim, d3d12_xs_shim, the six startup_stub_* libraries and x2w_build_rev_generate: the files tools/startup/run.ps1 copies next to the title (xmem.dll, d3d12_xs.dll, AcpHal.dll, XCRDAPI.dll, chad.dll, xapu.dll, xg_xs.dll, GameInput.dll) and the revision stamp. No test executable is a dependency.
  • CMakePresets.json: build preset runtime (configure preset release, target startup_runtime).
  • docs/startup-runtime.md: the Build and Run sections name cmake --build --preset runtime.
  • tests/startup_runtime_target_check.py, registered as startup_runtime_target: builds the target, checks that each of the eight DLLs is on disk, that their names are exactly the ones run.ps1 copies, and that Ninja's recursive inputs of the target contain no executable.

Nothing else changes: cmake --build --preset release still builds everything.

Source

Source: CMake documentation, add_custom_target, add_dependencies and "cmake-presets(7)" (buildPresets, targets); Ninja manual, -t inputs.

Verification

  • Win2025 proxmox (Windows Server 2025, MSVC 14.44), dev: ctest -R '^startup_runtime_target$' passes (the target builds, 8 DLLs on disk, names match run.ps1, no executable among Ninja's inputs).
  • Win2025 proxmox (Windows Server 2025, MSVC 14.44), dev + release: startup_runtime_target 1/1 each at head eb82f1d39; a control with xmem_shim dropped from the target dependencies fails the test.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 12:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827) `tedin7:x2w-startup-runtime-target` → `main` · +66 −3 · 4 files · 3 commits · merged 2026-11-27 22:22 UTC Part of #870 Fixes #2826 What this unblocks: running a title needs only the eight stand-in DLLs and the build revision stamp, so `cmake --build --preset runtime` replaces a full build of every test executable. ## What changed - `CMakeLists.txt`: a custom target `startup_runtime` that depends on `xmem_shim`, `d3d12_xs_shim`, the six `startup_stub_*` libraries and `x2w_build_rev_generate`: the files `tools/startup/run.ps1` copies next to the title (`xmem.dll`, `d3d12_xs.dll`, `AcpHal.dll`, `XCRDAPI.dll`, `chad.dll`, `xapu.dll`, `xg_xs.dll`, `GameInput.dll`) and the revision stamp. No test executable is a dependency. - `CMakePresets.json`: build preset `runtime` (configure preset `release`, target `startup_runtime`). - `docs/startup-runtime.md`: the Build and Run sections name `cmake --build --preset runtime`. - `tests/startup_runtime_target_check.py`, registered as `startup_runtime_target`: builds the target, checks that each of the eight DLLs is on disk, that their names are exactly the ones `run.ps1` copies, and that Ninja's recursive inputs of the target contain no executable. Nothing else changes: `cmake --build --preset release` still builds everything. ## Source Source: CMake documentation, `add_custom_target`, `add_dependencies` and "cmake-presets(7)" (`buildPresets`, `targets`); Ninja manual, `-t inputs`. ## Verification - Win2025 proxmox (Windows Server 2025, MSVC 14.44), dev: `ctest -R '^startup_runtime_target$'` passes (the target builds, 8 DLLs on disk, names match `run.ps1`, no executable among Ninja's inputs). - Win2025 proxmox (Windows Server 2025, MSVC 14.44), dev + release: `startup_runtime_target` 1/1 each at head eb82f1d39; a control with `xmem_shim` dropped from the target dependencies fails the test. AI-assisted; commands listed were executed locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:25:29 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 12:37 UTC · original

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit eb82f1d39ad7dee21f09660f367e07d78a48bbb7:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target startup_runtime -- -j 2): 2.80s (configure 0.00s)
    • Test (ctest --preset dev -R '^startup_runtime_target$' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (1.28s: startup_runtime_target 1.16s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target startup_runtime -- -j 2): 28.60s (configure 0.00s)
    • Test (ctest --preset release -R '^startup_runtime_target$' --parallel 6 --no-tests=error --output-on-failure): 1/1 passed (1.04s: startup_runtime_target 0.91s)
  • sccache: 9/13 hits; wall 38.6s

Control: with xmem_shim dropped from the target's dependencies, startup_runtime_target fails ("startup_runtime did not leave ...xmem.dll").

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 12:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#issuecomment-7192239782) Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `eb82f1d39ad7dee21f09660f367e07d78a48bbb7`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target startup_runtime -- -j 2`): `2.80s` (configure `0.00s`) - Test (`ctest --preset dev -R '^startup_runtime_target$' --parallel 6 --no-tests=error --output-on-failure`): **1/1 passed** (`1.28s`: `startup_runtime_target` `1.16s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target startup_runtime -- -j 2`): `28.60s` (configure `0.00s`) - Test (`ctest --preset release -R '^startup_runtime_target$' --parallel 6 --no-tests=error --output-on-failure`): **1/1 passed** (`1.04s`: `startup_runtime_target` `0.91s`) - `sccache`: 9/13 hits; wall `38.6s` Control: with `xmem_shim` dropped from the target's dependencies, `startup_runtime_target` fails ("startup_runtime did not leave ...xmem.dll"). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 12:37 UTC · original

Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-26T12:37:27.817083Z
We couldn’t complete this review. Comment @codex review to try again.
eb82f1d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 12:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#issuecomment-7192244568) <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"eb82f1d39ad7dee21f09660f367e07d78a48bbb7","has_any_findings":true,"has_unresolved_findings":true,"status":"failed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ❌ Failed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ❌ **Failed** <relative-time datetime="2026-11-26T12:37:27.817083Z">2026-11-26T12:37:27.817083Z</relative-time><br/>We couldn’t complete this review. Comment `@codex review` to try again. | `eb82f1d` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 12:37 UTC · original

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 12:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#issuecomment-7192245168) You have reached your Codex usage limits for code reviews. You can see your limits in the [Codex usage dashboard](https://chatgpt.com/codex/cloud/settings/usage). To continue using code reviews, add credits to your account and enable them for code reviews in your [settings](https://chatgpt.com/settings/code-review).
Author
Owner

@⁠pigalot on GitHub · 2026-11-27 18:49 UTC · original · requested changes

Independently reviewed eb82f1d3 integrated over main 7832b98b (tree e9e5bf36, clean merge).

The target and preset look right. The foreach ($dll in ...) list in run.ps1 on current main is still the same eight DLLs. Run alone, startup_runtime_target passes in dev and release:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_runtime_target$'
It printed startup_runtime builds the 8 DLLs run.ps1 copies and no executable.

Finding: the test breaks other tests that run at the same time. startup_runtime_target_check.py deletes xmem.dll, XCRDAPI.dll and the other six stand-ins from the shared build directory, then rebuilds them with cmake --build. Many other tests load those DLLs from the same directory: CMakeLists.txt passes $<TARGET_FILE:...> of these targets to tests 98 times. Under ctest --parallel, a test that starts in that window cannot load them.

Repro on the trial merge, with the storage targets and startup_runtime built in dev:

ctest --test-dir out/build/dev --no-tests=error -j 8 --output-on-failure -R '^(startup_runtime_target|startup_storage.*)$'
  • With the new test: 5 of 5 runs failed.
    • In three runs, startup_storage_page_end_counts and startup_storage_consumer_pair failed with cannot load .../out/build/dev/xmem.dll as xmem.dll, and startup_storage_refusal_order and startup_storage_alloc_failure failed with cannot load the DirectStorage stand-in.
    • In the other two runs, startup_storage_directory_batch failed.
    • startup_runtime_target itself passed every time.
  • Control: the same command with -R '^(startup_storage.*)$' (the new test left out) passed 3 of 3 (15/15).

PR CI doesn't show this because ctest --preset pr filters to the smoke set, which doesn't include startup_runtime_target. The main push job runs ctest --preset dev --parallel 4 -E '_hardware$', and the release job runs the same with --preset release. Both include this test next to the DLL users, so I expect it to turn those jobs flaky once merged.

Suggested direction (checked once): add RUN_SERIAL TRUE to startup_runtime_target. With that one change, the same -j 8 command passed 3 of 3 (16/16). A test that doesn't delete build outputs would avoid the question entirely; that variant is untested. For example, check the target's inputs with ninja -t inputs and a dry run (cmake --build ... --target startup_runtime -- -n) instead of rebuilding.

Verdict: changes requested on eb82f1d3, for the parallel-run interference only.

Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10.
CI: Build and test on Windows passes on eb82f1d3 (the pr smoke filter, which does not include this test).

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-27 18:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#pullrequestreview-6092261999) · **requested changes** Independently reviewed `eb82f1d3` integrated over `main` `7832b98b` (tree `e9e5bf36`, clean merge). The target and preset look right. The `foreach ($dll in ...)` list in `run.ps1` on current `main` is still the same eight DLLs. Run alone, `startup_runtime_target` passes in `dev` and `release`: `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_runtime_target$'` It printed `startup_runtime builds the 8 DLLs run.ps1 copies and no executable`. **Finding: the test breaks other tests that run at the same time.** `startup_runtime_target_check.py` deletes `xmem.dll`, `XCRDAPI.dll` and the other six stand-ins from the shared build directory, then rebuilds them with `cmake --build`. Many other tests load those DLLs from the same directory: `CMakeLists.txt` passes `$<TARGET_FILE:...>` of these targets to tests 98 times. Under `ctest --parallel`, a test that starts in that window cannot load them. Repro on the trial merge, with the storage targets and `startup_runtime` built in `dev`: ``` ctest --test-dir out/build/dev --no-tests=error -j 8 --output-on-failure -R '^(startup_runtime_target|startup_storage.*)$' ``` - **With the new test:** 5 of 5 runs failed. - In three runs, `startup_storage_page_end_counts` and `startup_storage_consumer_pair` failed with `cannot load .../out/build/dev/xmem.dll as xmem.dll`, and `startup_storage_refusal_order` and `startup_storage_alloc_failure` failed with `cannot load the DirectStorage stand-in`. - In the other two runs, `startup_storage_directory_batch` failed. - `startup_runtime_target` itself passed every time. - **Control:** the same command with `-R '^(startup_storage.*)$'` (the new test left out) passed 3 of 3 (15/15). PR CI doesn't show this because `ctest --preset pr` filters to the smoke set, which doesn't include `startup_runtime_target`. The `main` push job runs `ctest --preset dev --parallel 4 -E '_hardware$'`, and the release job runs the same with `--preset release`. Both include this test next to the DLL users, so I expect it to turn those jobs flaky once merged. **Suggested direction (checked once):** add `RUN_SERIAL TRUE` to `startup_runtime_target`. With that one change, the same `-j 8` command passed 3 of 3 (16/16). A test that doesn't delete build outputs would avoid the question entirely; that variant is untested. For example, check the target's inputs with `ninja -t inputs` and a dry run (`cmake --build ... --target startup_runtime -- -n`) instead of rebuilding. **Verdict:** changes requested on `eb82f1d3`, for the parallel-run interference only. Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10. CI: `Build and test on Windows` passes on `eb82f1d3` (the `pr` smoke filter, which does not include this test). This reply was AI-assisted.
It deletes and rebuilds the stand-in DLLs that other tests load, so a parallel ctest run could fail those tests.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 21:28 UTC · original

Thanks for the repro. Pushed e93ec89ff: startup_runtime_target now has RUN_SERIAL TRUE, so ctest runs it alone and it cannot delete the stand-in DLLs while other tests load them. The test itself is unchanged.

Not yet re-run on Windows: your -j 8 command with -R '^(startup_runtime_target|startup_storage.*)$'.

Commands run locally: cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true, public_guard.py.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 21:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#issuecomment-7228472299) Thanks for the repro. Pushed `e93ec89ff`: `startup_runtime_target` now has `RUN_SERIAL TRUE`, so ctest runs it alone and it cannot delete the stand-in DLLs while other tests load them. The test itself is unchanged. Not yet re-run on Windows: your `-j 8` command with `-R '^(startup_runtime_target|startup_storage.*)$'`. Commands run locally: `cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true`, `public_guard.py`. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 21:47 UTC · original

Verification: head e93ec89ff after the main merge and the latest fixes.

Environment: Windows Server 2025 (build 26100), MSVC 14.44, D3D12 WARP and the hardware adapter, dev and release legs in parallel.

Commands (the same selection in both legs):

x2w_pipe.py win2025 2827 --force --regex '^(startup_runtime_target|startup_stubs|startup_storage.*|startup_stub_.*|startup_run_.*|startup_xg.*|startup_gamesave.*  (--parallel 8))$'
  dev:     cmake --build --preset dev --target auto
           ctest --preset dev -R '^(startup_runtime_target|startup_stubs|startup_storage.*|startup_stub_.*|startup_run_.*|startup_xg.*|startup_gamesave.*  (--parallel 8))$' --no-tests=error --output-on-failure
  release: cmake --build --preset release --target auto
           ctest --preset release -R '^(startup_runtime_target|startup_stubs|startup_storage.*|startup_stub_.*|startup_run_.*|startup_xg.*|startup_gamesave.*  (--parallel 8))$' --no-tests=error --output-on-failure

Result: 42 selected, no failures in both legs (4 skipped by capability); startup_runtime_target ran with RUN_SERIAL in an 8-way parallel ctest without disturbing the other tests. The narrower ^(startup_runtime_target|startup_storage.*)$ run also passed 16/16 in both legs.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 21:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#issuecomment-7228754999) Verification: head `e93ec89ff` after the main merge and the latest fixes. Environment: Windows Server 2025 (build 26100), MSVC 14.44, D3D12 WARP and the hardware adapter, dev and release legs in parallel. Commands (the same selection in both legs): ``` x2w_pipe.py win2025 2827 --force --regex '^(startup_runtime_target|startup_stubs|startup_storage.*|startup_stub_.*|startup_run_.*|startup_xg.*|startup_gamesave.* (--parallel 8))$' dev: cmake --build --preset dev --target auto ctest --preset dev -R '^(startup_runtime_target|startup_stubs|startup_storage.*|startup_stub_.*|startup_run_.*|startup_xg.*|startup_gamesave.* (--parallel 8))$' --no-tests=error --output-on-failure release: cmake --build --preset release --target auto ctest --preset release -R '^(startup_runtime_target|startup_stubs|startup_storage.*|startup_stub_.*|startup_run_.*|startup_xg.*|startup_gamesave.* (--parallel 8))$' --no-tests=error --output-on-failure ``` Result: 42 selected, no failures in both legs (4 skipped by capability); `startup_runtime_target` ran with `RUN_SERIAL` in an 8-way parallel ctest without disturbing the other tests. The narrower `^(startup_runtime_target|startup_storage.*)$` run also passed 16/16 in both legs. AI-assisted; commands listed were executed locally.
github-bot changed target branch from main to gh-pr/2827/base 2026-11-27 22:23:55 +00:00
github manually merged commit e93ec89ff8 into gh-pr/2827/base 2026-11-27 22:23:56 +00:00
Author
Owner

@⁠pigalot on GitHub · 2026-11-27 22:22 UTC · original · approved these changes

Re-reviewed e93ec89f merged over current main e582a9a4. The merge is clean and git diff --cached --check is clean.

The finding from my review of eb82f1d3 is fixed. startup_runtime_target is now RUN_SERIAL TRUE, with a comment saying why. Under ctest --parallel, it no longer runs beside the tests that load the eight DLLs it deletes and rebuilds.

What I ran. I did a full build in dev and release. Run alone, startup_runtime_target passes in both presets. I then ran the same command as before on dev:

ctest --test-dir out/build/dev --no-tests=error -j 8 --output-on-failure -R '^(startup_runtime_target|startup_storage.*)$' -E 'startup_audio_'

4 of 4 runs pass (16/16 each).

Negative control. I removed only RUN_SERIAL TRUE, reconfigured, and repeated the command. All 3 runs failed:

  • Two runs: 8 of 16 tests failed, the same as before: startup_storage_alloc_failure, _refusal_order, _page_end_counts, _consumer_pair, _refused_reuse with their _accept_refused_controls, and _directory_batch.
  • One run: only startup_storage_directory_batch failed.

I restored the file and reconfigured afterwards; git diff --quiet is clean.

Verdict: approve on e93ec89f.

Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10. No GPU is involved in these tests.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on e93ec89f.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-27 22:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2827#pullrequestreview-6093920739) · **approved these changes** Re-reviewed `e93ec89f` merged over current `main` `e582a9a4`. The merge is clean and `git diff --cached --check` is clean. **The finding from my review of `eb82f1d3` is fixed.** `startup_runtime_target` is now `RUN_SERIAL TRUE`, with a comment saying why. Under `ctest --parallel`, it no longer runs beside the tests that load the eight DLLs it deletes and rebuilds. **What I ran.** I did a full build in `dev` and `release`. Run alone, `startup_runtime_target` passes in both presets. I then ran the same command as before on `dev`: ```powershell ctest --test-dir out/build/dev --no-tests=error -j 8 --output-on-failure -R '^(startup_runtime_target|startup_storage.*)$' -E 'startup_audio_' ``` 4 of 4 runs pass (16/16 each). **Negative control.** I removed only `RUN_SERIAL TRUE`, reconfigured, and repeated the command. All 3 runs failed: - **Two runs:** 8 of 16 tests failed, the same as before: `startup_storage_alloc_failure`, `_refusal_order`, `_page_end_counts`, `_consumer_pair`, `_refused_reuse` with their `_accept_refused_control`s, and `_directory_batch`. - **One run:** only `startup_storage_directory_batch` failed. I restored the file and reconfigured afterwards; `git diff --quiet` is clean. **Verdict:** approve on `e93ec89f`. Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10. No GPU is involved in these tests. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `e93ec89f`. This reply was AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.