2022-09-22 12:26:48 -07:00
|
|
|
# Copyright 2018 The JAX Authors.
|
2018-11-26 12:37:24 -08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# https://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.
|
|
|
|
|
|
|
|
# JAX is Autograd and XLA
|
|
|
|
|
2019-11-24 13:06:23 -05:00
|
|
|
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
|
2020-12-05 00:07:04 +01:00
|
|
|
load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm")
|
2022-07-01 12:31:16 -07:00
|
|
|
load("//jaxlib:jax.bzl", "if_windows")
|
2019-08-02 11:16:15 -04:00
|
|
|
|
2018-11-26 12:37:24 -08:00
|
|
|
licenses(["notice"]) # Apache 2
|
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2020-11-10 00:23:54 +08:00
|
|
|
py_binary(
|
2020-11-20 09:10:02 -05:00
|
|
|
name = "build_wheel",
|
|
|
|
srcs = ["build_wheel.py"],
|
2018-11-26 12:37:24 -08:00
|
|
|
data = [
|
2020-12-11 06:44:45 -08:00
|
|
|
"LICENSE.txt",
|
2019-04-01 08:21:22 -07:00
|
|
|
"//jaxlib",
|
2022-07-13 14:03:32 -07:00
|
|
|
"//jaxlib:README.md",
|
2020-12-11 10:18:52 -05:00
|
|
|
"//jaxlib:setup.py",
|
2024-01-04 09:25:22 -08:00
|
|
|
"@xla//xla/python:xla_client.py",
|
|
|
|
"@xla//xla/python:xla_extension",
|
2024-05-21 10:22:13 -04:00
|
|
|
"@xla//xla/ffi/api:c_api.h",
|
|
|
|
"@xla//xla/ffi/api:api.h",
|
|
|
|
"@xla//xla/ffi/api:ffi.h",
|
2021-11-25 00:07:25 +08:00
|
|
|
] + if_windows([
|
|
|
|
"//jaxlib/mlir/_mlir_libs:jaxlib_mlir_capi.dll",
|
2023-03-24 12:32:53 -07:00
|
|
|
]) + if_cuda([
|
2022-05-06 13:47:23 -07:00
|
|
|
"//jaxlib/cuda:cuda_gpu_support",
|
2021-04-28 11:43:50 -04:00
|
|
|
"@local_config_cuda//cuda:cuda-nvvm",
|
2020-12-05 00:07:04 +01:00
|
|
|
]) + if_rocm([
|
2022-05-06 13:47:23 -07:00
|
|
|
"//jaxlib/rocm:rocm_gpu_support",
|
2019-08-02 11:16:15 -04:00
|
|
|
]),
|
2023-09-13 16:03:11 -07:00
|
|
|
deps = [
|
|
|
|
"//jax/tools:build_utils",
|
2024-05-15 18:20:14 -07:00
|
|
|
"@bazel_tools//tools/python/runfiles",
|
|
|
|
"@pypi_build//:pkg",
|
|
|
|
"@pypi_wheel//:pkg",
|
|
|
|
"@pypi_setuptools//:pkg",
|
2023-09-13 16:03:11 -07:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2024-01-11 23:09:24 +00:00
|
|
|
py_test(
|
|
|
|
name = "build_wheel_test",
|
|
|
|
srcs = ["build_wheel_test.py"],
|
|
|
|
data = [":build_wheel"],
|
|
|
|
deps = [
|
|
|
|
"@bazel_tools//tools/python/runfiles",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2024-05-30 01:45:31 -07:00
|
|
|
cc_binary(
|
|
|
|
name = "pjrt_c_api_gpu_plugin.so",
|
|
|
|
linkopts = [
|
|
|
|
"-Wl,--version-script,$(location @xla//xla/pjrt/c:pjrt_c_api_gpu_version_script.lds)",
|
|
|
|
"-Wl,--no-undefined",
|
|
|
|
],
|
|
|
|
linkshared = True,
|
|
|
|
deps = [
|
|
|
|
"@xla//xla/pjrt/c:pjrt_c_api_gpu",
|
|
|
|
"@xla//xla/pjrt/c:pjrt_c_api_gpu_version_script.lds",
|
|
|
|
"@xla//xla/service:gpu_plugin",
|
|
|
|
] + if_cuda([
|
2024-07-02 10:50:11 -05:00
|
|
|
"//jaxlib/mosaic/gpu:custom_call",
|
2024-05-30 01:45:31 -07:00
|
|
|
"@xla//xla/stream_executor:cuda_platform",
|
|
|
|
]) + if_rocm([
|
|
|
|
"@xla//xla/stream_executor:rocm_platform",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
2023-09-13 16:03:11 -07:00
|
|
|
py_binary(
|
|
|
|
name = "build_gpu_plugin_wheel",
|
|
|
|
srcs = ["build_gpu_plugin_wheel.py"],
|
|
|
|
data = [
|
|
|
|
"LICENSE.txt",
|
2024-05-30 01:45:31 -07:00
|
|
|
":pjrt_c_api_gpu_plugin.so",
|
2023-09-13 16:03:11 -07:00
|
|
|
] + if_cuda([
|
2023-11-06 09:05:08 -08:00
|
|
|
"//jaxlib:version",
|
2023-09-13 16:03:11 -07:00
|
|
|
"//jaxlib/cuda:cuda_gpu_support",
|
2023-11-14 13:55:32 -08:00
|
|
|
"//jax_plugins/cuda:pyproject.toml",
|
|
|
|
"//jax_plugins/cuda:setup.py",
|
|
|
|
"//jax_plugins/cuda:__init__.py",
|
2023-09-13 16:03:11 -07:00
|
|
|
"@local_config_cuda//cuda:cuda-nvvm",
|
2024-06-12 18:45:01 -05:00
|
|
|
]) + if_rocm([
|
|
|
|
"//jaxlib:version",
|
|
|
|
"//jaxlib/rocm:rocm_gpu_support",
|
|
|
|
"//jax_plugins/rocm:pyproject.toml",
|
|
|
|
"//jax_plugins/rocm:setup.py",
|
|
|
|
"//jax_plugins/rocm:__init__.py",
|
2023-09-13 16:03:11 -07:00
|
|
|
]),
|
|
|
|
deps = [
|
|
|
|
"//jax/tools:build_utils",
|
2024-05-15 18:20:14 -07:00
|
|
|
"@bazel_tools//tools/python/runfiles",
|
|
|
|
"@pypi_build//:pkg",
|
|
|
|
"@pypi_wheel//:pkg",
|
|
|
|
"@pypi_setuptools//:pkg",
|
2023-09-13 16:03:11 -07:00
|
|
|
],
|
2018-11-26 12:37:24 -08:00
|
|
|
)
|
2023-11-06 09:05:08 -08:00
|
|
|
|
|
|
|
py_binary(
|
2024-06-12 18:45:01 -05:00
|
|
|
name = "build_gpu_kernels_wheel",
|
|
|
|
srcs = ["build_gpu_kernels_wheel.py"],
|
2023-11-06 09:05:08 -08:00
|
|
|
data = [
|
|
|
|
"LICENSE.txt",
|
|
|
|
] + if_cuda([
|
2024-05-30 01:45:31 -07:00
|
|
|
"//jaxlib/mosaic/gpu:mosaic_gpu",
|
2023-11-17 09:11:13 -08:00
|
|
|
"//jaxlib:cuda_plugin_extension",
|
2023-11-06 09:05:08 -08:00
|
|
|
"//jaxlib:version",
|
|
|
|
"//jaxlib/cuda:cuda_gpu_support",
|
2023-11-14 13:55:32 -08:00
|
|
|
"//jax_plugins/cuda:plugin_pyproject.toml",
|
|
|
|
"//jax_plugins/cuda:plugin_setup.py",
|
2023-11-06 09:05:08 -08:00
|
|
|
"@local_config_cuda//cuda:cuda-nvvm",
|
2024-06-12 18:45:01 -05:00
|
|
|
]) + if_rocm([
|
|
|
|
"//jaxlib:rocm_plugin_extension",
|
|
|
|
"//jaxlib:version",
|
|
|
|
"//jaxlib/rocm:rocm_gpu_support",
|
|
|
|
"//jax_plugins/rocm:plugin_pyproject.toml",
|
|
|
|
"//jax_plugins/rocm:plugin_setup.py",
|
2023-11-06 09:05:08 -08:00
|
|
|
]),
|
|
|
|
deps = [
|
|
|
|
"//jax/tools:build_utils",
|
2024-05-15 18:20:14 -07:00
|
|
|
"@bazel_tools//tools/python/runfiles",
|
|
|
|
"@pypi_build//:pkg",
|
|
|
|
"@pypi_wheel//:pkg",
|
|
|
|
"@pypi_setuptools//:pkg",
|
2023-11-06 09:05:08 -08:00
|
|
|
],
|
|
|
|
)
|