feat: bazel 9.0 migration#3496
Conversation
14ea6c3 to
2828725
Compare
There was a problem hiding this comment.
Pull request overview
Updates the repository’s Bazel/Bzlmod integration to align with a Bazel 9.0 toolchain/rules ecosystem, primarily by switching C++ rule/provider imports to rules_cc and bumping the pinned Bazel version.
Changes:
- Bump Bazel from 8.5.1 to 9.0.0 and update documented
rules_ccversion. - Migrate multiple BUILD/.bzl files to load C++ rules/providers from
@rules_cc(and addrules_shellforsh_binary). - Adjust the Linux C++ toolchain Starlark config to use
rules_cc-hosted action names/config lib.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
.bazelversion |
Pins Bazel 9.0.0 for the migration. |
MODULE.bazel |
Adds rules_shell dependency; keeps rules_cc at 0.2.16. |
BUILD |
Adds rules_cc load at repo root (used for Bazel 9 migration consistency). |
dev/bazel/AGENTS.md |
Updates the documented rules_cc version. |
dev/bazel/cc.bzl |
Uses @rules_cc-loaded rules/providers in custom C++ rules. |
dev/bazel/cc/common.bzl |
Switches to @rules_cc-loaded C++ providers/common APIs. |
dev/bazel/cc/compile.bzl |
Switches to @rules_cc-loaded C++ APIs. |
dev/bazel/cc/link.bzl |
Switches to @rules_cc-loaded C++ APIs/providers for linking logic. |
dev/bazel/dal.bzl |
Updates C++ rule loads for Bazel 9/rules_cc alignment. |
dev/bazel/release.bzl |
Uses CcInfo loaded from rules_cc to collect headers/libs. |
dev/bazel/deps/ccl.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/deps/dpl.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/deps/mkl.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/deps/mpi.tpl.BUILD |
Migrates to rules_cc loads and adds sh_binary for mpiexec. |
dev/bazel/deps/onedal.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/deps/openblas.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/deps/opencl.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/deps/tbb.tpl.BUILD |
Migrates dependency BUILD template to rules_cc loads. |
dev/bazel/toolchains/cc_toolchain_config_lnx.bzl |
Moves toolchain config imports to rules_cc equivalents and updates toolchain config info creation signature. |
dev/bazel/toolchains/cc_toolchain_lnx.tpl.BUILD |
Updates toolchain template to load cc_toolchain from rules_cc. |
|
/intelci: run |
|
/intelci: run |
| #=============================================================================== | ||
|
|
||
| load("@rules_cc//cc/common:cc_common.bzl", "cc_common") | ||
| load("@rules_cc//cc:defs.bzl", "cc_toolchain") |
There was a problem hiding this comment.
The loaded cc_toolchain symbol from @rules_cc//cc:defs.bzl is not referenced in this file (there are no cc_toolchain(...) calls), and its name is also shadowed by function parameters named cc_toolchain. Consider removing this load (or renaming the parameters if you actually intended to use the loaded rule) to avoid confusion and buildifier/lint warnings.
| load("@rules_cc//cc:defs.bzl", "cc_toolchain") |
| "*.so", | ||
| "*.so.*", | ||
| ], | ||
| exclude = ["*.py", "*.cmake", "*.a"], | ||
| allow_empty = True, | ||
| ), | ||
| linkopts = ["-lOpenCL"], |
There was a problem hiding this comment.
opencl_binary now globs and adds every *.so/*.so.* in the OpenCL external repo as srcs. In cc_library, prebuilt .so files in srcs participate in linking, so this will pull in all symlinked DPC++ runtime DSOs (e.g., libsycl, libsvml, etc.) into link actions for any target that depends on @opencl//:opencl_binary. If the intent is only to make these DSOs available at runtime, consider separating “link” vs “runtime files” (e.g., keep opencl_binary focused on -lOpenCL / libOpenCL* and expose a separate filegroup for runtime DSOs to be consumed via data).
| "*.so", | |
| "*.so.*", | |
| ], | |
| exclude = ["*.py", "*.cmake", "*.a"], | |
| allow_empty = True, | |
| ), | |
| linkopts = ["-lOpenCL"], | |
| "libOpenCL*.so", | |
| "libOpenCL*.so.*", | |
| ], | |
| allow_empty = True, | |
| ), | |
| linkopts = ["-lOpenCL"], | |
| visibility = ["//visibility:public"], | |
| ) | |
| filegroup( | |
| name = "opencl_runtime_dsos", | |
| srcs = glob( | |
| [ | |
| "*.so", | |
| "*.so.*", | |
| ], | |
| allow_empty = True, | |
| ), |
Draft Comment for PR #3496General ReviewThanks @Alexandr-Solovev for the Bazel 9.0 migration work! Most of the changes look good. I've reviewed Copilot's comments and have feedback: 🔴 Critical Issue:
|
PR #3496 Fix InstructionsOverviewFix issues identified in Bazel 9.0 migration PR review. One critical issue (opencl) and multiple cleanup issues (unused imports). 🔴 Critical Fix: opencl.tpl.BUILD and opencl.bzlProblemCurrent implementation adds all DPC++ runtime libraries to link phase, causing potential bloat and conflicts. File 1:
|
Description
Add Bazel 9.0 Support
Summary
This PR adds support for Bazel 9.0 and updates the build configuration to be compatible with the latest Bazel changes.
Main Changes
rules_shelldependency to supportsh_binarytargets:Motivation
Bazel 9.0 moves several features out of the core distribution into external rule sets. This PR aligns the project with the new structure and ensures forward compatibility.
Checklist:
Completeness and readability
Testing
Performance