forked from tensorflow/tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remake configure.py to be XLA specific
Also, move it to `build_tools/configure/configure.py` and add tests PiperOrigin-RevId: 603158260
- Loading branch information
1 parent
84a2d75
commit 277eed5
Showing
20 changed files
with
921 additions
and
1,229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Copyright 2024 The OpenXLA 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 | ||
# | ||
# http://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. | ||
# ============================================================================ | ||
|
||
load("//xla:pytype.default.bzl", "pytype_strict_library") | ||
|
||
# Placeholder: load py_test | ||
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_library") | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"], | ||
licenses = ["notice"], | ||
) | ||
|
||
pytype_strict_library( | ||
name = "configure", | ||
srcs = ["configure.py"], | ||
) | ||
|
||
py_test( | ||
name = "configure_test", | ||
srcs = ["configure_test.py"], | ||
data = [ | ||
"testdata/clang.bazelrc", | ||
"testdata/cuda_clang.bazelrc", | ||
"testdata/gcc.bazelrc", | ||
"testdata/nvcc_clang.bazelrc", | ||
"testdata/nvcc_gcc.bazelrc", | ||
], | ||
deps = [ | ||
":configure", | ||
"//build_tools:test_utils", | ||
"@absl_py//absl/testing:absltest", | ||
], | ||
) | ||
|
||
# Below targets are just for checking if the host/CUDA compiler are configured | ||
# as expected. | ||
cc_library( | ||
name = "assert_clang", | ||
srcs = ["assert_clang.cc"], | ||
tags = ["manual"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_library( | ||
name = "assert_gcc", | ||
srcs = ["assert_gcc.cc"], | ||
tags = ["manual"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cuda_library( | ||
name = "assert_cuda_clang", | ||
srcs = ["assert_cuda_clang.cu.cc"], | ||
tags = [ | ||
"gpu", | ||
"manual", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = ["@local_config_cuda//cuda:cuda_headers"], | ||
) | ||
|
||
cuda_library( | ||
name = "assert_nvcc", | ||
srcs = ["assert_nvcc.cu.cc"], | ||
tags = [ | ||
"gpu", | ||
"manual", | ||
], | ||
visibility = ["//visibility:public"], | ||
# Notably, this builds fine in OSS without this dependency. Apparently, | ||
# NVCC can give targets access to CUDA headers without letting Bazel know, | ||
# while CUDA clang cannot. | ||
deps = ["@local_config_cuda//cuda:cuda_headers"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* Copyright 2024 The OpenXLA 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 | ||
http://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. | ||
==============================================================================*/ | ||
|
||
#ifndef __clang__ | ||
#error "__clang__ not defined!" | ||
#endif // #ifdef __clang__ |
18 changes: 18 additions & 0 deletions
18
third_party/xla/build_tools/configure/assert_cuda_clang.cu.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* Copyright 2024 The OpenXLA 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 | ||
http://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. | ||
==============================================================================*/ | ||
|
||
#if !defined(__clang__) || !defined(__CUDA__) | ||
#error "__clang__ or __CUDA__ not defined!" | ||
#endif // #if !defined(__clang__) || !defined(__CUDA__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Copyright 2024 The OpenXLA 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 | ||
http://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. | ||
==============================================================================*/ | ||
|
||
// Notably, clang will define `__GNUC__`, so need to make sure __clang__ is not | ||
// defined to detect GCC (or, most correctly, some compiler that supports GNU | ||
// extensions that is not clang). | ||
#if !defined(__GNUC__) || defined(__clang__) | ||
#error "__GNUC__ is not defined independently of __clang__!" | ||
#endif // #if !defined(__GNUC__) || defined(__clang__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Copyright 2024 The OpenXLA 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 | ||
http://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. | ||
==============================================================================*/ | ||
#ifndef __NVCC__ | ||
#error "__NVCC__ not defined!" | ||
#endif // #ifdef __NVCC__ |
Oops, something went wrong.