diff --git a/.bazelrc b/.bazelrc index 444bbe4b947..67457cf90fb 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,7 +1,10 @@ # Global options + +common build -c opt \ --incompatible_enable_cc_toolchain_resolution \ - --incompatible_require_linker_input_cc_api + --incompatible_require_linker_input_cc_api \ + --noincompatible_disallow_empty_glob # Aliases for user-defined flags build --flag_alias=backend_config=@config//:backend_config diff --git a/.bazelversion b/.bazelversion index 815da58b7a9..ae9a76b9249 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.4.1 +8.0.0 diff --git a/.ci/pipeline/ci.yml b/.ci/pipeline/ci.yml index fc63e1f9fed..53290c83d81 100755 --- a/.ci/pipeline/ci.yml +++ b/.ci/pipeline/ci.yml @@ -26,8 +26,8 @@ pr: variables: OPENBLAS_VERSION : 'v0.3.27' TBB_VERSION : 'v2021.10.0' - VM_IMAGE : 'ubuntu-22.04' - SYSROOT_OS: 'jammy' + VM_IMAGE : 'ubuntu-24.04' + SYSROOT_OS: 'noble' WINDOWS_BASEKIT_URL: 'https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe' WINDOWS_DPCPP_COMPONENTS: 'intel.oneapi.win.mkl.devel:intel.oneapi.win.tbb.devel' @@ -474,7 +474,7 @@ jobs: # Display oneDAL build configuration bazel build @config//:dump echo - cat bazel-bin/external/config/config.json + cat bazel-bin/external/+_repo_rules+config/config.json echo displayName: 'bazel-configure' - script: | diff --git a/MODULE.bazel b/MODULE.bazel index 14f7c53ec9b..f82c02be92e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,3 +1,135 @@ +#=============================================================================== +# Copyright 2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== + module(name = "onedal") +bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "rules_cc", version = "0.0.17") + +declare_onedal_config = use_repo_rule("@onedal//dev/bazel/config:config.bzl", "declare_onedal_config") +declare_onedal_config(name = "config",) + +sh_config_ext = use_extension("@onedal//dev/bazel/toolchains:cc_toolchain_extension.bzl", "cc_toolchain_extension") +use_repo(sh_config_ext, "onedal_cc_toolchain") +register_toolchains("@{}//:all".format("onedal_cc_toolchain")) + + +extra_toolchain_ext = use_extension("@onedal//dev/bazel/toolchains:extra_toolchain_extension.bzl", "onedal_extra_toolchain_extension") +use_repo(extra_toolchain_ext, "onedal_extra_toolchain") +register_toolchains("@{}//:all".format("onedal_extra_toolchain")) + + +opencl_repo = use_repo_rule("@onedal//dev/bazel/deps:opencl.bzl", "opencl_repo") +opencl_repo(name = "opencl") + +openblas_repo = use_repo_rule("@onedal//dev/bazel/deps:openblas.bzl", "openblas_repo") +openblas_repo(name = "openblas", root_env_var = "OPENBLASROOT",) + +tbb_repo = use_repo_rule("@onedal//dev/bazel/deps:tbb.bzl", "tbb_repo") +tbb_repo( + name = "tbb", + root_env_var = "TBBROOT", + urls = [ + "https://files.pythonhosted.org/packages/93/4b/2e29f4266be5a66f21fc2dadcde48f9acea86119d6fb1bb2d2a451222ff7/tbb-2022.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", + "https://files.pythonhosted.org/packages/ff/8c/1eb1f856a7a328242d524f1bf64f2a212d46ce5651168e7c8bc7aeaf0f44/tbb_devel-2022.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", + ], + sha256s = [ + "15a15a4e3ea4c3f3198bdb3c55fac75c589e15ed2ad0bbb080900d355c5b017e", + "474e4ed1dce2efeea1d3652e295a97713df5d0ed854c937ee7d0464c38353c36", + ], + strip_prefixes = [ + "tbb-2022.0.0.data/data", + "tbb_devel-2022.0.0.data/data", + ] +) + +mpi_repo = use_repo_rule("@onedal//dev/bazel/deps:mpi.bzl", "mpi_repo") +mpi_repo( + name = "mpi", + root_env_var = "MPIROOT", + urls = [ + "https://files.pythonhosted.org/packages/0a/7c/0f4de62a3463e4ebcf232352b231427f3b34c6a0a1b102a94da3246cad76/impi_rt-2021.14.0-py2.py3-none-manylinux_2_28_x86_64.whl", + "https://files.pythonhosted.org/packages/10/9f/4ee3244c078b9e9e8f65ec51760e7a6e52988abba92a285ab8b0c4dbafff/impi_devel-2021.14.0-py2.py3-none-manylinux_2_28_x86_64.whl", + ], + sha256s = [ + "f06ac9eba3de9609fb257d714e3041f82334ccfe27a9bec0f90007d6381dd52e", + "6a6ec66719ac4884a40a0504f4f186f51ee4169bece5f4486c31138ed6bcc87d", + ], + strip_prefixes = [ + "impi_rt-2021.14.0.data/data", + "impi_devel-2021.14.0.data/data", + ] +) + +ccl_repo = use_repo_rule("@onedal//dev/bazel/deps:ccl.bzl", "ccl_repo") +ccl_repo( + name = "ccl", + root_env_var = "CCL_ROOT", + urls = [ + "https://files.pythonhosted.org/packages/c4/34/84fcf891faabfcd88e1e054a9268cdbefac8c22ab37d7eea2d9a3bda0f52/oneccl_devel-2021.14.0-py2.py3-none-manylinux_2_28_x86_64.whl", + ], + sha256s = [ + "580641c9d296b673d225ed3ca740b3356d7408a5c792de596a8836fde7d6c79e", + ], + strip_prefixes = [ + "oneccl_devel-2021.14.0.data/data", + ] +) + +mkl_repo = use_repo_rule("@onedal//dev/bazel/deps:mkl.bzl", "mkl_repo") +mkl_repo( + name = "mkl", + root_env_var = "MKLROOT", + urls = [ + "https://files.pythonhosted.org/packages/95/d8/76f53cde7c1df06fcd153b4f6fdf0516aafbfc3239ba8d5a8c354e20bbb2/mkl_static-2025.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", + "https://files.pythonhosted.org/packages/b1/91/b76ab204c03f90d5ce008ba7cf6efd77168059866e96b70277fec959b940/mkl_include-2025.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", + "https://files.pythonhosted.org/packages/b8/d7/ea82194db165d83e22dfedee4d45423477441202e2c321b9e96809d36e63/mkl_devel_dpcpp-2025.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", + ], + sha256s = [ + "706f92fcd6e00cc94155097a87528da52b4c3dda4616c8c334963251773a0d13", + "cf19e274bdd1449ef7285671576c545510bebff669363ee1926779192f618cdd", + "455281a590920fb58628dbc06ac007f2618c7315e4c04748c2a1b62efa01afb3", + ], + strip_prefixes = [ + "mkl_static-2025.0.0.data/data", + "mkl_include-2025.0.0.data/data", + "mkl_devel_dpcpp-2025.0.0.data/data", + ], +) + +onedal_repo = use_repo_rule("@onedal//dev/bazel/deps:onedal.bzl", "onedal_repo") +onedal_repo( + name = "onedal_release", + root_env_var = "DALROOT", +) + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "catch2", + url = "https://github.com/catchorg/Catch2/archive/v3.8.0.tar.gz", + sha256 = "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087", + strip_prefix = "Catch2-3.8.0", +) + +http_archive( + name = "fmt", + url = "https://github.com/fmtlib/fmt/archive/11.1.1.tar.gz", + sha256 = "482eed9efbc98388dbaee5cb5f368be5eca4893456bb358c18b7ff71f835ae43", + strip_prefix = "fmt-11.1.1", + build_file = "@onedal//dev/bazel/deps:fmt.tpl.BUILD", +) diff --git a/WORKSPACE b/WORKSPACE deleted file mode 100644 index ac3b7f57835..00000000000 --- a/WORKSPACE +++ /dev/null @@ -1,122 +0,0 @@ -workspace(name = "onedal") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -load("@onedal//dev/bazel/config:config.bzl", "declare_onedal_config") -declare_onedal_config( - name = "config", -) - -load("@onedal//dev/bazel/toolchains:cc_toolchain.bzl", "declare_onedal_cc_toolchain") -declare_onedal_cc_toolchain( - name = "onedal_cc_toolchain", -) - -load("@onedal//dev/bazel/toolchains:extra_toolchain.bzl", "declare_onedal_extra_toolchain") -declare_onedal_extra_toolchain( - name = "onedal_extra_toolchain", -) - -load("@onedal//dev/bazel/deps:opencl.bzl", "opencl_repo") -opencl_repo( - name = "opencl", -) - -load("@onedal//dev/bazel/deps:openblas.bzl", "openblas_repo") -openblas_repo( - name = "openblas", - root_env_var = "OPENBLASROOT", -) - -load("@onedal//dev/bazel/deps:tbb.bzl", "tbb_repo") -tbb_repo( - name = "tbb", - root_env_var = "TBBROOT", - urls = [ - "https://files.pythonhosted.org/packages/93/4b/2e29f4266be5a66f21fc2dadcde48f9acea86119d6fb1bb2d2a451222ff7/tbb-2022.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", - "https://files.pythonhosted.org/packages/ff/8c/1eb1f856a7a328242d524f1bf64f2a212d46ce5651168e7c8bc7aeaf0f44/tbb_devel-2022.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", - ], - sha256s = [ - "15a15a4e3ea4c3f3198bdb3c55fac75c589e15ed2ad0bbb080900d355c5b017e", - "474e4ed1dce2efeea1d3652e295a97713df5d0ed854c937ee7d0464c38353c36", - ], - strip_prefixes = [ - "tbb-2022.0.0.data/data", - "tbb_devel-2022.0.0.data/data", - ] -) - -load("@onedal//dev/bazel/deps:mpi.bzl", "mpi_repo") -mpi_repo( - name = "mpi", - root_env_var = "MPIROOT", - urls = [ - "https://files.pythonhosted.org/packages/0a/7c/0f4de62a3463e4ebcf232352b231427f3b34c6a0a1b102a94da3246cad76/impi_rt-2021.14.0-py2.py3-none-manylinux_2_28_x86_64.whl", - "https://files.pythonhosted.org/packages/10/9f/4ee3244c078b9e9e8f65ec51760e7a6e52988abba92a285ab8b0c4dbafff/impi_devel-2021.14.0-py2.py3-none-manylinux_2_28_x86_64.whl", - ], - sha256s = [ - "f06ac9eba3de9609fb257d714e3041f82334ccfe27a9bec0f90007d6381dd52e", - "6a6ec66719ac4884a40a0504f4f186f51ee4169bece5f4486c31138ed6bcc87d", - ], - strip_prefixes = [ - "impi_rt-2021.14.0.data/data", - "impi_devel-2021.14.0.data/data", - ] -) - -load("@onedal//dev/bazel/deps:ccl.bzl", "ccl_repo") -ccl_repo( - name = "ccl", - root_env_var = "CCL_ROOT", - urls = [ - "https://files.pythonhosted.org/packages/c4/34/84fcf891faabfcd88e1e054a9268cdbefac8c22ab37d7eea2d9a3bda0f52/oneccl_devel-2021.14.0-py2.py3-none-manylinux_2_28_x86_64.whl", - ], - sha256s = [ - "580641c9d296b673d225ed3ca740b3356d7408a5c792de596a8836fde7d6c79e", - ], - strip_prefixes = [ - "oneccl_devel-2021.14.0.data/data", - ] -) - -load("@onedal//dev/bazel/deps:mkl.bzl", "mkl_repo") -mkl_repo( - name = "mkl", - root_env_var = "MKLROOT", - urls = [ - "https://files.pythonhosted.org/packages/95/d8/76f53cde7c1df06fcd153b4f6fdf0516aafbfc3239ba8d5a8c354e20bbb2/mkl_static-2025.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", - "https://files.pythonhosted.org/packages/b1/91/b76ab204c03f90d5ce008ba7cf6efd77168059866e96b70277fec959b940/mkl_include-2025.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", - "https://files.pythonhosted.org/packages/b8/d7/ea82194db165d83e22dfedee4d45423477441202e2c321b9e96809d36e63/mkl_devel_dpcpp-2025.0.0-py2.py3-none-manylinux_2_28_x86_64.whl", - ], - sha256s = [ - "706f92fcd6e00cc94155097a87528da52b4c3dda4616c8c334963251773a0d13", - "cf19e274bdd1449ef7285671576c545510bebff669363ee1926779192f618cdd", - "455281a590920fb58628dbc06ac007f2618c7315e4c04748c2a1b62efa01afb3", - ], - strip_prefixes = [ - "mkl_static-2025.0.0.data/data", - "mkl_include-2025.0.0.data/data", - "mkl_devel_dpcpp-2025.0.0.data/data", - ], -) - -load("@onedal//dev/bazel/deps:onedal.bzl", "onedal_repo") -onedal_repo( - name = "onedal_release", - root_env_var = "DALROOT", -) - -http_archive( - name = "catch2", - url = "https://github.com/catchorg/Catch2/archive/v3.8.0.tar.gz", - sha256 = "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087", - strip_prefix = "Catch2-3.8.0", -) - -http_archive( - name = "fmt", - url = "https://github.com/fmtlib/fmt/archive/11.1.1.tar.gz", - sha256 = "482eed9efbc98388dbaee5cb5f368be5eca4893456bb358c18b7ff71f835ae43", - strip_prefix = "fmt-11.1.1", - build_file = "@onedal//dev/bazel/deps:fmt.tpl.BUILD", -) diff --git a/dev/bazel/config/config.bzl b/dev/bazel/config/config.bzl index c8c3a03d580..b93267bdf07 100644 --- a/dev/bazel/config/config.bzl +++ b/dev/bazel/config/config.bzl @@ -151,11 +151,11 @@ def _dump_config_info_impl(ctx): config_file = ctx.actions.declare_file("config.json") flags_json = [] for target in ctx.attr.flags: - json = " {}: {},".format(target.label.name, target[ConfigFlagInfo].to_json()) - flags_json.append(json) + target_json = " {}: {},".format(target.label.name, json.encode(target[ConfigFlagInfo])) + flags_json.append(target_json) content = ("{\n" + - " cpu: {},\n".format(ctx.attr.cpu_info[CpuInfo].to_json()) + - " version: {},\n".format(ctx.attr.version_info[VersionInfo].to_json()) + + " cpu: {},\n".format(json.encode(ctx.attr.cpu_info[CpuInfo])) + + " version: {},\n".format(json.encode(ctx.attr.version_info[VersionInfo])) + " flags: {\n" + "\n".join(flags_json) + "\n" + " }\n" + diff --git a/dev/bazel/flags.bzl b/dev/bazel/flags.bzl index 71d5f3b867f..86b7f408d1b 100644 --- a/dev/bazel/flags.bzl +++ b/dev/bazel/flags.bzl @@ -60,6 +60,8 @@ def get_default_flags(arch_id, os_id, compiler_id, category = "common"): flags = flags + ["-Wno-unused-command-line-argument"] if compiler_id == "gcc" or compiler_id == "icpx": flags = flags + ["-Wno-gnu-zero-variadic-macro-arguments"] + if compiler_id == "gcc": + flags = flags + ["-Wno-dangling-reference"] if compiler_id not in ["icx", "icpx"]: flags = flags + ["-fno-strict-overflow"] return flags diff --git a/dev/bazel/toolchains/cc_toolchain.bzl b/dev/bazel/toolchains/cc_toolchain.bzl index 9644fcef39a..cdbee978f86 100644 --- a/dev/bazel/toolchains/cc_toolchain.bzl +++ b/dev/bazel/toolchains/cc_toolchain.bzl @@ -70,6 +70,3 @@ onedal_cc_toolchain = repository_rule( ], ) -def declare_onedal_cc_toolchain(name): - onedal_cc_toolchain(name = name) - native.register_toolchains("@{}//:all".format(name)) diff --git a/dev/bazel/toolchains/cc_toolchain_extension.bzl b/dev/bazel/toolchains/cc_toolchain_extension.bzl new file mode 100644 index 00000000000..dd1713de3f7 --- /dev/null +++ b/dev/bazel/toolchains/cc_toolchain_extension.bzl @@ -0,0 +1,21 @@ +#=============================================================================== +# Copyright 2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== + +load("@onedal//dev/bazel/toolchains:cc_toolchain.bzl", "onedal_cc_toolchain") + +cc_toolchain_extension = module_extension( + implementation = lambda ctx: onedal_cc_toolchain(name = "onedal_cc_toolchain"), +) diff --git a/dev/bazel/toolchains/cc_toolchain_lnx.bzl b/dev/bazel/toolchains/cc_toolchain_lnx.bzl index e9c5b631be6..350be3b6148 100644 --- a/dev/bazel/toolchains/cc_toolchain_lnx.bzl +++ b/dev/bazel/toolchains/cc_toolchain_lnx.bzl @@ -15,7 +15,7 @@ #=============================================================================== load( - "@bazel_tools//tools/cpp:lib_cc_configure.bzl", + "@rules_cc//cc/private/toolchain:lib_cc_configure.bzl", "auto_configure_fail", "get_starlark_list", "write_builtin_include_directory_paths", diff --git a/dev/bazel/toolchains/common.bzl b/dev/bazel/toolchains/common.bzl index 73b846d1f46..671f59cc90a 100644 --- a/dev/bazel/toolchains/common.bzl +++ b/dev/bazel/toolchains/common.bzl @@ -19,7 +19,7 @@ load( "get_default_flags", "get_cpu_flags", ) -load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", +load("@rules_cc//cc/private/toolchain:lib_cc_configure.bzl", "get_starlark_list", ) diff --git a/dev/bazel/toolchains/extra_toolchain.bzl b/dev/bazel/toolchains/extra_toolchain.bzl index e2a3b6d14db..f78be8abab8 100644 --- a/dev/bazel/toolchains/extra_toolchain.bzl +++ b/dev/bazel/toolchains/extra_toolchain.bzl @@ -51,6 +51,3 @@ onedal_extra_toolchain = repository_rule( implementation = _onedal_extra_toolchain_impl, ) -def declare_onedal_extra_toolchain(name): - onedal_extra_toolchain(name = name) - native.register_toolchains("@{}//:all".format(name)) diff --git a/dev/bazel/toolchains/extra_toolchain_extension.bzl b/dev/bazel/toolchains/extra_toolchain_extension.bzl new file mode 100644 index 00000000000..6f641f4f124 --- /dev/null +++ b/dev/bazel/toolchains/extra_toolchain_extension.bzl @@ -0,0 +1,21 @@ +#=============================================================================== +# Copyright 2025 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== + +load("@onedal//dev/bazel/toolchains:extra_toolchain.bzl", "onedal_extra_toolchain") + +onedal_extra_toolchain_extension = module_extension( + implementation = lambda ctx: onedal_extra_toolchain(name = "onedal_extra_toolchain"), +)