2022-10-24 10:02:12 -07:00
|
|
|
# Copyright 2018 The JAX Authors.
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
|
|
load(
|
|
|
|
"//jaxlib:jax.bzl",
|
2025-01-06 11:53:08 -08:00
|
|
|
"nanobind_extension",
|
2022-10-24 10:02:12 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
licenses(["notice"])
|
|
|
|
|
2023-04-19 13:26:24 -07:00
|
|
|
package(
|
|
|
|
default_applicable_licenses = [],
|
2024-08-26 09:10:26 -07:00
|
|
|
default_visibility = ["//jax:internal"],
|
2023-04-19 13:26:24 -07:00
|
|
|
)
|
2022-10-24 10:02:12 -07:00
|
|
|
|
|
|
|
# LAPACK
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "lapack_kernels",
|
|
|
|
srcs = ["lapack_kernels.cc"],
|
|
|
|
hdrs = ["lapack_kernels.h"],
|
2024-02-20 12:43:16 -08:00
|
|
|
copts = ["-fexceptions"],
|
|
|
|
features = ["-use_header_modules"],
|
2022-10-24 10:02:12 -07:00
|
|
|
deps = [
|
2024-07-10 15:08:58 -07:00
|
|
|
"//jaxlib:ffi_helpers",
|
2024-06-13 05:43:40 -07:00
|
|
|
"@com_google_absl//absl/algorithm:container",
|
2022-10-24 10:02:12 -07:00
|
|
|
"@com_google_absl//absl/base:dynamic_annotations",
|
2024-08-13 01:16:37 -07:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2024-08-05 03:17:26 -07:00
|
|
|
"@com_google_absl//absl/types:span",
|
2024-08-26 09:10:26 -07:00
|
|
|
"@xla//xla/ffi/api:c_api",
|
|
|
|
"@xla//xla/ffi/api:ffi",
|
|
|
|
"@xla//xla/service:custom_call_status",
|
2022-10-24 10:02:12 -07:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "lapack_kernels_using_lapack",
|
|
|
|
srcs = ["lapack_kernels_using_lapack.cc"],
|
|
|
|
deps = [":lapack_kernels"],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|
|
|
|
|
2025-01-06 11:53:08 -08:00
|
|
|
nanobind_extension(
|
2022-10-24 10:02:12 -07:00
|
|
|
name = "_lapack",
|
|
|
|
srcs = ["lapack.cc"],
|
|
|
|
copts = [
|
|
|
|
"-fexceptions",
|
|
|
|
"-fno-strict-aliasing",
|
|
|
|
],
|
2024-07-08 05:19:07 -07:00
|
|
|
enable_stub_generation = False, # generated stubs are incorrect
|
2022-10-24 10:02:12 -07:00
|
|
|
features = ["-use_header_modules"],
|
|
|
|
module_name = "_lapack",
|
2023-11-28 08:42:19 -08:00
|
|
|
pytype_srcs = [
|
2024-07-08 05:19:07 -07:00
|
|
|
"_lapack/__init__.pyi",
|
2024-10-14 06:45:46 -07:00
|
|
|
"_lapack/schur.pyi",
|
2024-07-08 05:19:07 -07:00
|
|
|
"_lapack/svd.pyi",
|
2024-08-05 03:17:26 -07:00
|
|
|
"_lapack/eig.pyi",
|
2023-11-28 08:42:19 -08:00
|
|
|
],
|
2022-10-24 10:02:12 -07:00
|
|
|
deps = [
|
|
|
|
":lapack_kernels",
|
2023-08-24 16:06:18 -07:00
|
|
|
"//jaxlib:kernel_nanobind_helpers",
|
2025-01-13 02:50:38 -08:00
|
|
|
"@com_google_absl//absl/base",
|
2023-08-24 16:06:18 -07:00
|
|
|
"@nanobind",
|
2024-08-26 09:10:26 -07:00
|
|
|
"@xla//xla/ffi/api:ffi",
|
2022-10-24 10:02:12 -07:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "cpu_kernels",
|
|
|
|
srcs = ["cpu_kernels.cc"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":lapack_kernels",
|
|
|
|
":lapack_kernels_using_lapack",
|
2024-06-13 05:43:40 -07:00
|
|
|
"@xla//xla/ffi/api:c_api",
|
|
|
|
"@xla//xla/ffi/api:ffi",
|
2023-03-13 14:35:56 -07:00
|
|
|
"@xla//xla/service:custom_call_target_registry",
|
2022-10-24 10:02:12 -07:00
|
|
|
],
|
|
|
|
alwayslink = 1,
|
|
|
|
)
|