2018-12-17 14:36:21 -05:00
|
|
|
# Copyright 2018 Google LLC
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2022-07-01 09:06:29 -07:00
|
|
|
load("//jaxlib:symlink_files.bzl", "symlink_files")
|
2021-01-20 14:05:54 -08:00
|
|
|
load(
|
2021-05-19 12:54:59 -07:00
|
|
|
"//jaxlib:jax.bzl",
|
2021-01-20 14:05:54 -08:00
|
|
|
"flatbuffer_cc_library",
|
2022-07-01 12:31:16 -07:00
|
|
|
"if_windows",
|
2021-01-20 14:05:54 -08:00
|
|
|
"pybind_extension",
|
|
|
|
)
|
2019-11-24 13:13:39 -05:00
|
|
|
|
2019-09-26 14:51:24 -07:00
|
|
|
licenses(["notice"])
|
2018-12-17 14:36:21 -05:00
|
|
|
|
2022-04-28 10:45:35 -07:00
|
|
|
package(default_visibility = ["//:__subpackages__"])
|
2018-12-17 14:36:21 -05:00
|
|
|
|
2022-07-01 06:54:00 -07:00
|
|
|
py_library(
|
|
|
|
name = "jaxlib",
|
|
|
|
srcs = [
|
|
|
|
"gpu_linalg.py",
|
|
|
|
"gpu_prng.py",
|
|
|
|
"gpu_solver.py",
|
|
|
|
"gpu_sparse.py",
|
|
|
|
"init.py",
|
|
|
|
"lapack.py",
|
|
|
|
"mhlo_helpers.py",
|
|
|
|
"pocketfft.py",
|
2022-07-01 09:06:29 -07:00
|
|
|
":version",
|
2022-07-01 12:31:16 -07:00
|
|
|
":xla_client",
|
2022-07-01 06:54:00 -07:00
|
|
|
],
|
2022-07-01 12:31:16 -07:00
|
|
|
data = [":xla_extension"],
|
2022-07-01 06:54:00 -07:00
|
|
|
deps = [
|
|
|
|
":_lapack",
|
|
|
|
":_pocketfft",
|
|
|
|
":cpu_feature_guard",
|
|
|
|
"//jaxlib/mlir",
|
|
|
|
"//jaxlib/mlir:builtin_dialect",
|
|
|
|
"//jaxlib/mlir:func_dialect",
|
|
|
|
"//jaxlib/mlir:ir",
|
|
|
|
"//jaxlib/mlir:mhlo_dialect",
|
|
|
|
"//jaxlib/mlir:ml_program_dialect",
|
|
|
|
"//jaxlib/mlir:pass_manager",
|
|
|
|
"//jaxlib/mlir:sparse_tensor_dialect",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-07-01 09:06:29 -07:00
|
|
|
symlink_files(
|
|
|
|
name = "version",
|
|
|
|
srcs = ["//jax:version.py"],
|
|
|
|
dst = ".",
|
|
|
|
flatten = True,
|
|
|
|
)
|
|
|
|
|
2022-07-01 12:31:16 -07:00
|
|
|
symlink_files(
|
|
|
|
name = "xla_client",
|
|
|
|
srcs = ["@org_tensorflow//tensorflow/compiler/xla/python:xla_client"],
|
|
|
|
dst = ".",
|
|
|
|
flatten = True,
|
|
|
|
)
|
|
|
|
|
|
|
|
symlink_files(
|
|
|
|
name = "xla_extension",
|
|
|
|
srcs = if_windows(
|
|
|
|
["@org_tensorflow//tensorflow/compiler/xla/python:xla_extension.pyd"],
|
|
|
|
["@org_tensorflow//tensorflow/compiler/xla/python:xla_extension.so"],
|
|
|
|
),
|
|
|
|
dst = ".",
|
|
|
|
flatten = True,
|
|
|
|
)
|
|
|
|
|
2022-07-01 06:54:00 -07:00
|
|
|
exports_files([
|
2022-07-13 14:03:32 -07:00
|
|
|
"README.md",
|
2022-07-01 06:54:00 -07:00
|
|
|
"setup.py",
|
|
|
|
"setup.cfg",
|
|
|
|
])
|
|
|
|
|
2019-12-05 18:59:29 -08:00
|
|
|
cc_library(
|
|
|
|
name = "kernel_pybind11_helpers",
|
|
|
|
hdrs = ["kernel_pybind11_helpers.h"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
deps = [
|
|
|
|
":kernel_helpers",
|
2020-10-23 14:20:06 -07:00
|
|
|
"@com_google_absl//absl/base",
|
2019-12-05 18:59:29 -08:00
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-11-24 13:06:23 -05:00
|
|
|
cc_library(
|
|
|
|
name = "kernel_helpers",
|
|
|
|
hdrs = ["kernel_helpers.h"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
2019-11-26 17:06:57 -08:00
|
|
|
features = ["-use_header_modules"],
|
2019-11-24 13:06:23 -05:00
|
|
|
deps = [
|
|
|
|
"@com_google_absl//absl/base",
|
2021-08-09 15:06:12 -07:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-11-24 13:06:23 -05:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-11-25 11:48:45 -05:00
|
|
|
cc_library(
|
2020-12-05 02:02:57 +01:00
|
|
|
name = "handle_pool",
|
|
|
|
hdrs = ["handle_pool.h"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
deps = [
|
2021-01-20 09:38:55 -05:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2021-08-09 15:06:12 -07:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2021-01-20 09:38:55 -05:00
|
|
|
"@com_google_absl//absl/synchronization",
|
2020-12-05 02:02:57 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-03 10:03:25 -07:00
|
|
|
# CPU kernels
|
|
|
|
|
|
|
|
pybind_extension(
|
|
|
|
name = "cpu_feature_guard",
|
|
|
|
srcs = ["cpu_feature_guard.c"],
|
|
|
|
module_name = "cpu_feature_guard",
|
|
|
|
deps = [
|
|
|
|
"@org_tensorflow//third_party/python_runtime:headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# LAPACK
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "lapack_kernels",
|
|
|
|
srcs = ["lapack_kernels.cc"],
|
|
|
|
hdrs = ["lapack_kernels.h"],
|
|
|
|
deps = [
|
2022-03-29 17:13:45 -07:00
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
2022-01-07 10:47:32 -08:00
|
|
|
"@com_google_absl//absl/base:dynamic_annotations",
|
2021-09-03 10:03:25 -07:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-01-25 16:29:43 -08:00
|
|
|
cc_library(
|
|
|
|
name = "lapack_kernels_using_lapack",
|
|
|
|
srcs = ["lapack_kernels_using_lapack.cc"],
|
|
|
|
deps = [":lapack_kernels"],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2021-09-03 10:03:25 -07:00
|
|
|
pybind_extension(
|
|
|
|
name = "_lapack",
|
|
|
|
srcs = ["lapack.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_lapack",
|
|
|
|
deps = [
|
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
":lapack_kernels",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# PocketFFT
|
|
|
|
|
|
|
|
flatbuffer_cc_library(
|
|
|
|
name = "pocketfft_flatbuffers_cc",
|
|
|
|
srcs = ["pocketfft.fbs"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "pocketfft_kernels",
|
|
|
|
srcs = ["pocketfft_kernels.cc"],
|
|
|
|
hdrs = ["pocketfft_kernels.h"],
|
|
|
|
copts = ["-fexceptions"], # PocketFFT may throw.
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
deps = [
|
|
|
|
":pocketfft_flatbuffers_cc",
|
2022-03-29 17:13:45 -07:00
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
2021-09-03 10:03:25 -07:00
|
|
|
"@flatbuffers//:runtime_cc",
|
|
|
|
"@pocketfft",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
pybind_extension(
|
|
|
|
name = "_pocketfft",
|
|
|
|
srcs = ["pocketfft.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_pocketfft",
|
|
|
|
deps = [
|
|
|
|
":kernel_pybind11_helpers",
|
2022-06-28 14:24:35 -07:00
|
|
|
":pocketfft_flatbuffers_cc",
|
2021-09-03 10:03:25 -07:00
|
|
|
":pocketfft_kernels",
|
2022-06-28 14:24:35 -07:00
|
|
|
"@flatbuffers//:runtime_cc",
|
2021-09-03 10:03:25 -07:00
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "cpu_kernels",
|
|
|
|
srcs = ["cpu_kernels.cc"],
|
2022-04-28 10:45:35 -07:00
|
|
|
visibility = ["//visibility:public"],
|
2021-09-03 10:03:25 -07:00
|
|
|
deps = [
|
|
|
|
":lapack_kernels",
|
2022-01-25 16:29:43 -08:00
|
|
|
":lapack_kernels_using_lapack",
|
2021-09-03 10:03:25 -07:00
|
|
|
":pocketfft_kernels",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_target_registry",
|
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2022-05-06 13:47:23 -07:00
|
|
|
# TODO(phawkins): Remove this forwarding target.
|
2021-09-02 07:52:35 -07:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_kernels",
|
2022-04-28 10:45:35 -07:00
|
|
|
visibility = ["//visibility:public"],
|
2021-09-02 07:52:35 -07:00
|
|
|
deps = [
|
2022-05-06 13:47:23 -07:00
|
|
|
"//jaxlib/cuda:cuda_gpu_kernels",
|
2021-09-02 07:52:35 -07:00
|
|
|
],
|
2021-09-03 10:03:25 -07:00
|
|
|
alwayslink = 1,
|
2021-09-02 07:52:35 -07:00
|
|
|
)
|