feat(builder): releases need x86-64-v3 (AVX2 and the rest); a build from source is built for any CPU #2833

Merged
HumanBean merged 1 commit from HumanBean/Longshot:feat/require-x86-64-v3 into main 2026-11-29 23:46:58 +00:00
Owner

Summary

Everything we prebuild and ship is x86-64-v3 (AVX2, FMA, BMI2, MOVBE): the release builders' third-party object set and what a stable's or nightly's pack carries. Players on older CPUs kept hitting that (#2723, #2701, #2664). This PR applies that policy:

  • A release's build on a CPU without every feature of x86-64-v3, as LLVM defines it (toolchain::V3: v2's, then AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE and XSAVE), stops early with cpu_too_old. The message names each missing feature, says this version is prebuilt for x86-64-v3 CPUs, says the Longshot Launcher's build-from-source versions (main or a pull request) work on this CPU, and says how to check (lscpu | grep avx2, CPU-Z or Task Manager). A build counts as a release when its tools carry a BUILD_ORIGIN file that says release. longshot-packager release sources writes it into every stable and nightly pack.
  • A build from source never refuses. That covers a checkout, which has no marker, and from-source's builder, which writes source. The game is built at -march=native. On a CPU without v3, the third-party code is also built for this CPU, with the CPU's name (LONGSHOT_NATIVE_CPU) in its flags and so in its keys, and the prebuilt set is never taken. When clang cannot name the CPU, both are built for the level /proc/cpuinfo shows (x86-64-v2 or x86-64). On such a CPU, from-source no longer compiles or packs a v3 set. CPUs with v3 build as before: native game, v3 third-party code.
  • The release's own set (compile --third-party-objects) is always v3 and never refuses.
  • RX_MARCH stays the developer's override (not checked).
  • game/cloth_cull.cpp now includes immintrin.h under __AVX__ instead of __AVX2__. Its ge128 uses _mm_cmp_ps on AVX, so a native build on Sandy or Ivy Bridge (AVX without AVX2) did not compile. On an AVX2 CPU the code is unchanged.

I checked the other direct AVX2 users at baseline and AVX-only levels: host/rx_backend.c, gpu/vk/vk_memory.cpp, gpu/vk/vk_recorder.h and the other game/cloth_*.cpp. All of them are guarded at compile time with an SSE path. The Rust builder and longshot-rs set no target-cpu, so they are baseline x86-64. RenHDrum's C sets no -march, so its carried copy is baseline too.

Docs: docs/user/requirements.md (AVX2 required for stable and nightly releases; older CPUs build from source in the launcher; CPU generations as examples, with the exceptions), docs/user/common-issues.md, docs/dev/reference/build.md, builder.md and build-events.md. Read V3, Build and choose in builder/crates/build-compile/src/toolchain.rs first.

Testing

Tested: cargo test -p build-compile --lib (60 pass; 5 new tests drive choose with injected CPU features and origins, and fail when the refusal or the native third-party choice is undone), cargo test -p build-driver sources and -p longshot-builder from_source and cargo clippy on the three crates (no new warnings) on Linux. game/cloth_*.cpp compile at -march=x86-64, core2, sandybridge, ivybridge, x86-64-v2 and x86-64-v3 with Linux clang, and cloth_cull.cpp with llvm-mingw at x86-64, sandybridge and x86-64-v3. host/rx_backend.c compiles at those levels on Linux. The game was not run: on a v3 CPU, the flags and the code the game is built from are unchanged (__AVX2__ implies __AVX__). No test was added for the refusal (asked not to).

Still to test: By hand, on a pre-v3 CPU (a tester with one, or Beanstalk if it has one; none here): a release's refusal, and a from-source build and game start, on Windows and Linux.

Measurements

Nothing to measure: on a v3 CPU the flags and the code are unchanged.

Risks

