Skip to content

Configure-time guard for known-bad Windows toolchains (#36) - #39

Merged
OldCrow merged 2 commits into
mainfrom
feat/36-windows-toolchain-guard
Sep 19, 2026
Merged

OldCrow merged 2 commits into
mainfrom
feat/36-windows-toolchain-guard

Conversation

@OldCrow

@OldCrow OldCrow commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Closes #36. cmake/ToolchainGuard.cmake turns two advisory Windows hazards into configure-time behaviour.

Toolchain Behaviour
mingw GCC, AVX2+ targets compiled in FATAL_ERROR naming GCC PR 126741, both escapes in the message
mingw GCC, capped to 128-bit tiers configures silently
mingw GCC + CORVUS_ALLOW_UNSUPPORTED_TOOLCHAIN=ON WARNING
real MSVC deliberately capped at AVX2 by corvus ((HWY_AVX3|(HWY_AVX3-1)) OR-ed into HWY_DISABLED_TARGETS), announced every configure: WARNING top-level, NOTICE as a subproject
real MSVC + CORVUS_MSVC_UNBLOCK_AVX512=ON both caps lifted, existing warning
clang-cl, GNU-driver clang untouched — the guard keys on compiler ID GNU/MSVC only

No string parsing. A two-sided compile probe asks Highway's own HWY_TARGETS whether a wide target survives the cap. It immediately showed that the hand-written "HWY_AVX3|HWY_AVX2" is not a 128-bit cap — AVX3_DL/AVX3_ZEN4/AVX3_SPR stay compiled — which is the false-confidence case the issue warned about. A broken probe reports PROBE_FAILED and is treated as uncapped, never as capped.

Why the MSVC cap is explicit: today MSVC tops out at AVX2 only because Highway's HWY_BROKEN_MSVC says so. If upstream adds a version floor (#28), an MSVC build would silently start compiling AVX-512 kernels nobody validated. The notice is unconditional rather than host-CPU-dependent because the cap governs what is compiled, and the configure host is often not the run host.

Verification

  • toolchain_guard ctest: the verdict function in cmake -P script mode, every leg, mutation-checked (breaking the Windows match fails 3 verdicts).
  • Local (Kaby Lake): system match widened to Darwin in a scratch copy, configured with Homebrew g++-16 — uncapped → fatal, 128-bit cap → OK, partial cap → fatal, override → warning.
  • This PR's Windows job: two configure-only mingw steps (reject, capped-accept) reusing the job's Highway checkout, plus the MSVC configure now printing the cap notice with CORVUS_EXPECT_TARGET=AVX2 still holding.
  • Owed on the Zen 4 box, not blocking: the real "32/33 segfaults becomes one refusal" confirmation.

No GCC version condition yet — no fixed release exists; #29 is the trigger.

🤖 Generated with Claude Code

OldCrow and others added 2 commits September 19, 2026 16:13
Two combinations configured and built cleanly while being wrong; both
were advisory prose until the test suite (21 s of segfaults) enforced one.

- mingw GCC with any AVX2-or-wider target compiled in is now a
  FATAL_ERROR naming GCC PR 126741, with both escapes in the message: cap
  to the 128-bit tiers, or CORVUS_ALLOW_UNSUPPORTED_TOOLCHAIN=ON (warns).
- Real MSVC is capped at AVX2 by corvus itself — (HWY_AVX3|(HWY_AVX3-1))
  OR-ed into HWY_DISABLED_TARGETS — so a change to Highway's blocklist
  cannot silently widen an unvalidated build. Announced on every MSVC
  configure (WARNING top-level, NOTICE as a subproject);
  CORVUS_MSVC_UNBLOCK_AVX512 lifts both caps.
- clang-cl and GNU-driver clang pass untouched: the guard keys on the
  compiler ID, never on CMake's MSVC/MINGW variables.

The guard does not parse CORVUS_DISABLED_TARGETS. A two-sided compile
probe asks Highway's own HWY_TARGETS whether a wide target survives the
cap; it showed the hand-written "HWY_AVX3|HWY_AVX2" is not a 128-bit cap
(AVX3_DL/ZEN4/SPR stay compiled) — the false-confidence case the issue
warned about. The verdict is a pure function, tested in cmake -P on
every leg (mutation-checked); the Windows job gains two configure-only
mingw steps that reuse its Highway checkout.

Verified locally by widening the system match to Darwin in a scratch
copy and configuring with Homebrew g++-16: uncapped -> fatal, 128-bit
cap -> OK, partial cap -> fatal, override -> warning.

Closes #36

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n the Windows job comment

The unquoted $(pkg-config ...) was intentional word splitting, flagged by
shellcheck via actionlint. reviewdog reports per touched file, so the
pre-existing warning surfaced on this PR. An explicit array keeps the
behaviour and states the intent.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@OldCrow
OldCrow merged commit b222046 into main Sep 19, 2026
8 checks passed
@OldCrow
OldCrow deleted the feat/36-windows-toolchain-guard branch September 19, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure-time guard: reject known-bad Windows toolchain/tier combinations

1 participant