|
| 1 | +# Copyright 2024 The OpenXLA Authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# ============================================================================ |
| 15 | + |
| 16 | +load("//xla:pytype.default.bzl", "pytype_strict_library") |
| 17 | + |
| 18 | +# Placeholder: load py_test |
| 19 | +load("@local_config_cuda//cuda:build_defs.bzl", "cuda_library") |
| 20 | + |
| 21 | +package( |
| 22 | + # copybara:uncomment default_applicable_licenses = ["//tensorflow:license"], |
| 23 | + licenses = ["notice"], |
| 24 | +) |
| 25 | + |
| 26 | +pytype_strict_library( |
| 27 | + name = "configure", |
| 28 | + srcs = ["configure.py"], |
| 29 | +) |
| 30 | + |
| 31 | +py_test( |
| 32 | + name = "configure_test", |
| 33 | + srcs = ["configure_test.py"], |
| 34 | + data = [ |
| 35 | + "testdata/clang.bazelrc", |
| 36 | + "testdata/cuda_clang.bazelrc", |
| 37 | + "testdata/gcc.bazelrc", |
| 38 | + "testdata/nvcc_clang.bazelrc", |
| 39 | + "testdata/nvcc_gcc.bazelrc", |
| 40 | + ], |
| 41 | + deps = [ |
| 42 | + ":configure", |
| 43 | + "//build_tools:test_utils", |
| 44 | + "@absl_py//absl/testing:absltest", |
| 45 | + ], |
| 46 | +) |
| 47 | + |
| 48 | +# Below targets are just for checking if the host/CUDA compiler are configured |
| 49 | +# as expected. |
| 50 | +cc_library( |
| 51 | + name = "assert_clang", |
| 52 | + srcs = ["assert_clang.cc"], |
| 53 | + tags = ["manual"], |
| 54 | +) |
| 55 | + |
| 56 | +cc_library( |
| 57 | + name = "assert_gcc", |
| 58 | + srcs = ["assert_gcc.cc"], |
| 59 | + tags = ["manual"], |
| 60 | +) |
| 61 | + |
| 62 | +cuda_library( |
| 63 | + name = "assert_cuda_clang", |
| 64 | + srcs = ["assert_cuda_clang.cu.cc"], |
| 65 | + tags = [ |
| 66 | + "gpu", |
| 67 | + "manual", |
| 68 | + ], |
| 69 | + deps = ["@local_config_cuda//cuda:cuda_headers"], |
| 70 | +) |
| 71 | + |
| 72 | +cuda_library( |
| 73 | + name = "assert_nvcc", |
| 74 | + srcs = ["assert_nvcc.cu.cc"], |
| 75 | + tags = [ |
| 76 | + "gpu", |
| 77 | + "manual", |
| 78 | + ], |
| 79 | + # Notably, this builds fine in OSS without this dependency. Apparently, |
| 80 | + # NVCC can give targets access to CUDA headers without letting Bazel know, |
| 81 | + # while CUDA clang cannot. |
| 82 | + deps = ["@local_config_cuda//cuda:cuda_headers"], |
| 83 | +) |
0 commit comments