On a pre-v3 CPU, a release's build now refuses (intended) where it used to build for v2 or plain x86-64. A source build on such a CPU compiles its third-party code itself, so its first build takes longer. A PC whose clang cannot name its CPU and has no /proc/cpuinfo (Windows) is taken to have v3, as before.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says (builder check, docs, and a header include that changes nothing on v3; compile-proved at each level).
  • mise run test passes (the builder's cargo test -p build-compile passes; nothing else reads what changed).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • Docs updated.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths (cloth_cull.cpp compiled with both).
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

🤖 Generated with Claude Code

## Summary Everything we prebuild and ship is x86-64-v3 (AVX2, FMA, BMI2, MOVBE): the release builders' third-party object set and what a stable's or nightly's pack carries. Players on older CPUs kept hitting that ([#2723](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2723), [#2701](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2701), [#2664](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2664)). This PR applies that policy: - **A release's build** on a CPU without every feature of x86-64-v3, as LLVM defines it (`toolchain::V3`: v2's, then AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE and XSAVE), stops early with `cpu_too_old`. The message names each missing feature, says this version is prebuilt for x86-64-v3 CPUs, says the Longshot Launcher's build-from-source versions (main or a pull request) work on this CPU, and says how to check (`lscpu | grep avx2`, CPU-Z or Task Manager). A build counts as a release when its tools carry a `BUILD_ORIGIN` file that says `release`. `longshot-packager release sources` writes it into every stable and nightly pack. - **A build from source** never refuses. That covers a checkout, which has no marker, and `from-source`'s builder, which writes `source`. The game is built at `-march=native`. On a CPU without v3, the third-party code is also built for this CPU, with the CPU's name (`LONGSHOT_NATIVE_CPU`) in its flags and so in its keys, and the prebuilt set is never taken. When clang cannot name the CPU, both are built for the level /proc/cpuinfo shows (x86-64-v2 or x86-64). On such a CPU, `from-source` no longer compiles or packs a v3 set. CPUs with v3 build as before: native game, v3 third-party code. - The release's own set (`compile --third-party-objects`) is always v3 and never refuses. - `RX_MARCH` stays the developer's override (not checked). - `game/cloth_cull.cpp` now includes `immintrin.h` under `__AVX__` instead of `__AVX2__`. Its `ge128` uses `_mm_cmp_ps` on AVX, so a native build on Sandy or Ivy Bridge (AVX without AVX2) did not compile. On an AVX2 CPU the code is unchanged. I checked the other direct AVX2 users at baseline and AVX-only levels: `host/rx_backend.c`, `gpu/vk/vk_memory.cpp`, `gpu/vk/vk_recorder.h` and the other `game/cloth_*.cpp`. All of them are guarded at compile time with an SSE path. The Rust builder and longshot-rs set no `target-cpu`, so they are baseline x86-64. RenHDrum's C sets no `-march`, so its carried copy is baseline too. Docs: `docs/user/requirements.md` (AVX2 required for stable and nightly releases; older CPUs build from source in the launcher; CPU generations as examples, with the exceptions), `docs/user/common-issues.md`, `docs/dev/reference/build.md`, `builder.md` and `build-events.md`. Read `V3`, `Build` and `choose` in `builder/crates/build-compile/src/toolchain.rs` first. ## Testing **Tested:** `cargo test -p build-compile --lib` (60 pass; 5 new tests drive `choose` with injected CPU features and origins, and fail when the refusal or the native third-party choice is undone), `cargo test -p build-driver sources` and `-p longshot-builder from_source` and `cargo clippy` on the three crates (no new warnings) on Linux. `game/cloth_*.cpp` compile at `-march=x86-64`, `core2`, `sandybridge`, `ivybridge`, `x86-64-v2` and `x86-64-v3` with Linux clang, and `cloth_cull.cpp` with llvm-mingw at `x86-64`, `sandybridge` and `x86-64-v3`. `host/rx_backend.c` compiles at those levels on Linux. The game was not run: on a v3 CPU, the flags and the code the game is built from are unchanged (`__AVX2__` implies `__AVX__`). No test was added for the refusal (asked not to). **Still to test:** By hand, on a pre-v3 CPU (a tester with one, or Beanstalk if it has one; none here): a release's refusal, and a from-source build and game start, on Windows and Linux. ## Measurements Nothing to measure: on a v3 CPU the flags and the code are unchanged. ## Risks On a pre-v3 CPU, a release's build now refuses (intended) where it used to build for v2 or plain x86-64. A source build on such a CPU compiles its third-party code itself, so its first build takes longer. A PC whose clang cannot name its CPU and has no `/proc/cpuinfo` (Windows) is taken to have v3, as before. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says (builder check, docs, and a header include that changes nothing on v3; compile-proved at each level). - [x] `mise run test` passes (the builder's `cargo test -p build-compile` passes; nothing else reads what changed). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] Docs updated. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths (`cloth_cull.cpp` compiled with both). - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(builder): the game requires x86-64-v3 (AVX2, FMA, BMI2, MOVBE): an older CPU is refused, not built for
Some checks failed
CI / What the change needs (pull_request) Successful in 14s
CI / Third-party parts and guide screenshots (pull_request) Failing after 18s
PR description / Title and description (pull_request_target) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 24s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
bb00b6823c
A CPU without v3's features used to get -march=x86-64-v2 or x86-64 and a
slower game. The builder now stops with cpu_too_old, naming what the CPU
lacks and which CPUs run the game. RX_MARCH stays the developer's override.
The player docs (requirements, common issues) and the builder's reference
state the requirement and how to check it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
HumanBean changed title from WIP: feat(builder): require x86-64-v3 (AVX2): an older CPU is refused, not built for to feat(builder): require x86-64-v3 (AVX2): an older CPU is refused, not built for 2026-11-29 22:33:43 +00:00
HumanBean force-pushed feat/require-x86-64-v3 from bb00b6823c
Some checks failed
CI / What the change needs (pull_request) Successful in 14s
CI / Third-party parts and guide screenshots (pull_request) Failing after 18s
PR description / Title and description (pull_request_target) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 24s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to e7015f39d1
Some checks failed
CI / What the change needs (pull_request) Successful in 14s
CI / Third-party parts and guide screenshots (pull_request) Failing after 17s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 19s
PR description / Title and description (pull_request_target) Successful in 9s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m25s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-11-29 23:04:38 +00:00
Compare
HumanBean changed title from feat(builder): require x86-64-v3 (AVX2): an older CPU is refused, not built for to feat(builder): releases need x86-64-v3 (AVX2); a build from source is built for any CPU 2026-11-29 23:05:01 +00:00
Author
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The release check can accept CPUs missing x86-64-v3 features, and source builds can reuse third-party objects compiled for a different CPU. A valid source-build name can also cause an older CPU to be refused as though it were a release.

The change gives older CPUs a source-build path and explains the release requirement, but CPU classification and object caching can still produce builds that fail on those machines. Source builds on older CPUs also compile a v3 object set that they subsequently discard.

Blocking (2): must change before merging.

  1. L1 builder/crates/build-compile/src/toolchain.rs:127: The v3 check omits required x86-64-v3 features, including BMI1, F16C and LZCNT. (more on the line) Do: Check every required x86-64-v3 feature and OS support before accepting the prebuilt objects; report the missing features.
  2. L5 builder/crates/build-compile/src/toolchain.rs:379: The new refusal and source fallback have no regression test, despite the repository requiring a game-free test for a fix. (more on the line) Do: Add platform-independent tests with injected CPU features and build origins that exercise the refusal, native fallback and prebuilt-set selection, and fail when those behaviors are undone.

Should fix (3): not blocking, but worth doing before merging.

  • L2 builder/crates/build-compile/src/toolchain.rs:404: Native third-party objects are keyed without the native CPU identity. (more on the line) Do: Include the probed native CPU and feature identity in third-party object keys, and handle an unavailable identity without reusing ambiguous native objects.
  • L3 builder/crates/build-compile/src/toolchain.rs:198: A source build is classified as a release solely from its user-chosen version name. (more on the line) Do: Record and read an unambiguous build-origin marker instead of inferring origin from the displayed version name.
  • L4 builder/crates/build-compile/src/lib.rs:405: On an older CPU, from-source compiles and packs a v3 third-party set that the resulting builder always ignores. (more on the line) Do: Have source-pack creation build a correctly keyed native set for that CPU, or omit the unused set on pre-v3 CPUs.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L6 builder/crates/build-compile/src/toolchain.rs:379: The older-CPU release and source-build paths have not been exercised end to end. (more on the line) Do: On pre-v3 Windows and Linux systems, check the release refusal and complete a source build and game launch; record the results.

@fix can do L1, L2, L3, L4 and L5.

Checks: Failing on this head, which is behind its base, where it passes: CI / Third-party parts and guide screenshots (pull_request). @rebase (or @fix) brings it up to date and runs it again; not held against it. Still running: 7 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven: the author reports compiler checks and 55 builder library tests on Linux, but no release refusal or complete source build on a pre-v3 CPU. No game run was reported.

Other systems: The CPU policy affects Windows and Linux builds, source-pack creation, third-party object caches and the game and renderer linked from those objects. The reported compile checks cover selected CPU targets, but do not establish that complete builds and launches work on older hardware.

Switches: RX_MARCH remains unset by default and bypasses the CPU check when set to an explicit level. Its behavior is documented; no new switch was added.

Reviewed: e7015f39d1 against 450e63b828: Read the repository rules, pull request template, diff, commit, changed toolchain and compile preparation paths, and cloth culling code; traced source-pack creation and object keys. Skimmed the changed documentation and related builder references. Tooling's AGENTS.md was not present locally; the network is closed. No recorded runs, translations or generated files were changed.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance with a Co-Authored-By trailer.
  • No game-derived files or generated artifacts appear in the diff.
  • The AVX header guard matches the AVX intrinsic used by ge128.

Testing: Read-only review; no commands from the project, builds or tests were run. CI is still running.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The release check can accept CPUs missing x86-64-v3 features, and source builds can reuse third-party objects compiled for a different CPU. A valid source-build name can also cause an older CPU to be refused as though it were a release. The change gives older CPUs a source-build path and explains the release requirement, but CPU classification and object caching can still produce builds that fail on those machines. Source builds on older CPUs also compile a v3 object set that they subsequently discard. **Blocking (2)**: must change before merging. 1. **L1** `builder/crates/build-compile/src/toolchain.rs:127`: The v3 check omits required x86-64-v3 features, including BMI1, F16C and LZCNT. (more on the line) **Do:** Check every required x86-64-v3 feature and OS support before accepting the prebuilt objects; report the missing features. 2. **L5** `builder/crates/build-compile/src/toolchain.rs:379`: The new refusal and source fallback have no regression test, despite the repository requiring a game-free test for a fix. (more on the line) **Do:** Add platform-independent tests with injected CPU features and build origins that exercise the refusal, native fallback and prebuilt-set selection, and fail when those behaviors are undone. **Should fix (3)**: not blocking, but worth doing before merging. - **L2** `builder/crates/build-compile/src/toolchain.rs:404`: Native third-party objects are keyed without the native CPU identity. (more on the line) **Do:** Include the probed native CPU and feature identity in third-party object keys, and handle an unavailable identity without reusing ambiguous native objects. - **L3** `builder/crates/build-compile/src/toolchain.rs:198`: A source build is classified as a release solely from its user-chosen version name. (more on the line) **Do:** Record and read an unambiguous build-origin marker instead of inferring origin from the displayed version name. - **L4** `builder/crates/build-compile/src/lib.rs:405`: On an older CPU, from-source compiles and packs a v3 third-party set that the resulting builder always ignores. (more on the line) **Do:** Have source-pack creation build a correctly keyed native set for that CPU, or omit the unused set on pre-v3 CPUs. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L6** `builder/crates/build-compile/src/toolchain.rs:379`: The older-CPU release and source-build paths have not been exercised end to end. (more on the line) **Do:** On pre-v3 Windows and Linux systems, check the release refusal and complete a source build and game launch; record the results. `@fix` can do L1, L2, L3, L4 and L5. **Checks:** Failing on this head, which is behind its base, where it passes: `CI / Third-party parts and guide screenshots (pull_request)`. `@rebase` (or `@fix`) brings it up to date and runs it again; not held against it. Still running: 7 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the author reports compiler checks and 55 builder library tests on Linux, but no release refusal or complete source build on a pre-v3 CPU. No game run was reported. **Other systems:** The CPU policy affects Windows and Linux builds, source-pack creation, third-party object caches and the game and renderer linked from those objects. The reported compile checks cover selected CPU targets, but do not establish that complete builds and launches work on older hardware. **Switches:** RX_MARCH remains unset by default and bypasses the CPU check when set to an explicit level. Its behavior is documented; no new switch was added. **Reviewed:** e7015f39d152 against 450e63b8287e: Read the repository rules, pull request template, diff, commit, changed toolchain and compile preparation paths, and cloth culling code; traced source-pack creation and object keys. Skimmed the changed documentation and related builder references. Tooling's AGENTS.md was not present locally; the network is closed. No recorded runs, translations or generated files were changed.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance with a Co-Authored-By trailer. - No game-derived files or generated artifacts appear in the diff. - The AVX header guard matches the AVX intrinsic used by ge128. **Testing:** Read-only review; no commands from the project, builds or tests were run. CI is still running. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -398,2 +402,4 @@
_ => None,
},
// (a build from source on a CPU without x86-64-v3 compiles its third-party code for this CPU: never the set)
_ if !tc.takes_prebuilt() => None,
Member

