Repository navigation
Expand file tree
/
Copy pathMODULE.bazel
More file actions
136 lines (118 loc) · 4.41 KB
/
Copy pathMODULE.bazel
File metadata and controls
136 lines (118 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright 2024 The IREE Authors
#
# 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
"""Bazel module configuration for IREE."""
module(
name = "iree_core",
version = "0.0.1",
)
# Core Bazel dependencies - versions aligned with LLVM's MODULE.bazel
bazel_dep(name = "apple_support", version = "1.24.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_cc", version = "0.2.11")
bazel_dep(name = "rules_python", version = "1.9.0")
# Python pip dependencies
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.11",
requirements_lock = "//build_tools/bazel:requirements.txt",
)
use_repo(pip, "pip")
bazel_dep(name = "rules_shell", version = "0.6.1")
# Required by LLVM (for clang-fuzzer tools)
bazel_dep(name = "protobuf", version = "31.1", repo_name = "com_google_protobuf")
# LLVM also needs these
bazel_dep(name = "rules_android", version = "0.6.6")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
bazel_dep(name = "zlib-ng", version = "2.0.7", repo_name = "llvm_zlib")
bazel_dep(name = "zstd", version = "1.5.7", repo_name = "llvm_zstd")
# Stack trace support on Linux.
bazel_dep(name = "libbacktrace", version = "1.0.0-20250926-7939218")
# LLVM project overlay module
bazel_dep(name = "llvm-project-overlay", version = "main")
local_path_override(
module_name = "llvm-project-overlay",
path = "third_party/llvm-project/utils/bazel",
)
# llvm-project-overlay/llvm/config.bzl refers to @llvm//platforms/config:{gnu,musl}.
# We need to teach the IREE bazel build about `@llvm`, so it can understand this
# reference. The overlay declares @llvm as a dev_dependency, and we should mirror
# it with the same dependency version here.
bazel_dep(name = "llvm", version = "0.8.5")
# Third-party dependencies that LLVM's bzlmod setup now sources from the Bazel
# Central Registry as bazel_deps (previously generated by llvm_repos_extension).
# IREE only references nanobind directly (//runtime/bindings/python); gmp, mpc,
# mpfr, pfm and robin_map are consumed by the LLVM overlay itself, which now
# declares its own bazel_deps for them.
bazel_dep(name = "nanobind", version = "2.12.0.bcr.1")
# Use LLVM's extension for third-party dependencies
llvm_repos_ext = use_extension(
"@llvm-project-overlay//:extensions.bzl",
"llvm_repos_extension",
)
use_repo(
llvm_repos_ext,
"pyyaml",
# Note: vulkan_headers is provided by iree_ext with IREE's custom BUILD.overlay
"vulkan_sdk",
)
# IREE extension creates MLIR-adjacent source repos when IREE is root and other
# IREE-specific repos unconditionally.
iree_ext = use_extension("//build_tools/bazel:extensions.bzl", "iree_extension")
use_repo(
iree_ext,
"abseil_cpp",
"amdgpu_device_libs",
"com_github_dvidelabs_flatcc",
"com_google_benchmark",
"com_google_googletest",
"dawn",
"dlmalloc",
"hip_api_headers",
"hsa_runtime_headers",
"iree_amdgpu_device_toolchain",
"iree_cuda",
"llvm-raw",
"nccl",
"rccl",
"spirv_cross",
"spirv_headers",
"spirv_tools",
"stablehlo",
"torch-mlir-raw",
"tracy_client",
"vulkan_headers",
"wasi_sdk",
"webgpu_headers",
)
# The LLVM overlay imports @llvm-raw from its own llvm_repos_extension, which
# only generates it when the overlay is the root module. IREE is the root
# module here, so inject IREE's @llvm-raw (created by iree_extension) into the
# overlay extension to satisfy its use_repo("llvm-raw").
inject_repo(llvm_repos_ext, "llvm-raw")
# Configure LLVM using the llvm-raw repo (creates llvm-project)
llvm_configure = use_repo_rule("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
llvm_configure(
name = "llvm-project",
targets = [
"AArch64",
"AMDGPU",
"ARM",
"NVPTX",
"RISCV",
"SPIRV",
"WebAssembly",
"X86",
],
)
# Configure torch-mlir using its upstream Bazel overlay. The configured
# repository is only needed when the Torch input plugin is selected.
torch_mlir_configure = use_repo_rule("@torch-mlir-raw//utils/bazel:configure.bzl", "torch_mlir_configure")
torch_mlir_configure(
name = "torch-mlir",
src_workspace = "@torch-mlir-raw//:CMakeLists.txt",
)