Skip to content

Commit d54ddc5

Browse files
tchatowcopybara-github
authored andcommitted
PR #16882: Symlink hermetic cuda headers to permit clang cuda version detection
Imported from GitHub PR openxla/xla#16882 Fixes #16877 Copybara import of the project: -- 1ff356ac0870002b369c3ec09547aae2a62c70e2 by tchatow <[email protected]>: Symlink hermetic cuda headers to permit clang cuda version detection Fixes #16877 Merging this change closes #16882 PiperOrigin-RevId: 679764212
1 parent 9625a5f commit d54ddc5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ build:cuda_clang --copt=-Qunused-arguments
242242
# major release. Example: sm_80 kernels can run on sm_89 GPUs but
243243
# not on sm_90 GPUs. compute_80 kernels though can also run on sm_90 GPUs.
244244
build:cuda_clang --repo_env=HERMETIC_CUDA_COMPUTE_CAPABILITIES="sm_60,sm_70,sm_80,sm_89,compute_90"
245+
# Permit newer CUDA versions than Clang is aware of
246+
build:cuda_clang --copt="-Wno-unknown-cuda-version"
245247
# Set lld as the linker.
246248
build:cuda_clang --host_linkopt="-fuse-ld=lld"
247249
build:cuda_clang --host_linkopt="-lm"

third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def _create_libcuda_symlinks(
219219
repository_ctx.symlink(nvidia_driver_path, "lib/libcuda.so.1")
220220
repository_ctx.symlink("lib/libcuda.so.1", "lib/libcuda.so")
221221

222+
def _create_cuda_header_symlinks(repository_ctx):
223+
if repository_ctx.name == "cuda_nvcc":
224+
repository_ctx.symlink("../cuda_cudart/include/cuda.h", "include/cuda.h")
225+
222226
def use_local_path(repository_ctx, local_path, dirs):
223227
# buildifier: disable=function-docstring-args
224228
"""Creates repository using local redistribution paths."""
@@ -339,6 +343,7 @@ def _use_downloaded_cuda_redistribution(repository_ctx):
339343
repository_ctx,
340344
lib_name_to_version_dict,
341345
)
346+
_create_cuda_header_symlinks(repository_ctx)
342347
repository_ctx.file("version.txt", major_version)
343348

344349
def _cuda_repo_impl(repository_ctx):

0 commit comments

Comments
 (0)