Repository navigation
Expand file tree
/
Copy pathMODULE.bazel
More file actions
245 lines (207 loc) · 7.91 KB
/
Copy pathMODULE.bazel
File metadata and controls
245 lines (207 loc) · 7.91 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
module(name = "heir")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_cc", version = "0.2.25")
# hermetic LLVM toolchain (for C++ compiler and linker)
bazel_dep(name = "llvm", version = "0.8.16")
register_toolchains("@llvm//toolchain:all")
# The hermetic LLVM project comes with LLVM sources, but we need a newer MLIR
# that what is in the LLVM source from a versioned release. Instead, we only
# load the hermetic LLVM sources to get access to the `libopenmp`, needed for
# OpenFHE. With the block below, openmp is available via
#
# bazel query @hermetic_llvm//openmp:libomp
#
llvm = use_extension("@llvm//extensions:llvm.bzl", "llvm")
llvm.configure(
targets = [
"AArch64",
"AMDGPU",
"X86",
],
)
use_repo(llvm, hermetic_llvm = "llvm-project")
bazel_dep(name = "apple_support", version = "2.8.1")
# Gazelle puglin for BUILD file autogeneration
bazel_dep(name = "gazelle", version = "0.51.3")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.8.2", dev_dependency = True)
# provides the `license` rule, which is required because llvm's gentbl_rule
# implicitly depends upon the target '//:license'. How bizarre.
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "rules_cuda", version = "0.3.0")
single_version_override(
module_name = "rules_cuda",
patch_strip = 1,
patches = ["//patches:rules_cuda_dctk_components.patch"],
version = "0.3.0",
)
bazel_dep(name = "rules_go", version = "0.62.0")
bazel_dep(name = "rules_python", version = "1.8.0")
bazel_dep(name = "googletest", version = "1.17.0")
bazel_dep(name = "fuzztest", version = "20250805.0")
bazel_dep(name = "google_benchmark", version = "1.9.1")
bazel_dep(name = "abseil-cpp", version = "20250512.1", repo_name = "com_google_absl")
bazel_dep(name = "abseil-py", version = "2.1.0")
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
bazel_dep(name = "rules_shell", version = "0.8.0")
bazel_dep(name = "re2", version = "2025-08-12")
bazel_dep(name = "isl", version = "0.27")
bazel_dep(name = "pocketfft", version = "0.0.2.bcr.1")
bazel_dep(name = "abc", version = "0.65-yosyshq")
bazel_dep(name = "yosys", version = "0.64")
bazel_dep(name = "openfhe", version = "1.4.2.bcr.1")
single_version_override(
module_name = "openfhe",
patch_strip = 1,
patches = [
"//patches:openfhe_module.patch",
"//patches:openfhe.patch",
],
)
# yosys deps needing newer versions for bazel compatibility
bazel_dep(name = "fmt", version = "12.1.0")
bazel_dep(name = "m4", version = "1.4.21.bcr.1")
bazel_dep(name = "libffi", version = "3.4.7.bcr.4")
bazel_dep(name = "bison", version = "3.8.2.bcr.5")
single_version_override(
module_name = "bison",
patch_strip = 1,
patches = ["//patches:bison.patch"],
version = "3.8.2.bcr.5",
)
# Clang 21 compatibility
# Cf. https://github.com/bazelbuild/bazel-central-registry/pull/7989
bazel_dep(name = "gawk", version = "5.3.2.bcr.7")
# Clang 21 compatibility
# Cf. https://github.com/bazelbuild/bazel-central-registry/pull/7915
bazel_dep(name = "sed", version = "4.9.bcr.5")
# LLVM dependency requires us to manually pull in some transitive deps.
# This is required because our LLVM version stays very close to HEAD,
# and the LLVM sources included with the hermetic runtime are too old.
bazel_dep(name = "zlib-ng", version = "2.3.3.bcr.2", repo_name = "llvm_zlib")
bazel_dep(name = "zstd", version = "1.5.7.bcr.1", repo_name = "llvm_zstd")
bazel_dep(name = "xz", version = "5.4.5.bcr.9", repo_name = "llvm_xz")
llvm_extensions = use_extension("//bazel:extensions.bzl", "llvm_deps")
use_repo(
llvm_extensions,
"llvm-raw",
)
# CHEDDAR GPU FHE library (opt-in, requires CUDA).
cheddar_extensions = use_extension("//bazel:extensions.bzl", "cheddar_deps")
use_repo(cheddar_extensions, "cheddar", "libtommath", "rmm")
# CHEDDAR's headers leak spdlog (via RMM) and nlohmann_json includes.
bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.2")
bazel_dep(name = "spdlog", version = "1.17.0")
# CUDA for CHEDDAR
cuda = use_extension("@rules_cuda//cuda:extensions.bzl", "toolchain")
# NVIDIA publishes no macOS CUDA redistributable; on non-Linux hosts rules_cuda
# resolves this to a disabled toolkit, which is fine because CHEDDAR targets are
# Linux-x86_64 only. Do not add `components = [...]` here: that path indexes the
# redist JSON by host platform and hard-fails on macOS.
cuda.redist_json(
name = "cuda_redist",
sha256 = "8335301010b0023ee1ff61eb11e2600ca62002d76780de4089011ad77e0c7630",
version = "12.9.1",
)
cuda.toolkit(name = "cuda")
use_repo(cuda, "cuda")
# The subset of LLVM backend targets that should be compiled
_LLVM_TARGETS = [
"X86",
# Needed for Apple M1 targets, see
# https://github.com/j2kun/mlir-tutorial/issues/11
"AArch64",
]
# Configure LLVM project using use_repo_rule
llvm_configure = use_repo_rule("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
llvm_configure(
name = "llvm-project",
targets = _LLVM_TARGETS,
)
# eigen 4.0.0-20241125.bcr.1 has issues with gitlab changing the checksum
# Cf. https://github.com/google/heir/issues/1840
bazel_dep(name = "eigen", version = "3.4.0.bcr.3")
bazel_dep(name = "soplex", version = "7.1.4.bcr.1")
bazel_dep(name = "or-tools", version = "9.12", repo_name = "com_google_ortools")
# openfhe deps that are needed for bundling openfhe with the python frontend
bazel_dep(name = "cereal", version = "1.3.2.bcr.3")
# Hermetic python setup
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
python.toolchain(python_version = "3.11")
python.toolchain(python_version = "3.12")
# or-tools requires python3.13
python.toolchain(python_version = "3.13")
pip.parse(
hub_name = "heir_pip_deps",
python_version = "3.11",
requirements_lock = "//:requirements.txt",
)
use_repo(python, python_3_11 = "python_3_11")
use_repo(pip, "heir_pip_deps")
# Go setup
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
# Bazel ignores go.mod for the purpose of selecting a go version. To see which
# go version will be used, run:
#
# bazel run @rules_go//go -- version
#
go_sdk.download(version = "1.26.0")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
# All *direct* Go dependencies of the module have to be listed explicitly.
use_repo(
go_deps,
"com_github_tuneinsight_lattigo_v6",
)
# compile_commands extracts the relevant compile data from bazel into
# `compile_commands.json` so that clangd, clang-tidy, etc., can use it.
# Whenever a build file changes, you must re-run
#
# bazel run @hedron_compile_commands//:refresh_all
#
# to ingest new data into these tools.
#
# See the project repo for more details and configuration options
# https://github.com/hedronvision/bazel-compile-commands-extractor
#
# For the override pointing to a different repo, see
# https://github.com/hedronvision/bazel-compile-commands-extractor/pull/219
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
commit = "02d15621b528efd877f5d5657c4b738523a0eb17",
remote = "https://github.com/mikael-s-persson/bazel-compile-commands-extractor",
)
bazel_dep(name = "rules_rust", version = "0.74.0")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2024",
versions = ["1.92.0"],
)
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.spec(
features = ["derive"],
package = "clap",
version = "4.5.54",
)
crate.spec(
package = "rayon",
version = "1.11.0",
)
crate.spec(
features = ["derive"],
package = "serde",
version = "1.0.228",
)
crate.spec(
features = [
"boolean",
"shortint",
"integer",
],
package = "tfhe",
version = "1.5.0",
)
crate.from_specs()
use_repo(crate, "crates")