Skip to content

Comments

[Rebased] Add linking of static CUDA libs.#201

Open
wsmoses wants to merge 4 commits intogoogle-ml-infra:mainfrom
wsmoses:wm/static/rebase6
Open

[Rebased] Add linking of static CUDA libs.#201
wsmoses wants to merge 4 commits intogoogle-ml-infra:mainfrom
wsmoses:wm/static/rebase6

Conversation

@wsmoses
Copy link

@wsmoses wsmoses commented Feb 21, 2026

No description provided.

"libnvptxcompiler": {
"repo_name": "cuda_nvptxcompiler",
"version_to_template": {
"13": "//gpu/cuda/build_templates:cuda_nvptxcompiler.BUILD.tpl",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about CUDA 12? Can we use the same template?

"cuda_culibos": {
"repo_name": "cuda_culibos",
"version_to_template": {
"13": "//gpu/cuda/build_templates:cuda_culibos.BUILD.tpl",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need key-value for CUDA 12 as well.

load("@cuda_nvml//:version.bzl", _nvml_version = "VERSION")
load("@cuda_nvtx//:version.bzl", _nvtx_version = "VERSION")
load("@cuda_nvvm//:version.bzl", _nvvm_version = "VERSION")
load("@cuda_nvptxcompiler//:version.bzl", _cuda_nvptxcompiler_version = "VERSION")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the load for cuda_culibos version to speed up the creation of repositories.

nvccopts += std_options
nvccopts += m_options
nvccopts += warning_options
# nvccopts += ' -rdc=true '
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this line is not needed, please remove it.

# Unfortunately, there are other options that have -c prefix too.
# So allowing only those look like C/C++ files.
src_files = [f for f in src_files if
re.search(r'\.cpp$|\.cc$|\.c$|\.cxx$|\.C$|\.cu$', f)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this change is not needed.

%{multiline_comment}
cc_import(
name = "nvptxcompiler_static_library",
hdrs = ["include/nvPTXCompiler.h"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to create a filegroup with the headers and then cc_library depending on this group - see example here

%{comment}":cudnn_engines_precompiled",
%{comment}alwayslink = if_static_cudnn(True, False),
%{comment}srcs = if_static_cudnn(
%{comment}[":lib/libcudnn_engines_precompiled_static_v9.a",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the suffix "v9" is specific for a particular CUDNN version. Other CUDNN version might have different suffixes. I suspect we need %{libcudnn_version} here.

Also I see that you've added cc_import for static libs (like cudnn_engines_precompiled_static), but you don't use them anywhere. Do you want to add them to srcs instead of the file targets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants