···8686 ];
8787 };
88888989- bazel-build = buildBazelPackage {
8989+ # Copy-paste from TF derivation.
9090+ # Most of these are not really used in jaxlib compilation but it's simpler to keep it
9191+ # 'as is' so that it's more compatible with TF derivation.
9292+ tf_system_libs = [
9393+ "absl_py"
9494+ "astor_archive"
9595+ "astunparse_archive"
9696+ "boringssl"
9797+ # Not packaged in nixpkgs
9898+ # "com_github_googleapis_googleapis"
9999+ # "com_github_googlecloudplatform_google_cloud_cpp"
100100+ "com_github_grpc_grpc"
101101+ "com_google_protobuf"
102102+ # Fails with the error: external/org_tensorflow/tensorflow/core/profiler/utils/tf_op_utils.cc:46:49: error: no matching function for call to 're2::RE2::FullMatch(absl::lts_2020_02_25::string_view&, re2::RE2&)'
103103+ # "com_googlesource_code_re2"
104104+ "curl"
105105+ "cython"
106106+ "dill_archive"
107107+ "double_conversion"
108108+ "flatbuffers"
109109+ "functools32_archive"
110110+ "gast_archive"
111111+ "gif"
112112+ "hwloc"
113113+ "icu"
114114+ "jsoncpp_git"
115115+ "libjpeg_turbo"
116116+ "lmdb"
117117+ "nasm"
118118+ "opt_einsum_archive"
119119+ "org_sqlite"
120120+ "pasta"
121121+ "png"
122122+ "pybind11"
123123+ "six_archive"
124124+ "snappy"
125125+ "tblib_archive"
126126+ "termcolor_archive"
127127+ "typing_extensions_archive"
128128+ "wrapt"
129129+ "zlib"
130130+ ];
131131+132132+ bazel-build = buildBazelPackage rec {
90133 name = "bazel-build-${pname}-${version}";
9113492135 bazel = bazel_5;
···169212 CFG
170213 '';
171214172172- # Copy-paste from TF derivation.
173173- # Most of these are not really used in jaxlib compilation but it's simpler to keep it
174174- # 'as is' so that it's more compatible with TF derivation.
175175- TF_SYSTEM_LIBS = lib.concatStringsSep "," ([
176176- "absl_py"
177177- "astor_archive"
178178- "astunparse_archive"
179179- "boringssl"
180180- # Not packaged in nixpkgs
181181- # "com_github_googleapis_googleapis"
182182- # "com_github_googlecloudplatform_google_cloud_cpp"
183183- "com_github_grpc_grpc"
184184- "com_google_protobuf"
185185- # Fails with the error: external/org_tensorflow/tensorflow/core/profiler/utils/tf_op_utils.cc:46:49: error: no matching function for call to 're2::RE2::FullMatch(absl::lts_2020_02_25::string_view&, re2::RE2&)'
186186- # "com_googlesource_code_re2"
187187- "curl"
188188- "cython"
189189- "dill_archive"
190190- "double_conversion"
191191- "flatbuffers"
192192- "functools32_archive"
193193- "gast_archive"
194194- "gif"
195195- "hwloc"
196196- "icu"
197197- "jsoncpp_git"
198198- "libjpeg_turbo"
199199- "lmdb"
200200- "nasm"
201201- "opt_einsum_archive"
202202- "org_sqlite"
203203- "pasta"
204204- "png"
205205- "pybind11"
206206- "six_archive"
207207- "snappy"
208208- "tblib_archive"
209209- "termcolor_archive"
210210- "typing_extensions_archive"
211211- "wrapt"
212212- "zlib"
213213- ] ++ lib.optionals (!stdenv.isDarwin) [
214214- "nsync" # fails to build on darwin
215215- ]);
216216-217215 # Make sure Bazel knows about our configuration flags during fetching so that the
218216 # relevant dependencies can be downloaded.
219217 bazelFlags = [
220218 "-c opt"
221221- ] ++ lib.optionals (stdenv.targetPlatform.isx86_64 && stdenv.targetPlatform.isUnix) [
222222- "--config=avx_posix"
223223- ] ++ lib.optionals cudaSupport [
224224- "--config=cuda"
225225- ] ++ lib.optionals mklSupport [
226226- "--config=mkl_open_source_only"
227219 ] ++ lib.optionals stdenv.cc.isClang [
228220 # bazel depends on the compiler frontend automatically selecting these flags based on file
229221 # extension but our clang doesn't.
···231223 "--cxxopt=-x" "--cxxopt=c++" "--host_cxxopt=-x" "--host_cxxopt=c++"
232224 ];
233225226226+ # We intentionally overfetch so we can share the fetch derivation across all the different configurations
234227 fetchAttrs = {
228228+ TF_SYSTEM_LIBS = lib.concatStringsSep "," tf_system_libs;
229229+ # we have to force @mkl_dnn_v1 since it's not needed on darwin
230230+ bazelTargets = bazelTargets ++ [ "@mkl_dnn_v1//:mkl_dnn" ];
231231+ bazelFlags = bazelFlags ++ [
232232+ "--config=avx_posix"
233233+ ] ++ lib.optionals cudaSupport [
234234+ # ideally we'd add this unconditionally too, but it doesn't work on darwin
235235+ # we make this conditional on `cudaSupport` instead of the system, so that the hash for both
236236+ # the cuda and the non-cuda deps can be computed on linux, since a lot of contributors don't
237237+ # have access to darwin machines
238238+ "--config=cuda"
239239+ ] ++ [
240240+ "--config=mkl_open_source_only"
241241+ ];
242242+235243 sha256 =
236244 if cudaSupport then
237237- "sha256-n8wo+hD9ZYO1SsJKgyJzUmjRlsz45WT6tt5ZLleGvGY="
238238- else {
239239- x86_64-linux = "sha256-A0A18kxgGNGHNQ67ZPUzh3Yq2LEcRV7CqR9EfP80NQk=";
240240- aarch64-linux = "sha256-mU2jzuDu89jVmaG/M5bA3jSd7n7lDi+h8sdhs1z8p1A=";
241241- x86_64-darwin = "sha256-9nNTpetvjyipD/l8vKlregl1j/OnZKAcOCoZQeRBvts=";
242242- aarch64-darwin = "sha256-FqYwI1YC5eqSv+DYj09DC5IaBfFDUCO97y+TFhGiWAA=";
243243- }.${stdenv.system} or (throw "unsupported system ${stdenv.system}");
245245+ "sha256-4yu4y4SwSQoeaOz9yojhvCRGSC6jp61ycVDIKyIK/l8="
246246+ else
247247+ "sha256-CyRfPfJc600M7VzR3/SQX/EAyeaXRJwDQWot5h2XnFU=";
244248 };
245249246250 buildAttrs = {
247251 outputs = [ "out" ];
248252253253+ TF_SYSTEM_LIBS = lib.concatStringsSep "," (tf_system_libs ++ lib.optionals (!stdenv.isDarwin) [
254254+ "nsync" # fails to build on darwin
255255+ ]);
256256+257257+ bazelFlags = bazelFlags ++ lib.optionals (stdenv.targetPlatform.isx86_64 && stdenv.targetPlatform.isUnix) [
258258+ "--config=avx_posix"
259259+ ] ++ lib.optionals cudaSupport [
260260+ "--config=cuda"
261261+ ] ++ lib.optionals mklSupport [
262262+ "--config=mkl_open_source_only"
263263+ ];
249264 # Note: we cannot do most of this patching at `patch` phase as the deps are not available yet.
250265 # 1) Fix pybind11 include paths.
251266 # 2) Link protobuf from nixpkgs (through TF_SYSTEM_LIBS when using gcc) to prevent crashes on