L4 (should fix): On an older CPU, from-source compiles and packs a v3 third-party set that the resulting builder always ignores.

When: from-source runs compile --third-party-objects before creating its pack; this branch then excludes that set when the player builds on the same pre-v3 CPU. The first source build pays for both the unused v3 compilation and the native compilation.

Do: Have source-pack creation build a correctly keyed native set for that CPU, or omit the unused set on pre-v3 CPUs.

**L4** (should fix): On an older CPU, from-source compiles and packs a v3 third-party set that the resulting builder always ignores. *When:* from-source runs compile --third-party-objects before creating its pack; this branch then excludes that set when the player builds on the same pre-v3 CPU. The first source build pays for both the unused v3 compilation and the native compilation. **Do:** Have source-pack creation build a correctly keyed native set for that CPU, or omit the unused set on pre-v3 CPUs.
@ -124,2 +125,3 @@
/// The CPU levels the game may be built for, by the features they need.
/// The CPU features of x86-64-v3, what every prebuilt part of a release is built for: a release's build on a CPU without
/// them is refused; a build from source is built for the CPU it has.
const V3: &[&str] = &["avx2", "fma", "bmi2", "movbe"];
Member

L1 (blocking): The v3 check omits required x86-64-v3 features, including BMI1, F16C and LZCNT.

