2021-05-18 15:42:25 -07:00
|
|
|
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
|
|
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
|
|
|
|
|
2025-01-16 10:12:46 -08:00
|
|
|
SKYLIB_VERSION = "1.7.1"
|
2021-07-16 11:49:50 -07:00
|
|
|
|
|
|
|
|
http_archive(
|
|
|
|
|
name = "bazel_skylib",
|
2025-01-16 10:12:46 -08:00
|
|
|
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
|
2021-07-16 11:49:50 -07:00
|
|
|
urls = [
|
2024-02-12 11:35:17 -08:00
|
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION),
|
|
|
|
|
"https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION),
|
2021-07-16 11:49:50 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2024-12-10 13:07:52 -08:00
|
|
|
http_archive(
|
|
|
|
|
name = "rules_cc",
|
|
|
|
|
sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
|
|
|
|
|
strip_prefix = "rules_cc-0.0.17",
|
2025-01-16 10:12:46 -08:00
|
|
|
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
|
2024-12-10 13:07:52 -08:00
|
|
|
)
|
|
|
|
|
|
2021-08-18 09:14:42 +02:00
|
|
|
new_local_repository(
|
|
|
|
|
name = "llvm-raw",
|
|
|
|
|
build_file_content = "# empty",
|
2022-12-28 08:13:20 -08:00
|
|
|
path = "../../",
|
2021-08-17 14:45:43 -07:00
|
|
|
)
|
2021-08-08 15:19:33 +02:00
|
|
|
|
2021-08-18 09:14:42 +02:00
|
|
|
load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
|
|
|
|
|
|
|
|
|
|
llvm_configure(name = "llvm-project")
|
|
|
|
|
|
2024-07-18 17:23:02 -07:00
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "rules_python",
|
2024-12-10 13:07:52 -08:00
|
|
|
sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
|
|
|
|
|
strip_prefix = "rules_python-1.0.0",
|
|
|
|
|
url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
|
2024-07-18 17:23:02 -07:00
|
|
|
)
|
|
|
|
|
|
2021-05-18 15:42:25 -07:00
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
2023-05-19 23:03:46 +02:00
|
|
|
name = "llvm_zlib",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
|
|
|
|
|
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
|
|
|
|
|
strip_prefix = "zlib-ng-2.0.7",
|
2021-05-18 15:42:25 -07:00
|
|
|
urls = [
|
2023-05-19 23:03:46 +02:00
|
|
|
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
|
2021-05-18 15:42:25 -07:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "vulkan_headers",
|
2021-08-18 09:14:42 +02:00
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:vulkan_headers.BUILD",
|
2021-05-18 15:42:25 -07:00
|
|
|
sha256 = "19f491784ef0bc73caff877d11c96a48b946b5a1c805079d9006e3fbaa5c1895",
|
|
|
|
|
strip_prefix = "Vulkan-Headers-9bd3f561bcee3f01d22912de10bb07ce4e23d378",
|
|
|
|
|
urls = [
|
|
|
|
|
"https://github.com/KhronosGroup/Vulkan-Headers/archive/9bd3f561bcee3f01d22912de10bb07ce4e23d378.tar.gz",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2021-08-18 09:14:42 +02:00
|
|
|
load("@llvm-raw//utils/bazel:vulkan_sdk.bzl", "vulkan_sdk_setup")
|
2021-05-18 15:42:25 -07:00
|
|
|
|
|
|
|
|
maybe(
|
|
|
|
|
vulkan_sdk_setup,
|
|
|
|
|
name = "vulkan_sdk",
|
|
|
|
|
)
|
|
|
|
|
|
2024-05-10 14:20:09 -07:00
|
|
|
http_archive(
|
|
|
|
|
name = "build_bazel_apple_support",
|
|
|
|
|
sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
|
|
|
|
|
url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
load(
|
|
|
|
|
"@build_bazel_apple_support//lib:repositories.bzl",
|
|
|
|
|
"apple_support_dependencies",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
apple_support_dependencies()
|
|
|
|
|
|
2022-11-18 10:14:37 +00:00
|
|
|
# llvm libc math tests reply on `mpfr`.
|
|
|
|
|
# The availability of `mpfr` is controlled by a flag and can be either `disable`, `system` or `external`.
|
|
|
|
|
# Continuous integration uses `system` to speed up the build process (see .bazelrc).
|
|
|
|
|
# Otherwise by default it is set to `external`: `mpfr` and `gmp` are built from source by using `rules_foreign_cc`.
|
|
|
|
|
# Note: that building from source requires `m4` to be installed on the host machine.
|
|
|
|
|
# This is a known issue: https://github.com/bazelbuild/rules_foreign_cc/issues/755.
|
|
|
|
|
|
2024-07-18 21:56:37 -05:00
|
|
|
http_archive(
|
2022-11-18 10:14:37 +00:00
|
|
|
name = "rules_foreign_cc",
|
2024-07-18 21:56:37 -05:00
|
|
|
sha256 = "4b33d62cf109bcccf286b30ed7121129cc34cf4f4ed9d8a11f38d9108f40ba74",
|
|
|
|
|
strip_prefix = "rules_foreign_cc-0.11.1",
|
|
|
|
|
url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.11.1/rules_foreign_cc-0.11.1.tar.gz",
|
2022-11-18 10:14:37 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
|
2022-12-28 08:13:20 -08:00
|
|
|
|
2022-11-18 10:14:37 +00:00
|
|
|
rules_foreign_cc_dependencies()
|
|
|
|
|
|
|
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "gmp",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:gmp.BUILD",
|
|
|
|
|
sha256 = "fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2",
|
|
|
|
|
strip_prefix = "gmp-6.2.1",
|
|
|
|
|
urls = [
|
|
|
|
|
"https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz",
|
|
|
|
|
"https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2022-11-21 09:38:42 +00:00
|
|
|
# https://www.mpfr.org/mpfr-current/
|
2023-01-09 10:26:25 +01:00
|
|
|
#
|
|
|
|
|
# When updating to a newer version, don't use URLs with "mpfr-current" in them.
|
|
|
|
|
# Instead, find a stable URL like the one used currently.
|
2022-11-18 10:14:37 +00:00
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "mpfr",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:mpfr.BUILD",
|
2022-11-21 09:38:42 +00:00
|
|
|
sha256 = "9cbed5d0af0d9ed5e9f8dd013e17838eb15e1db9a6ae0d371d55d35f93a782a7",
|
|
|
|
|
strip_prefix = "mpfr-4.1.1",
|
2023-01-09 10:26:25 +01:00
|
|
|
urls = ["https://www.mpfr.org/mpfr-4.1.1/mpfr-4.1.1.tar.gz"],
|
2022-11-18 10:14:37 +00:00
|
|
|
)
|
|
|
|
|
|
2025-03-04 11:05:01 -08:00
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "mpc",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:mpc.BUILD",
|
|
|
|
|
sha256 = "ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8",
|
|
|
|
|
strip_prefix = "mpc-1.3.1",
|
|
|
|
|
urls = ["https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz"],
|
|
|
|
|
)
|
|
|
|
|
|
2022-12-28 08:13:20 -08:00
|
|
|
maybe(
|
2024-07-18 21:56:37 -05:00
|
|
|
http_archive,
|
2022-12-28 08:13:20 -08:00
|
|
|
name = "pfm",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:pfm.BUILD",
|
2024-07-18 21:56:37 -05:00
|
|
|
sha256 = "d18b97764c755528c1051d376e33545d0eb60c6ebf85680436813fa5b04cc3d1",
|
|
|
|
|
strip_prefix = "libpfm-4.13.0",
|
|
|
|
|
urls = ["https://versaweb.dl.sourceforge.net/project/perfmon2/libpfm4/libpfm-4.13.0.tar.gz"],
|
2022-12-28 08:13:20 -08:00
|
|
|
)
|
2023-03-29 01:29:05 +02:00
|
|
|
|
|
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "llvm_zstd",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
|
|
|
|
|
sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
|
|
|
|
|
strip_prefix = "zstd-1.5.2",
|
|
|
|
|
urls = [
|
2024-02-12 11:35:17 -08:00
|
|
|
"https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
|
2023-03-29 01:29:05 +02:00
|
|
|
],
|
|
|
|
|
)
|
2024-07-18 17:23:02 -07:00
|
|
|
|
|
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "pybind11",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:pybind.BUILD",
|
|
|
|
|
sha256 = "201966a61dc826f1b1879a24a3317a1ec9214a918c8eb035be2f30c3e9cfbdcb",
|
|
|
|
|
strip_prefix = "pybind11-2.10.3",
|
|
|
|
|
url = "https://github.com/pybind/pybind11/archive/v2.10.3.zip",
|
|
|
|
|
)
|
|
|
|
|
|
2024-12-09 16:37:43 -05:00
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "robin_map",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:robin_map.BUILD",
|
2025-01-16 10:12:46 -08:00
|
|
|
sha256 = "a8424ad3b0affd4c57ed26f0f3d8a29604f0e1f2ef2089f497f614b1c94c7236",
|
|
|
|
|
strip_prefix = "robin-map-1.3.0",
|
2024-12-09 16:37:43 -05:00
|
|
|
url = "https://github.com/Tessil/robin-map/archive/refs/tags/v1.3.0.tar.gz",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
maybe(
|
|
|
|
|
http_archive,
|
|
|
|
|
name = "nanobind",
|
|
|
|
|
build_file = "@llvm-raw//utils/bazel/third_party_build:nanobind.BUILD",
|
[mlir python] Port Python core code to nanobind. (#120473)
Relands #118583, with a fix for Python 3.8 compatibility. It was not
possible to set the buffer protocol accessers via slots in Python 3.8.
Why? https://nanobind.readthedocs.io/en/latest/why.html says it better
than I can, but my primary motivation for this change is to improve MLIR
IR construction time from JAX.
For a complicated Google-internal LLM model in JAX, this change improves
the MLIR
lowering time by around 5s (out of around 30s), which is a significant
speedup for simply switching binding frameworks.
To a large extent, this is a mechanical change, for instance changing
`pybind11::` to `nanobind::`.
Notes:
* this PR needs Nanobind 2.4.0, because it needs a bug fix
(https://github.com/wjakob/nanobind/pull/806) that landed in that
release.
* this PR does not port the in-tree dialect extension modules. They can
be ported in a future PR.
* I removed the py::sibling() annotations from def_static and def_class
in `PybindAdapters.h`. These ask pybind11 to try to form an overload
with an existing method, but it's not possible to form mixed
pybind11/nanobind overloads this ways and the parent class is now
defined in nanobind. Better solutions may be possible here.
* nanobind does not contain an exact equivalent of pybind11's buffer
protocol support. It was not hard to add a nanobind implementation of a
similar API.
* nanobind is pickier about casting to std::vector<bool>, expecting that
the input is a sequence of bool types, not truthy values. In a couple of
places I added code to support truthy values during casting.
* nanobind distinguishes bytes (`nb::bytes`) from strings (e.g.,
`std::string`). This required nb::bytes overloads in a few places.
2024-12-18 21:55:42 -05:00
|
|
|
sha256 = "bb35deaed7efac5029ed1e33880a415638352f757d49207a8e6013fefb6c49a7",
|
|
|
|
|
strip_prefix = "nanobind-2.4.0",
|
|
|
|
|
url = "https://github.com/wjakob/nanobind/archive/refs/tags/v2.4.0.tar.gz",
|
2024-12-09 16:37:43 -05:00
|
|
|
)
|
|
|
|
|
|
2024-07-18 17:23:02 -07:00
|
|
|
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
|
|
|
|
|
|
|
|
|
|
py_repositories()
|
|
|
|
|
|
|
|
|
|
python_register_toolchains(
|
|
|
|
|
name = "python_3_12",
|
|
|
|
|
python_version = "3.12",
|
|
|
|
|
)
|