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
|
|
|
|
|
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
|
|
|
"cuda_library",
|
|
|
|
"flatbuffer_cc_library",
|
|
|
|
"flatbuffer_py_library",
|
|
|
|
"if_rocm_is_configured",
|
|
|
|
"pybind_extension",
|
2022-03-03 11:11:02 -08:00
|
|
|
"rocm_library",
|
2021-01-20 14:05:54 -08:00
|
|
|
)
|
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
|
|
|
|
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
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-11-25 11:48:45 -05:00
|
|
|
cc_library(
|
2020-12-05 00:07:04 +01:00
|
|
|
name = "cuda_gpu_kernel_helpers",
|
|
|
|
srcs = ["cuda_gpu_kernel_helpers.cc"],
|
|
|
|
hdrs = ["cuda_gpu_kernel_helpers.h"],
|
2019-11-25 11:48:45 -05:00
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
deps = [
|
2021-08-04 12:13:05 -07:00
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cusolver_lib",
|
2021-07-16 19:55:55 +08:00
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cusparse_lib",
|
2020-01-07 10:56:15 -05:00
|
|
|
"@com_google_absl//absl/memory",
|
2021-08-09 15:06:12 -07:00
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-11-25 11:48:45 -05:00
|
|
|
"@com_google_absl//absl/strings",
|
2021-07-14 11:24:44 +00:00
|
|
|
"@com_google_absl//absl/strings:str_format",
|
2021-08-04 15:53:08 -07:00
|
|
|
"@local_config_cuda//cuda:cublas_headers",
|
2019-11-25 11:48:45 -05:00
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-12-05 00:07:04 +01:00
|
|
|
cc_library(
|
2022-02-15 17:54:02 +00:00
|
|
|
name = "hip_gpu_kernel_helpers",
|
2022-03-03 11:11:02 -08:00
|
|
|
srcs = if_rocm_is_configured(["hip_gpu_kernel_helpers.cc"]),
|
|
|
|
hdrs = if_rocm_is_configured(["hip_gpu_kernel_helpers.h"]),
|
2020-12-05 00:07:04 +01:00
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
deps = [
|
|
|
|
"@com_google_absl//absl/memory",
|
2021-08-09 15:06:12 -07:00
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
2020-12-05 00:07:04 +01:00
|
|
|
"@com_google_absl//absl/strings",
|
2022-03-03 09:49:41 -08:00
|
|
|
] + if_rocm_is_configured([
|
2022-03-14 13:38:53 -07:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
2022-03-03 09:49:41 -08:00
|
|
|
]),
|
2020-12-05 00:07:04 +01:00
|
|
|
)
|
|
|
|
|
2019-04-01 08:21:22 -07:00
|
|
|
py_library(
|
|
|
|
name = "jaxlib",
|
2019-08-02 11:16:15 -04:00
|
|
|
srcs = [
|
2022-05-06 09:34:25 -07:00
|
|
|
"gpu_linalg.py",
|
2022-05-05 10:54:53 -07:00
|
|
|
"gpu_prng.py",
|
2022-05-06 09:34:25 -07:00
|
|
|
"gpu_solver.py",
|
|
|
|
"gpu_sparse.py",
|
2020-11-19 12:49:28 -05:00
|
|
|
"init.py",
|
2021-09-03 10:03:25 -07:00
|
|
|
"lapack.py",
|
2020-10-23 14:20:06 -07:00
|
|
|
"pocketfft.py",
|
2019-08-02 13:32:14 -04:00
|
|
|
"version.py",
|
2022-03-03 11:11:02 -08:00
|
|
|
],
|
2022-05-05 13:29:27 -07:00
|
|
|
deps = [
|
|
|
|
":_lapack",
|
|
|
|
":_pocketfft",
|
|
|
|
":cpu_feature_guard",
|
|
|
|
":pocketfft_flatbuffers_py",
|
|
|
|
],
|
2019-04-01 08:23:02 -07:00
|
|
|
)
|
2019-07-29 15:06:05 -04:00
|
|
|
|
2020-12-11 10:18:52 -05:00
|
|
|
exports_files([
|
|
|
|
"setup.py",
|
|
|
|
"setup.cfg",
|
|
|
|
])
|
|
|
|
|
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
|
|
|
py_library(
|
|
|
|
name = "lapack",
|
|
|
|
srcs = ["lapack.py"],
|
|
|
|
deps = ["//third_party/py/numpy"],
|
|
|
|
)
|
|
|
|
|
|
|
|
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"],
|
|
|
|
)
|
|
|
|
|
|
|
|
flatbuffer_py_library(
|
|
|
|
name = "pocketfft_flatbuffers_py",
|
|
|
|
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",
|
|
|
|
":pocketfft_kernels",
|
|
|
|
"@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,
|
|
|
|
)
|
|
|
|
|
|
|
|
# GPU kernels
|
|
|
|
|
2019-11-24 13:06:23 -05:00
|
|
|
py_library(
|
|
|
|
name = "gpu_support",
|
|
|
|
deps = [
|
2021-09-02 07:52:35 -07:00
|
|
|
":_cublas",
|
|
|
|
":_cuda_linalg",
|
|
|
|
":_cuda_prng",
|
|
|
|
":_cusolver",
|
|
|
|
":_cusparse",
|
2019-11-24 13:06:23 -05:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
py_library(
|
|
|
|
name = "hip_gpu_support",
|
|
|
|
deps = [
|
|
|
|
":_hip_linalg",
|
|
|
|
":_hip_prng",
|
2022-03-03 11:11:02 -08:00
|
|
|
":_hipblas",
|
2022-02-15 17:54:02 +00:00
|
|
|
":_hipsolver",
|
|
|
|
":_hipsparse",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 07:52:35 -07:00
|
|
|
cc_library(
|
2019-08-08 11:50:31 -04:00
|
|
|
name = "cublas_kernels",
|
2021-09-02 07:52:35 -07:00
|
|
|
srcs = ["cublas_kernels.cc"],
|
|
|
|
hdrs = ["cublas_kernels.h"],
|
2019-08-08 11:50:31 -04:00
|
|
|
deps = [
|
2020-12-05 00:07:04 +01:00
|
|
|
":cuda_gpu_kernel_helpers",
|
2020-12-05 02:02:57 +01:00
|
|
|
":handle_pool",
|
2021-09-02 07:52:35 -07:00
|
|
|
":kernel_helpers",
|
2021-08-09 15:06:12 -07:00
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
2020-06-25 14:37:14 -04:00
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cublas_lib",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cudart_stub",
|
2019-08-08 11:50:31 -04:00
|
|
|
"@com_google_absl//absl/algorithm:container",
|
|
|
|
"@com_google_absl//absl/base",
|
2020-01-27 13:15:41 -05:00
|
|
|
"@com_google_absl//absl/base:core_headers",
|
2019-08-08 11:50:31 -04:00
|
|
|
"@com_google_absl//absl/hash",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@local_config_cuda//cuda:cublas_headers",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
cc_library(
|
|
|
|
name = "hipblas_kernels",
|
|
|
|
srcs = ["hipblas_kernels.cc"],
|
|
|
|
hdrs = ["hipblas_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":handle_pool",
|
2022-03-03 11:11:02 -08:00
|
|
|
":hip_gpu_kernel_helpers",
|
2022-02-15 17:54:02 +00:00
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@com_google_absl//absl/algorithm:container",
|
|
|
|
"@com_google_absl//absl/base",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/hash",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2022-03-03 11:11:02 -08:00
|
|
|
"@local_config_rocm//rocm:hipblas",
|
2022-02-15 17:54:02 +00:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-08-09 15:37:54 -04:00
|
|
|
pybind_extension(
|
2021-09-02 07:52:35 -07:00
|
|
|
name = "_cublas",
|
|
|
|
srcs = ["cublas.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_cublas",
|
|
|
|
deps = [
|
|
|
|
":cublas_kernels",
|
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cublas_lib",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
pybind_extension(
|
|
|
|
name = "_hipblas",
|
|
|
|
srcs = ["hipblas.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_hipblas",
|
|
|
|
deps = [
|
|
|
|
":hipblas_kernels",
|
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
2022-03-03 11:11:02 -08:00
|
|
|
"@local_config_rocm//rocm:hipblas",
|
2022-02-15 17:54:02 +00:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 07:52:35 -07:00
|
|
|
cc_library(
|
2019-08-02 11:16:15 -04:00
|
|
|
name = "cusolver_kernels",
|
2021-09-02 07:52:35 -07:00
|
|
|
srcs = ["cusolver_kernels.cc"],
|
|
|
|
hdrs = ["cusolver_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":cuda_gpu_kernel_helpers",
|
|
|
|
":handle_pool",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cusolver_lib",
|
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
cc_library(
|
|
|
|
name = "hipsolver_kernels",
|
|
|
|
srcs = ["hipsolver_kernels.cc"],
|
|
|
|
hdrs = ["hipsolver_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":handle_pool",
|
2022-03-03 11:11:02 -08:00
|
|
|
":hip_gpu_kernel_helpers",
|
2022-02-15 17:54:02 +00:00
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2022-03-03 11:11:02 -08:00
|
|
|
"@local_config_rocm//rocm:hipsolver",
|
2022-02-15 17:54:02 +00:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 07:52:35 -07:00
|
|
|
pybind_extension(
|
|
|
|
name = "_cusolver",
|
2019-08-02 11:16:15 -04:00
|
|
|
srcs = ["cusolver.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
2021-09-02 07:52:35 -07:00
|
|
|
module_name = "_cusolver",
|
2019-08-02 11:16:15 -04:00
|
|
|
deps = [
|
2020-12-05 00:07:04 +01:00
|
|
|
":cuda_gpu_kernel_helpers",
|
2021-09-02 07:52:35 -07:00
|
|
|
":cusolver_kernels",
|
2019-12-05 18:59:29 -08:00
|
|
|
":kernel_pybind11_helpers",
|
2020-06-25 14:37:14 -04:00
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cudart_stub",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cusolver_lib",
|
2019-08-02 11:16:15 -04:00
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
2019-11-24 14:17:18 -05:00
|
|
|
"@pybind11",
|
2019-11-24 13:06:23 -05:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
pybind_extension(
|
|
|
|
name = "_hipsolver",
|
|
|
|
srcs = ["hipsolver.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_hipsolver",
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":hipsolver_kernels",
|
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
2022-03-03 11:11:02 -08:00
|
|
|
"@local_config_rocm//rocm:hipsolver",
|
2022-02-15 17:54:02 +00:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 07:52:35 -07:00
|
|
|
cc_library(
|
2021-04-15 10:10:40 -07:00
|
|
|
name = "cusparse_kernels",
|
2021-09-02 07:52:35 -07:00
|
|
|
srcs = ["cusparse_kernels.cc"],
|
|
|
|
hdrs = ["cusparse_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":cuda_gpu_kernel_helpers",
|
|
|
|
":handle_pool",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cudart_stub",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cusparse_lib",
|
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
cc_library(
|
|
|
|
name = "hipsparse_kernels",
|
|
|
|
srcs = ["hipsparse_kernels.cc"],
|
|
|
|
hdrs = ["hipsparse_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":handle_pool",
|
2022-03-03 11:11:02 -08:00
|
|
|
":hip_gpu_kernel_helpers",
|
2022-02-15 17:54:02 +00:00
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@com_google_absl//absl/status",
|
|
|
|
"@com_google_absl//absl/status:statusor",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2022-03-03 11:11:02 -08:00
|
|
|
"@local_config_rocm//rocm:hipsparse",
|
2022-02-15 17:54:02 +00:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 07:52:35 -07:00
|
|
|
pybind_extension(
|
|
|
|
name = "_cusparse",
|
2021-04-15 10:10:40 -07:00
|
|
|
srcs = ["cusparse.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
2021-09-02 07:52:35 -07:00
|
|
|
module_name = "_cusparse",
|
2021-04-15 10:10:40 -07:00
|
|
|
deps = [
|
|
|
|
":cuda_gpu_kernel_helpers",
|
2021-09-02 07:52:35 -07:00
|
|
|
":cusparse_kernels",
|
2021-04-15 10:10:40 -07:00
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cudart_stub",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cusparse_lib",
|
|
|
|
"@com_google_absl//absl/algorithm:container",
|
|
|
|
"@com_google_absl//absl/base",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/hash",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
pybind_extension(
|
|
|
|
name = "_hipsparse",
|
|
|
|
srcs = ["hipsparse.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_hipsparse",
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":hipsparse_kernels",
|
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@com_google_absl//absl/algorithm:container",
|
|
|
|
"@com_google_absl//absl/base",
|
|
|
|
"@com_google_absl//absl/base:core_headers",
|
|
|
|
"@com_google_absl//absl/container:flat_hash_map",
|
|
|
|
"@com_google_absl//absl/hash",
|
|
|
|
"@com_google_absl//absl/memory",
|
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@com_google_absl//absl/strings:str_format",
|
|
|
|
"@com_google_absl//absl/synchronization",
|
2022-03-03 11:11:02 -08:00
|
|
|
"@local_config_rocm//rocm:hipsparse",
|
2022-02-15 17:54:02 +00:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 14:35:14 -07:00
|
|
|
cc_library(
|
2021-09-02 07:52:35 -07:00
|
|
|
name = "cuda_lu_pivot_kernels",
|
|
|
|
srcs = [
|
|
|
|
"cuda_lu_pivot_kernels.cc",
|
2021-09-02 14:35:14 -07:00
|
|
|
],
|
|
|
|
hdrs = ["cuda_lu_pivot_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":cuda_gpu_kernel_helpers",
|
|
|
|
":cuda_lu_pivot_kernels_impl",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
cc_library(
|
|
|
|
name = "hip_lu_pivot_kernels",
|
|
|
|
srcs = [
|
|
|
|
"hip_lu_pivot_kernels.cc",
|
|
|
|
],
|
|
|
|
hdrs = ["hip_lu_pivot_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":hip_lu_pivot_kernels_impl",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 14:35:14 -07:00
|
|
|
cuda_library(
|
|
|
|
name = "cuda_lu_pivot_kernels_impl",
|
|
|
|
srcs = [
|
2021-09-02 07:52:35 -07:00
|
|
|
"cuda_lu_pivot_kernels.cu.cc",
|
|
|
|
],
|
2021-03-31 18:35:15 -07:00
|
|
|
hdrs = ["cuda_lu_pivot_kernels.h"],
|
|
|
|
deps = [
|
2021-09-02 07:52:35 -07:00
|
|
|
":cuda_gpu_kernel_helpers",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
2021-03-31 18:35:15 -07:00
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
rocm_library(
|
|
|
|
name = "hip_lu_pivot_kernels_impl",
|
|
|
|
srcs = [
|
|
|
|
"hip_lu_pivot_kernels.hip.cc",
|
|
|
|
],
|
|
|
|
hdrs = ["hip_lu_pivot_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-03-31 18:35:15 -07:00
|
|
|
pybind_extension(
|
2021-09-02 07:52:35 -07:00
|
|
|
name = "_cuda_linalg",
|
|
|
|
srcs = ["cuda_linalg.cc"],
|
2021-03-31 18:35:15 -07:00
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
2021-09-02 07:52:35 -07:00
|
|
|
module_name = "_cuda_linalg",
|
2021-03-31 18:35:15 -07:00
|
|
|
deps = [
|
2021-08-19 16:54:53 -07:00
|
|
|
":cuda_gpu_kernel_helpers",
|
2021-09-02 07:52:35 -07:00
|
|
|
":cuda_lu_pivot_kernels",
|
2021-09-02 14:35:14 -07:00
|
|
|
":cuda_lu_pivot_kernels_impl",
|
2021-03-31 18:35:15 -07:00
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cudart_stub",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
pybind_extension(
|
|
|
|
name = "_hip_linalg",
|
|
|
|
srcs = ["hip_linalg.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_hip_linalg",
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":hip_lu_pivot_kernels",
|
|
|
|
":hip_lu_pivot_kernels_impl",
|
|
|
|
":kernel_pybind11_helpers",
|
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 14:35:14 -07:00
|
|
|
cc_library(
|
2021-09-02 07:52:35 -07:00
|
|
|
name = "cuda_prng_kernels",
|
|
|
|
srcs = [
|
|
|
|
"cuda_prng_kernels.cc",
|
2021-09-02 14:35:14 -07:00
|
|
|
],
|
|
|
|
hdrs = ["cuda_prng_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":cuda_gpu_kernel_helpers",
|
|
|
|
":cuda_prng_kernels_impl",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
cc_library(
|
|
|
|
name = "hip_prng_kernels",
|
|
|
|
srcs = [
|
|
|
|
"hip_prng_kernels.cc",
|
|
|
|
],
|
|
|
|
hdrs = ["hip_prng_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":hip_prng_kernels_impl",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-09-02 14:35:14 -07:00
|
|
|
cuda_library(
|
|
|
|
name = "cuda_prng_kernels_impl",
|
|
|
|
srcs = [
|
2021-09-02 07:52:35 -07:00
|
|
|
"cuda_prng_kernels.cu.cc",
|
|
|
|
],
|
2019-11-24 13:06:23 -05:00
|
|
|
hdrs = ["cuda_prng_kernels.h"],
|
|
|
|
deps = [
|
2021-09-02 07:52:35 -07:00
|
|
|
":cuda_gpu_kernel_helpers",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
2019-11-24 13:06:23 -05:00
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
rocm_library(
|
|
|
|
name = "hip_prng_kernels_impl",
|
|
|
|
srcs = [
|
|
|
|
"hip_prng_kernels.hip.cc",
|
|
|
|
],
|
|
|
|
hdrs = ["hip_prng_kernels.h"],
|
|
|
|
deps = [
|
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":kernel_helpers",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_status",
|
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-11-24 13:06:23 -05:00
|
|
|
pybind_extension(
|
2021-09-02 07:52:35 -07:00
|
|
|
name = "_cuda_prng",
|
|
|
|
srcs = ["cuda_prng.cc"],
|
2019-11-24 13:06:23 -05:00
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
2021-09-02 07:52:35 -07:00
|
|
|
module_name = "_cuda_prng",
|
2019-11-24 13:06:23 -05:00
|
|
|
deps = [
|
2021-08-19 16:54:53 -07:00
|
|
|
":cuda_gpu_kernel_helpers",
|
2021-09-02 07:52:35 -07:00
|
|
|
":cuda_prng_kernels",
|
2019-12-05 18:59:29 -08:00
|
|
|
":kernel_pybind11_helpers",
|
2020-06-25 14:37:14 -04:00
|
|
|
"@org_tensorflow//tensorflow/stream_executor/cuda:cudart_stub",
|
2019-11-24 13:06:23 -05:00
|
|
|
"@local_config_cuda//cuda:cuda_headers",
|
2019-08-02 11:16:15 -04:00
|
|
|
"@pybind11",
|
|
|
|
],
|
2019-08-08 16:33:04 -04:00
|
|
|
)
|
2020-10-23 14:20:06 -07:00
|
|
|
|
2020-12-05 00:07:04 +01:00
|
|
|
pybind_extension(
|
2022-02-15 17:54:02 +00:00
|
|
|
name = "_hip_prng",
|
|
|
|
srcs = ["hip_prng.cc"],
|
2020-12-05 00:07:04 +01:00
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
|
|
|
features = ["-use_header_modules"],
|
2022-02-15 17:54:02 +00:00
|
|
|
module_name = "_hip_prng",
|
2020-12-05 00:07:04 +01:00
|
|
|
deps = [
|
2022-02-15 17:54:02 +00:00
|
|
|
":hip_gpu_kernel_helpers",
|
|
|
|
":hip_prng_kernels",
|
2020-12-05 00:07:04 +01:00
|
|
|
":kernel_pybind11_helpers",
|
2020-12-17 14:01:04 -08:00
|
|
|
"@local_config_rocm//rocm:rocm_headers",
|
2020-12-05 00:07:04 +01:00
|
|
|
"@pybind11",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-02-15 17:54:02 +00:00
|
|
|
# TODO(rocm): do we also need to support this?
|
2021-09-02 07:52:35 -07:00
|
|
|
cc_library(
|
|
|
|
name = "gpu_kernels",
|
|
|
|
srcs = ["gpu_kernels.cc"],
|
2022-04-28 10:45:35 -07:00
|
|
|
visibility = ["//visibility:public"],
|
2021-09-02 07:52:35 -07:00
|
|
|
deps = [
|
|
|
|
":cublas_kernels",
|
|
|
|
":cuda_lu_pivot_kernels",
|
|
|
|
":cuda_prng_kernels",
|
|
|
|
":cusolver_kernels",
|
|
|
|
":cusparse_kernels",
|
|
|
|
"@org_tensorflow//tensorflow/compiler/xla/service:custom_call_target_registry",
|
|
|
|
],
|
2021-09-03 10:03:25 -07:00
|
|
|
alwayslink = 1,
|
2021-09-02 07:52:35 -07:00
|
|
|
)
|