When: A virtual CPU exposing AVX2, FMA, BMI2 and MOVBE but masking BMI1 passes this check. The builder then selects x86-64-v3 third-party objects, which may execute BMI1 instructions and fault on that CPU.

Do: Check every required x86-64-v3 feature and OS support before accepting the prebuilt objects; report the missing features.

**L1** (blocking): The v3 check omits required x86-64-v3 features, including BMI1, F16C and LZCNT. *When:* A virtual CPU exposing AVX2, FMA, BMI2 and MOVBE but masking BMI1 passes this check. The builder then selects x86-64-v3 third-party objects, which may execute BMI1 instructions and fault on that CPU. **Do:** Check every required x86-64-v3 feature and OS support before accepting the prebuilt objects; report the missing features.
@ -169,0 +195,4 @@
/// archive do not) names a release (v1.2.3, v1.2.3-rc.4, nightly-<count>-<8 hex>), else [`Build::Source`].
pub fn of_tree(root: &Path) -> Build {
let v = std::fs::read_to_string(root.join("VERSION")).unwrap_or_default();
if is_release_name(v.lines().next().unwrap_or("").trim()) { Build::Release } else { Build::Source }
Member

L3 (should fix): A source build is classified as a release solely from its user-chosen version name.

When: from-source accepts --name v3.1.0 and writes that name into the pack's VERSION. On a pre-v3 CPU the resulting source builder reads it as a release and returns cpu_too_old, although its source build should be supported.

Do: Record and read an unambiguous build-origin marker instead of inferring origin from the displayed version name.

**L3** (should fix): A source build is classified as a release solely from its user-chosen version name. *When:* from-source accepts --name v3.1.0 and writes that name into the pack's VERSION. On a pre-v3 CPU the resulting source builder reads it as a release and returns cpu_too_old, although its source build should be supported. **Do:** Record and read an unambiguous build-origin marker instead of inferring origin from the displayed version name.
@ -343,1 +401,4 @@
));
with("native")
};
Ok((cpu, third, name))
Member

