ci(build): restore -C target-cpu=x86-64-v3 on published x86_64 builds (#20) #22
No reviewers
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#22
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-20"
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?
Restore
-C target-cpu=x86-64-v3for the published x86_64 release builds!17(#16) made the AVX2/BMI2 baseline opt-in viaRUSTFLAGSand removed itfrom
.cargo/config.toml, but no workflow set it — so every release binarysilently compiled at the plain x86-64 baseline. This PR sets
RUSTFLAGSpermatrix row on the two x86_64 entries only:
build-linux,x86_64-unknown-linux-gnu(artifactgopher64-linux-x86_64):RUSTFLAGS="-C target-cpu=x86-64-v3"build-windows,x86_64-pc-windows-msvc(artifactgopher64-windows-x86_64.exe):RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608"— the Windows row carries the 8 MB stack link-arg across because
RUSTFLAGSREPLACES the config's rustflags rather than appending(the trap
!17documents at.cargo/config.toml:31).Implementation note: the flags are applied by a small
if:step that writesRUSTFLAGSinto$GITHUB_ENVonly whenmatrix.targetis the x86_64 row.Deliberately NOT a
RUSTFLAGS: ${{ matrix.rustflags }}env on the Build step:an empty-string
RUSTFLAGS(what an undefined matrix key evaluates to) alsoREPLACES config rustflags, which would silently drop the aarch64-rows'
-fuse-ld=lld//STACK:8388608link-args. The aarch64 / macOS / androidjobs are therefore byte-identical to
main.Verification
grep -rc RUSTFLAGS .github/workflows/build.yml→ 9 (non-zero).grep -rc RUSTFLAGS .github/workflows/lint.yml/sec.yml→ 0 / 0; the onlyRUSTFLAGS=lines inbuild.ymlare the two new steps(
.github/workflows/build.yml:78linux,:134windows).echo "RUSTFLAGS=-C target-cpu=x86-64-v3" >> $GITHUB_ENVecho "RUSTFLAGS=-C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608" >> $env:GITHUB_ENV.cargo/config.tomlis byte-identical toorigin/main(git diff origin/main -- .cargo/config.tomlis empty — acceptance criterion 3).RUSTFLAGS="-C target-cpu=x86-64-v3" cargo build -v→ the rustc invocationcarries
-C target-cpu=x86-64-v3; andrustc -C target-cpu=x86-64-v3 -C link-arg=/STACK:8388608 --print cfgparses both flags cleanly (no errors).git diff --checkclean; workflow YAML parses (jobs:unchanged list:build-linux, build-windows, build-macos, build-android, collect-artifacts).
Out of scope per the issue:
.cargo/config.tomlleft alone (including thex86-64-v2 comment, which would require touching that file), aarch64/macOS
entries untouched, default baseline decision unchanged.
Closes #20
Merged - and it gets the RUSTFLAGS-replacement trap right
Restores
-C target-cpu=x86-64-v3for published x86_64 artifacts only, setper matrix row in CI rather than in
.cargo/config.toml.The load-bearing detail, which this PR handles correctly:
RUSTFLAGSreplaces the config's rustflags wholesale, it does not append. So the
Windows row must carry the stack link-arg alongside the CPU flag, and it does:
Dropping that
/STACK:8388608would have silently cut the Windows binary'smain-thread stack from 8 MiB back to the default -- which matters more than it
looks:
size_of::<Device>()is 307,968 bytes and this repo genuinely needsthat headroom (see #23). The aarch64 rows are correctly left without any
RUSTFLAGS, so their-fuse-ld=lldlink-arg survives.Keeps #16's portability fix intact: the default build stays x86-64-v2 for the
Sandy Bridge review box, and the optimised baseline stays opt-in.
Gate, against the composed MERGE RESULT
Not each PR alone --
main+ !21 + !22 + !14 merged into one warm clone on thereview box (WSL), then
./scripts/gate.sh:Control on
origin/main@8a46ac5in the same clone:gate_exit=0, butstep 3 ran 0 tests. So this set also makes gate step 3 non-vacuous for the
first time -- 0 -> 4 real tests.