-
-
Notifications
You must be signed in to change notification settings - Fork 54
feat: hermetic CUDA clang support #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9400206
to
8039d7b
Compare
cccl_repo = components_mapping_compat.repo_str(repository_ctx.attr.components_mapping["cccl"]) | ||
|
||
clang_cuda_path = repository_ctx.path("clang_compiler_deps") | ||
repository_ctx.execute(["mkdir", "-p", "clang_compiler_deps"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy that this is not hermetic. It uses native mkdir which will not work on windows. I'm going to try using rules_coreutils with toolchain_utils as suggested in the rules_coreutils README here. We can use hermetic mkdir
and cp
from there then.
@cloudhan would you be okay to adding these two dependencies (rules_coreutils
and toolchain_utils
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to create a new repo call minimal_ctk with nvcc, cudart and cccl (and maybe curand if you need it). Duplicate all the files to minimal_ctk (instead of symlink) will solve you a lot of headache.
465f868
to
217a96b
Compare
…on.json and version.txt unnecessary Signed-off-by: udayaprakash <[email protected]>
217a96b
to
b44e39d
Compare
"%{clang_path}": clang_path_for_subst, # Will be empty if label is used | ||
"%{clang_label}": clang_label_for_subst, # Will be empty if path is used | ||
"%{cuda_path}": _to_forward_slash(cuda.path) if cuda.path else "cuda-not-found", | ||
"%{cuda_path}": _to_forward_slash(cuda.path) if cuda.path else "external/rules_cuda++toolchain+cuda/clang_compiler_deps", # needs to be relative to work in RBE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you cannot hard code +
, the encoding is bazel version specific, they previously used ~
but find +
to be much faster (suprise!) so they switched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are warned to be prepared for the headache of apparent and canonical repo name, :)
Partially part of #283
This PR adds the missing piece of hermetic CUDA compilation with clang. The provided
compiler_deps
repo (alias cuda_nvcc) wasn't enough for clang to infer everything from. Typically, it's documented in multiple places ((1), (2)) that clang expects the entire CUDA toolkit and there is no recommended "minimal" CUDA setup. Nevertheless, I found thatcccl
,nvcc
,cudart
,nvvm
components were enough.Surprisingly, I didn't need the
version.json
orversion.txt
file anymore so I removed the logic to generate the rootversion.json
file.In
config_clang
we create a new folder calledclang_compiler_deps
where we collectbin
,lib
,include
files from the required components and place in a single collected folder.We've been using this implementation for more than a month now with over 20+
cuda_library
usages andcc_test
s that run on NVIDIA GPU hermetically in RBE with CUDA 12.3 and LLVM 19.1.0