L2 (should fix): Native third-party objects are keyed without the native CPU identity.

When: On a pre-v3 CPU, third-party units receive only -march=native, so their object keys do not distinguish that CPU from another pre-v3 CPU. Moving or sharing the builder store with an older CPU can reuse objects containing instructions it cannot execute.

Do: Include the probed native CPU and feature identity in third-party object keys, and handle an unavailable identity without reusing ambiguous native objects.

**L2** (should fix): Native third-party objects are keyed without the native CPU identity. *When:* On a pre-v3 CPU, third-party units receive only -march=native, so their object keys do not distinguish that CPU from another pre-v3 CPU. Moving or sharing the builder store with an older CPU can reuse objects containing instructions it cannot execute. **Do:** Include the probed native CPU and feature identity in third-party object keys, and handle an unavailable identity without reusing ambiguous native objects.
@ -343,0 +376,4 @@
}
None => (None, missing_v3_of_cpuinfo()),
};
let v3 = missing.is_empty();
Member

L5 (blocking): The new refusal and source fallback have no regression test, despite the repository requiring a game-free test for a fix.

When: Removing the release refusal or allowing the prebuilt set on an older CPU would leave the reported existing tests passing, so the intended behavior can regress unnoticed.

Do: Add platform-independent tests with injected CPU features and build origins that exercise the refusal, native fallback and prebuilt-set selection, and fail when those behaviors are undone.

