-
Notifications
You must be signed in to change notification settings - Fork 0
build: target-cpu=native default + explicit v3 pin, and one pack<const L> for the 12 predicate tails
#313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
build: target-cpu=native default + explicit v3 pin, and one pack<const L> for the 12 predicate tails
#313
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ecf27aa
simd_masking_ops: fold the 12 predicate tails into one `pack<const L>`
claude ad7fb48
build: default target-cpu becomes `native`; v3 moves to an explicit pin
claude d2e62d0
ci: restore the crypto-backend cfgs that the global RUSTFLAGS had dis…
claude a0f2ea8
blackboard (14): the native flip, the two-sided pin, and the RUSTFLAG…
claude c1bd701
simd_nightly: complete the signed-int surface the polyfill promised
claude 038e96d
review: name the distribution tier explicitly, everywhere it is shipped
claude dbf9397
host-native row: the answer, and it is bigger than the question
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # x86-64-v3 (AVX2) — the PORTABLE DISTRIBUTION BASELINE, pinned explicitly. | ||
| # | ||
| # Usage: | ||
| # env -u RUSTFLAGS cargo --config .cargo/config-v3.toml <cmd> | ||
| # CARGO_ARGS='--config .cargo/config-v3.toml' bash scripts/masking-parity.sh native | ||
| # | ||
| # v3 is portable across all x86_64 silicon shipping since ~2013 (Haswell+) and | ||
| # is what a general-distribution build should target. Until 2026-09-16 it was | ||
| # `.cargo/config.toml`'s default and therefore UNNAMED at every call site; the | ||
| # default is now `target-cpu=native` (see that file's superseded-in-place note | ||
| # for why), so the tier a row depends on is named BY that row. This file is | ||
| # where "portable" is spelled. | ||
| # | ||
| # Overlay semantics, measured 2026-09-16: cargo JOINS `target.<cfg>.rustflags` | ||
| # across config files and the LAST `-Ctarget-cpu` wins, so this file needs the | ||
| # target-cpu ONLY — `.cargo/config.toml`'s two crypto-backend cfgs | ||
| # (`curve25519_dalek_backend="serial"`, `poly1305_force_soft`) come through the | ||
| # join and stay in force. Verified with `cargo build -p encryption -v`: both | ||
| # `-Ctarget-cpu` values present, v3 last, both cfgs present. | ||
| # | ||
| # `env -u RUSTFLAGS` is load-bearing: a RUSTFLAGS env REPLACES every | ||
| # cargo-config rustflags entry, so with one set this file does not apply AND | ||
| # neither do the crypto cfgs. | ||
| # | ||
| # No `-Dwarnings` here, deliberately — unlike `config-v4.toml`. A config that | ||
| # promotes warnings to errors turns a disable-run (which typically orphans a | ||
| # binding) into "did not compile", which reads identically to "the guard was | ||
| # not load-bearing" when piped through a grep. The portable arm is the one most | ||
| # likely to be used for a disable-run, so it stays warnings-permissive; the | ||
| # repo's `-D warnings` gate is the explicit clippy invocation. | ||
| [target.'cfg(target_arch = "x86_64")'] | ||
| rustflags = ["-Ctarget-cpu=x86-64-v3"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
cargo build --releaseruns on an AVX-512/VNNI host, this setting permits LLVM to emit those host-only instructions throughout the binary, so deploying that artifact to another supported x86-64-v3 machine can terminate withSIGILLbefore runtime SIMD dispatch helps. This is the repository's documented “Automatic SIMD detection” build (README.md:200-208), while.cargo/config-native.toml:10-11explicitly warns that the identical setting is not portable; either keep v3 as the default or update every distribution-facing build command to pass--config .cargo/config-v3.toml.AGENTS.md reference: AGENTS.md:L9-L12
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, and it caught a real gap in my reasoning: I thought about measurement (which arm a probe grades) and never about distribution (what a plain release build yields). Fixed in
038e96d0by taking your second option — naming the tier at every distribution-facing command rather than reverting the default.README.md— the portable build is nowcargo --config .cargo/config-v3.toml build --release. The host-tuned build stays, labelled "portable nowhere". Your point about runtime dispatch is the load-bearing one and is now in the text:simd_caps()picks among code paths, it cannot un-emit host-only instructions the baseline codegen already placed..cargo/config.toml— carries the caveat, with its real scope stated rather than overstated: nothing ships from a default build today, because this is a[lib]with no bin targets and the published crate does not carry this file to consumers, who build under their own config. The caveat is for this workspace's own artifacts and images.README.md's AVX-512 line had the same shape (RUSTFLAGS="-C target-cpu=x86-64-v4") and is now--config .cargo/config-v4.toml, for the reason below.Chasing this turned up two more instances of the defect the PR's third commit is about. Both Dockerfiles set
ENV RUSTFLAGS="-C target-cpu=x86-64-vN". A RUSTFLAGS env replaces every cargo-configrustflagsentry rather than joining it, so that form sets the tier and silently drops.cargo/config.toml's two crypto-backend cfgs — meaning both images have been shipping curve25519-dalek's and poly1305's raw-intrinsic AVX2 backends, which is exactly what those cfgs exist to keep out. Converted both to--config, which joins. Measured two-sided on the exact commands:poly1305_force_softENV RUSTFLAGS="-C target-cpu=x86-64-v3"cargo --config .cargo/config-v3.tomlSo your P1 was worth more than the one file it pointed at.
Generated by Claude Code