Release CI lost -C target-cpu=x86-64-v3: !17 made it opt-in via RUSTFLAGS and no workflow sets it #20
Labels
No Label
blocked
bounced
in-progress
in-review
manual-only
needs-guidance
netplay
p1
p2
p3
rust
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: pbwraith/gopher64-netplay#20
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What changed
!17(#16) merged today. It makes the x86_64 build portable by removing theforced
-C target-cpu=x86-64-v3from.cargo/config.tomland making it opt-invia
RUSTFLAGS. That was necessary and correct -- on a pre-AVX2 host the flagmiscompiles dependency build scripts (
num-traits' build script SIGABRTs on a648518346341351440-byte allocation), so the review box could not build the repo
at all.
The gap it opens
RUSTFLAGSis now the only way to get the optimised target back, and nothingsets it. Measured on
origin/issue-16@800495c, before merge:So every release binary now compiles at the Rust default x86_64 baseline
instead of
x86-64-v3. The affected invocations in.github/workflows/build.ymlare:x86_64-unknown-linux-gnux86_64-pc-windows-msvcBoth are published as release artifacts (
build.yml:293,:295pushgopher64-linux-x86_64andgopher64-windows-x86_64.exeto itch via butler).This matters more than usual here because gopher64 is an emulator: the JIT and
the RSP/RDP paths are per-frame hot code, and AVX2/BMI2 is exactly the kind of
win that was being taken. Nobody will see a build failure -- the binaries just
get slower, silently.
Scope
Restore
x86-64-v3for the published x86_64 release builds only, by settingRUSTFLAGSon those two jobs (or on the two matrix entries). Do not put it backin
.cargo/config.toml-- that is the thing that broke the review box, and!17's portable default is deliberate.Note the trap
!17documents at.cargo/config.toml:31:RUSTFLAGSREPLACESthe config's rustflags rather than appending. The Windows x86_64 entry
currently relies on
[target.'cfg(target_os = "windows")'] rustflags = ["-C", "link-arg=/STACK:8388608"],so a bare
RUSTFLAGS="-C target-cpu=x86-64-v3"on that job would drop the 8 MBstack link-arg. Carry it across:
The Linux x86_64 entry has no config rustflags to preserve, so it takes the flag
alone.
Explicitly OUT of scope
.cargo/config.tomlback in any way.target-cpuand areuntouched by
!17.v2vsv3) for the default build. If youwant the default raised to
x86-64-v2, that is a separate decision; note the.cargo/config.toml:28-29comment currently claims the portable baseline"only requires x86-64-v2 (SSE4.2)" while the config actually delivers the
plain
x86-64(v1) default, since it sets no x86_64 rustflags at all. Worthmaking that comment true in the same pass, but it is a comment fix, not a
build change.
Acceptance criteria
grep -rc RUSTFLAGS .github/workflows/build.ymlreturns a non-zero count.-C target-cpu=x86-64-v3, and the windows one still carries-C link-arg=/STACK:8388608..cargo/config.tomlis byte-identical to its post-!17state(
git diff origin/main -- .cargo/config.tomlis empty).RUSTFLAGS.[worker] lane3 implemented — PR #22 (branch
issue-20, basemain).Commit:
f56f42a"ci(build): restore -C target-cpu=x86-64-v3 on published x86_64 builds" (1 file, +17).Per acceptance criteria:
grep -rc RUSTFLAGS .github/workflows/build.yml→ 9 (non-zero); lint.yml and sec.yml stay 0.RUSTFLAGS=-C target-cpu=x86-64-v3; windows x86_64 row:RUSTFLAGS=-C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608(stack arg carried across because RUSTFLAGS replaces config rustflags)..cargo/config.tomlbyte-identical to origin/main (git diff origin/main -- .cargo/config.tomlempty).if: matrix.target == 'x86_64-...'step writing$GITHUB_ENV, so the aarch64 rows never receive any RUSTFLAGS env; macOS/android jobs untouched.Why the if-step instead of
env: RUSTFLAGS: ${{ matrix.rustflags }}: empirically verified with cargo 1.98.0 that an empty-string RUSTFLAGS (what an undefined matrix key evaluates to) REPLACES config rustflags — it would silently drop the aarch64 rows'-fuse-ld=lld//STACK:8388608link-args.Verification: flag strings passed end-to-end through the toolchain (
RUSTFLAGS="-C target-cpu=x86-64-v3" cargo build -v→ rustc line carries-C target-cpu=x86-64-v3;rustc -C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608 --print cfgparses clean).git diff --checkclean; workflow YAML parses.