**L5** (blocking): The new refusal and source fallback have no regression test, despite the repository requiring a game-free test for a fix. *When:* Removing the release refusal or allowing the prebuilt set on an older CPU would leave the reported existing tests passing, so the intended behavior can regress unnoticed. **Do:** Add platform-independent tests with injected CPU features and build origins that exercise the refusal, native fallback and prebuilt-set selection, and fail when those behaviors are undone.
Member

L6 (should fix): The older-CPU release and source-build paths have not been exercised end to end.

When: The reported checks compile selected files and run builder library tests; they do not show that an older CPU receives the refusal or can build and launch the source version.

Do: On pre-v3 Windows and Linux systems, check the release refusal and complete a source build and game launch; record the results.

**L6** (should fix): The older-CPU release and source-build paths have not been exercised end to end. *When:* The reported checks compile selected files and run builder library tests; they do not show that an older CPU receives the refusal or can build and launch the source version. **Do:** On pre-v3 Windows and Linux systems, check the release refusal and complete a source build and game launch; record the results.
HumanBean force-pushed feat/require-x86-64-v3 from e7015f39d1
Some checks failed
CI / What the change needs (pull_request) Successful in 14s
CI / Third-party parts and guide screenshots (pull_request) Failing after 17s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 19s
PR description / Title and description (pull_request_target) Successful in 9s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m25s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to fae312797c
Some checks failed
CI / What the change needs (pull_request) Successful in 11s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 15s
PR description / Title and description (pull_request_target) Successful in 8s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m1s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m10s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has started running
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 3m33s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has started running
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 4m2s
CI / Website build and checks (pull_request) Failing after 37s
2026-11-29 23:44:45 +00:00
Compare
HumanBean left a comment

