ci: build and test the PC suite at /O2 as well #441

Merged
grahamster2 merged 1 commit from upstream-pr/447 into main 2026-11-22 04:06:27 +00:00
grahamster2 commented 2026-11-22 03:50:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by grahamster2 on 2026-11-22T03:50:03Z.


Problem

The Windows job runs cmake --preset dev, cmake --build --preset dev and ctest --preset dev. The dev preset sets CMAKE_BUILD_TYPE=Debug, so CI compiles and tests every generated C++ translation, including all the *_lifted.cpp targets, only without optimization. CI cannot see translation bugs that appear only when the optimizer runs:

  • #437: at /O2 the optimizer deletes a guest read whose value is unused. The original faults on a bad pointer, but the translation returns normally. Differential runs compiled at /O2 found it. CI did not.
  • #385 (merged): the CRT-free startup and lifetime fixtures failed to link at /O2 because the compiler turned byte loops into memcpy calls. CI never built at /O2, so it did not catch this.
  • More generally, only the optimizer exploits undefined behavior in generated C++, such as signed overflow, aliasing and out-of-range shifts.

Change

  • CMakePresets.json: add release configure, build and test presets. They mirror dev with CMAKE_BUILD_TYPE=Release (/O2 /Ob2 /DNDEBUG) and binaryDir out/build/release. dev is unchanged.
  • .github/workflows/windows.yml: add a parallel Build and test on Windows at /O2 job. It sets up Python the same way as the existing job, then configures, builds and runs ctest --preset release --no-tests=error -E '_hardware$'. The existing Debug job, the GPU package step and the upload step are unchanged. I chose a separate job over extra steps in the existing one for two reasons. A failure that appears only at /O2 shows up under its own check name, and the job adds no time to the existing job's 20-minute limit. The cost is about 10 s of duplicated Python setup.
  • CONTRIBUTING.md: one sentence on the new job. README.md: one sentence under First build on the release preset.

I confirmed in the generated build.ninja that the lifted DLLs (for example cpu_address_size_lifted.cpp) compile with /O2 /Ob2 /DNDEBUG, and that no target in the Release tree uses /Od.

Evidence

Environment: Windows 11 Pro build 26200, VS Build Tools 2026 18.3 / MSVC 19.50.35725, Windows SDK 10.0.26100, Python 3.12, commit c1ca45b plus this change.

On this machine I excluded conditional_import_paths, static_exe_intake and bundled_export_forwarders locally because of a local setup choice. CI runs them.

.\tools\dev.ps1
cmake --preset release -DINTAKE_PYTHON=<pe-env python>
cmake --build --preset release
ctest --preset release --no-tests=error -E '_hardware$|^(conditional_import_paths|static_exe_intake|bundled_export_forwarders)$'
Preset Configure Build (620 steps, clean) Tests Result
release 1.6 s 14.1 s 77.6 s 139/139 passed; bvh_wave64_warp and wave_shuffle_warp skipped (capability)
dev 1.3 s 18.4 s 84.3 s 139/139 passed; the same two skips

No test failed in Release only. tests/docs_links_check.py (10 files, 81 links) and tests/bidi_controls_check.py (353 files) pass.

Cost

On recent main runs, the existing job's configure, build and test step takes 2.1 to 3.1 minutes, and the whole job takes 2.5 to 3.9 minutes. The new job runs in parallel with it, so wall-clock time should barely change. It adds about one more Windows job's worth of runner minutes per push and PR. Runner timings for this PR are below.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6538117726 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/447). Originally posted by [grahamster2](https://github.com/grahamster2) on 2026-11-22T03:50:03Z. --- ## Problem The Windows job runs `cmake --preset dev`, `cmake --build --preset dev` and `ctest --preset dev`. The `dev` preset sets `CMAKE_BUILD_TYPE=Debug`, so CI compiles and tests every generated C++ translation, including all the `*_lifted.cpp` targets, only without optimization. CI cannot see translation bugs that appear only when the optimizer runs: - #437: at /O2 the optimizer deletes a guest read whose value is unused. The original faults on a bad pointer, but the translation returns normally. Differential runs compiled at /O2 found it. CI did not. - #385 (merged): the CRT-free startup and lifetime fixtures failed to link at /O2 because the compiler turned byte loops into `memcpy` calls. CI never built at /O2, so it did not catch this. - More generally, only the optimizer exploits undefined behavior in generated C++, such as signed overflow, aliasing and out-of-range shifts. ## Change - `CMakePresets.json`: add `release` configure, build and test presets. They mirror `dev` with `CMAKE_BUILD_TYPE=Release` (`/O2 /Ob2 /DNDEBUG`) and `binaryDir` `out/build/release`. `dev` is unchanged. - `.github/workflows/windows.yml`: add a parallel `Build and test on Windows at /O2` job. It sets up Python the same way as the existing job, then configures, builds and runs `ctest --preset release --no-tests=error -E '_hardware$'`. The existing Debug job, the GPU package step and the upload step are unchanged. I chose a separate job over extra steps in the existing one for two reasons. A failure that appears only at /O2 shows up under its own check name, and the job adds no time to the existing job's 20-minute limit. The cost is about 10 s of duplicated Python setup. - `CONTRIBUTING.md`: one sentence on the new job. `README.md`: one sentence under First build on the `release` preset. I confirmed in the generated `build.ninja` that the lifted DLLs (for example `cpu_address_size_lifted.cpp`) compile with `/O2 /Ob2 /DNDEBUG`, and that no target in the Release tree uses `/Od`. ## Evidence Environment: Windows 11 Pro build 26200, VS Build Tools 2026 18.3 / MSVC 19.50.35725, Windows SDK 10.0.26100, Python 3.12, commit `c1ca45b` plus this change. On this machine I excluded `conditional_import_paths`, `static_exe_intake` and `bundled_export_forwarders` locally because of a local setup choice. CI runs them. ```powershell .\tools\dev.ps1 cmake --preset release -DINTAKE_PYTHON=<pe-env python> cmake --build --preset release ctest --preset release --no-tests=error -E '_hardware$|^(conditional_import_paths|static_exe_intake|bundled_export_forwarders)$' ``` | Preset | Configure | Build (620 steps, clean) | Tests | Result | |---|---|---|---|---| | `release` | 1.6 s | 14.1 s | 77.6 s | 139/139 passed; `bvh_wave64_warp` and `wave_shuffle_warp` skipped (capability) | | `dev` | 1.3 s | 18.4 s | 84.3 s | 139/139 passed; the same two skips | No test failed in Release only. `tests/docs_links_check.py` (10 files, 81 links) and `tests/bidi_controls_check.py` (353 files) pass. ## Cost On recent `main` runs, the existing job's configure, build and test step takes 2.1 to 3.1 minutes, and the whole job takes 2.5 to 3.9 minutes. The new job runs in parallel with it, so wall-clock time should barely change. It adds about one more Windows job's worth of runner minutes per push and PR. Runner timings for this PR are below. _AI-assisted (Claude Code)._
upstream-sync closed this pull request 2026-11-24 06:43:05 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!441
No description provided.