Bazel: align compiler and Windows toolchain behavior with Make - #3705
Open
napetrov wants to merge 8 commits into
Open
Bazel: align compiler and Windows toolchain behavior with Make#3705napetrov wants to merge 8 commits into
napetrov wants to merge 8 commits into
Conversation
added 7 commits
July 22, 2026 14:37
napetrov
marked this pull request as ready for review
July 23, 2026 14:17
napetrov
requested review from
Alexandr-Solovev,
homksei and
icfaust
as code owners
July 23, 2026 14:17
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns Bazel’s compiler/toolchain behavior with the existing Make-based contract to reduce parity gaps during the ongoing Make→Bazel migration work (issue #3530), with a focus on x86-64 ISA flag matrices, Windows toolchain/runtime behavior, and Windows CI reproducibility.
Changes:
- Updates GCC/Clang ISA flag selection in Bazel (and GCC SKX in Make) to ensure distinct SSE2/AVX2/AVX-512 compilation targets (e.g.,
-march=skylake-avx512for AVX-512). - Improves toolchain correctness: derives the DPC++ archiver from the DPC++ compiler path (fail-fast if missing), fixes Windows CPU detector compilation/output naming, and selects Windows CRT flags (
-MDvs-MDd) via a dedicated toolchain feature. - Ensures Windows Bazel nightly builds are reproducible by explicitly setting and validating
BAZEL_SH, and updates Windows Bazel setup documentation accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dev/make/compiler_definitions/gnu.32e.mk | Updates GCC SKX target to -march=skylake-avx512 to match the Bazel ISA matrix. |
| dev/bazel/toolchains/cc_toolchain_lnx.bzl | Derives llvm-ar from the selected DPC++ compiler location and fails configuration when absent. |
| dev/bazel/toolchains/cc_toolchain_config_win.bzl | Adds a toolchain feature to select /MD vs /MDd behavior (via -MD/-MDd) based on build mode. |
| dev/bazel/README.md | Clarifies that Windows Bazel build/test/analysis require BAZEL_SH (not just bazel test). |
| dev/bazel/flags.bzl | Aligns GCC/Clang ISA flags (including AVX-512) and removes unconditional Windows -MD from shared ICX flags. |
| dev/bazel/config/config.bzl | Builds the CPU detector with MSVC on Windows and uses the expected .exe output name. |
| dev/bazel/cc/compile.bzl | Propagates MSVC /arch settings to CPU-tier compilation actions to match Make’s dispatch-object behavior. |
| .github/workflows/nightly-build.yml | Sets and validates BAZEL_SH explicitly for the Windows nightly Bazel release step (fail-fast if missing). |
Signed-off-by: Ubuntu <ubuntu@ip-172-31-3-43.ec2.internal>
homksei
approved these changes
Jul 25, 2026
Alexandr-Solovev
approved these changes
Jul 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR closes seven reproducible compiler/toolchain parity gaps found while auditing the Bazel path against the existing Make behavior for issue #3530.
The changes are intentionally kept as seven focused commits. Together they align x86-64 ISA selection across GCC, Clang, ICX, and the MSVC fallback; fix Windows CPU detection and CRT selection; derive the DPC++ archiver from the selected compiler; and make the Windows nightly
BAZEL_SHrequirement explicit and fail-fast.This is progress toward #3530, but it does not claim that every Make-only platform or feature is ready for deprecation.
What changed
ISA parity
-march=skylake-avx512for GCC SKX objects in both Make and Bazel.-march=nocona-march=haswell-march=skylake-avx512/archoption/arch:AVX2/arch:AVX2Toolchain/runtime behavior
llvm-arfrom the selected DPC++ compiler path instead of slicing the unrelated host compiler path; fail configuration when the companion archiver is absent..exeoutput name expected by Windows./MD/MDd-MDfrom the shared Windows ICX flags.Windows nightly reproducibility
BAZEL_SHto Git for Windows Bash.BAZEL_SH.Commit structure
build: enable AVX-512 for GCC skx targetsbazel: define Clang CPU ISA flagsbazel: derive DPC++ archiver from compiler pathbazel: compile CPU detector with MSVC on Windowsbazel: select Windows CRT by build modebazel: add MSVC CPU ISA flagsci: require Bazel shell on Windows nightlyThe CRT removal/addition is atomic in commit 5; the workflow and documentation change are paired in commit 7.
Validation
Linux — exact clean PR head
Validated on clean head
f7ab546fb85dd1c41098f4132c01060ecd7fbcedwith Bazel 9.2.0./opt/intel/oneapi/compiler/2026.0/bin/compiler/llvm-arResult: rc 0, 3,188 actions, 17m50s.
Produced-release gates also passed:
mkl_symbolsWindows — cumulative source-equivalent patch
Validated on Windows Server 2025 with:
19.44.352272026.0.0Source integrity checks passed for the exact eight-file cumulative diff:
git diff --check, reverse patch application, file inventory, and SHA-256 preservation.Materialized MSVC parameters:
/arch/arch:AVX2/arch:AVX2Materialized CRT parameters:
/MD/MDdAdditional Windows gates:
avx512BAZEL_SHguard: rc 0BAZEL_SHguard: rc 1 with the expected diagnostic//examples/daal/cpp:library_version_info_host: rc 0, 1,933 actionsResult: rc 0, 3,294 actions, 49m43s.
Earlier Windows
LNK1180/server-reset attempts were traced to a user-levelC:\b-cacheupload duplicating the multi-gigabyteonedal_core.libarchive until the disk reached zero free bytes. The same source passed after removing only that disposable cache and explicitly disabling cache upload. No compiler/linker source failure remained.Current
mainapplicabilityAll seven commits were cherry-picked, in order and without conflicts, onto
main@9d920262384e681331fca9c3c4ed481e477ae81bin a disposable checkout.//:release --release_dpc=false --cpu=all --nobuildpassed with ICX/Bazel 9.2.0: rc 0, 4,641 configured targetsIndependent review
Two independent passes reviewed the cumulative diff:
The recommendation was to keep this as one PR with the seven logical commits rather than squash or split it.
Draft / merge gates
This PR intentionally starts as a draft.
Before marking ready/merging:
Scope boundary
This series does not by itself complete global Make deprecation. Remaining broader items include non-x86 platforms, macOS, OpenRNG and other Make-only switches, real DPC CPU/GPU execution coverage, sanitizer execution, downstream-consumer gates, ABI/release-comparison hardening, performance/build-time/hermeticity gates, and Bazel-backed nupkg/documentation deliverables.
Checklist
Completeness and readability
/arch:AVX2mapping.Testing
Performance