BeanBot's points L1-L5 are addressed in fae31279; L6 needs pre-v3 hardware, which we don't have here. Each inline reply says what changed.

BeanBot's points L1-L5 are addressed in fae31279; L6 needs pre-v3 hardware, which we don't have here. Each inline reply says what changed.
@ -127,0 +128,4 @@
/// name a player is told). The check ([`missing_v3`]) and the refusal's message ([`cpu_too_old`]) read this one list.
/// The OS's support (OSXSAVE, the YMM state enabled) is in both sources: clang's `-march=native` drops AVX's features
/// where the OS has not enabled them, and Linux takes `avx` out of `/proc/cpuinfo` so.
pub const V3: &[(&str, &str, &str)] = &[
Author
Owner

L1: fixed. V3 now holds every feature of x86-64-v3 as LLVM's X86TargetParser defines it: v2's CX16, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2 and SSSE3, then AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE and XSAVE. Each entry gives clang's name, the /proc/cpuinfo flag and the name shown to the player. The check (missing_v3) and the cpu_too_old message read this one list, and the message names every missing feature. OS support: clang's -march=native drops the AVX features when XCR0 does not enable YMM, and Linux drops avx from cpuinfo in the same case, so both sources already reflect OSXSAVE.

**L1**: fixed. `V3` now holds every feature of x86-64-v3 as LLVM's X86TargetParser defines it: v2's CX16, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2 and SSSE3, then AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE and XSAVE. Each entry gives clang's name, the /proc/cpuinfo flag and the name shown to the player. The check (`missing_v3`) and the `cpu_too_old` message read this one list, and the message names every missing feature. OS support: clang's `-march=native` drops the AVX features when XCR0 does not enable YMM, and Linux drops `avx` from cpuinfo in the same case, so both sources already reflect OSXSAVE.
@ -161,0 +216,4 @@
/// The file at a tree's root that says where its tools come from: `release` (`longshot-packager release sources`, a
/// stable's or a nightly's) or `source` (`from-source`). A checkout has none: a build from source.
pub const ORIGIN_FILE: &str = "BUILD_ORIGIN";
Author
Owner

L3: fixed. The pack now carries a BUILD_ORIGIN file at the tree's root. tree_entries, which only longshot-packager release sources uses (it builds every stable and nightly pack), writes release. from-source writes source. Build::of_tree reads only this marker and ignores VERSION. A missing marker, as in a checkout or a pack made by an older from-source, means a build from source. The test the_origin_is_the_trees_marker... covers a source build named v3.1.0.

**L3**: fixed. The pack now carries a `BUILD_ORIGIN` file at the tree's root. `tree_entries`, which only `longshot-packager release sources` uses (it builds every stable and nightly pack), writes `release`. `from-source` writes `source`. `Build::of_tree` reads only this marker and ignores `VERSION`. A missing marker, as in a checkout or a pack made by an older from-source, means a build from source. The test `the_origin_is_the_trees_marker...` covers a source build named `v3.1.0`.
@ -169,0 +239,4 @@
/// Whether the CPU this program runs on has every feature of [`V3`] its OS has enabled (cpuid and XCR0, as Rust's
/// `is_x86_feature_detected!` reads them; LAHF-SAHF, which it cannot ask, is taken as there): `from-source` makes no
/// x86-64-v3 third-party set for a CPU that could not use it.
pub fn this_cpu_has_v3() -> bool {
Author
Owner

L4: fixed. On a CPU that lacks part of v3 (checked by this_cpu_has_v3 through is_x86_feature_detected!, which reads cpuid and XCR0 on both Windows and Linux), from-source no longer compiles the v3 third-party set and packs none. make_pack takes an optional set. Note that the first source builds use the nightly builder's own from-source code, so this saving starts once a nightly includes this change.

**L4**: fixed. On a CPU that lacks part of v3 (checked by `this_cpu_has_v3` through `is_x86_feature_detected!`, which reads cpuid and XCR0 on both Windows and Linux), `from-source` no longer compiles the v3 third-party set and packs none. `make_pack` takes an optional set. Note that the first source builds use the nightly builder's own from-source code, so this saving starts once a nightly includes this change.
@ -344,0 +467,4 @@
third-party objects, x86-64-v3, are not taken)",
missing.join(", ")
));
cpu.clone()
Author
Owner

L2: fixed. When a build from source compiles native third-party code, it uses the game's flags, which include -DLONGSHOT_NATIVE_CPU=<cpu>_<tune>_<features hash>. The CPU's identity is therefore in those units' keys. When clang cannot name the CPU, the game and the third-party code are both built for the explicit level that /proc/cpuinfo shows (x86-64-v2 or x86-64), never for an unnamed native.

**L2**: fixed. When a build from source compiles native third-party code, it uses the game's flags, which include `-DLONGSHOT_NATIVE_CPU=<cpu>_<tune>_<features hash>`. The CPU's identity is therefore in those units' keys. When clang cannot name the CPU, the game and the third-party code are both built for the explicit level that /proc/cpuinfo shows (x86-64-v2 or x86-64), never for an unnamed native.
@ -350,0 +504,4 @@
}
#[test]
fn a_releases_build_on_a_cpu_without_v3_is_refused_even_unprobed() {
Author
Owner

L6: agreed, but it needs pre-v3 hardware (Windows and Linux), and there is none here. It stays under Still to test for a tester with such a CPU, or Beanstalk if it has one. The decision logic is now covered by the unit tests above.

**L6**: agreed, but it needs pre-v3 hardware (Windows and Linux), and there is none here. It stays under *Still to test* for a tester with such a CPU, or Beanstalk if it has one. The decision logic is now covered by the unit tests above.
@ -350,0 +510,4 @@
}
#[test]
fn a_build_from_source_on_a_cpu_without_v3_is_native_and_named_and_takes_no_prebuilt_set() {
Author
Owner

L5: fixed. cpu_flags' decision is split out into choose, which takes the probed CPU and the cpuinfo answer as injected values. Five tests cover the cases: the full feature list and its missing-feature names, a release refusing on pre-v3 (probed and unprobed), a source build on pre-v3 being native and named with no v3 third-party flags (explicit levels when unprobed; the release set stays v3), v3 unchanged for both origins, and the origin marker. I checked that the tests fail when the behaviour is undone: removing the refusal makes 2 fail, forcing v3 third-party code makes 1 fail.

**L5**: fixed. `cpu_flags`' decision is split out into `choose`, which takes the probed CPU and the cpuinfo answer as injected values. Five tests cover the cases: the full feature list and its missing-feature names, a release refusing on pre-v3 (probed and unprobed), a source build on pre-v3 being native and named with no v3 third-party flags (explicit levels when unprobed; the release set stays v3), v3 unchanged for both origins, and the origin marker. I checked that the tests fail when the behaviour is undone: removing the refusal makes 2 fail, forcing v3 third-party code makes 1 fail.
HumanBean changed title from feat(builder): releases need x86-64-v3 (AVX2); a build from source is built for any CPU to feat(builder): releases need x86-64-v3 (AVX2 and the rest); a build from source is built for any CPU 2026-11-29 23:45:25 +00:00
HumanBean deleted branch feat/require-x86-64-v3 2026-11-29 23:46:59 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2833
No description provided.