Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ use_repo(
"cuda_profiler_api",
)

nvshmem_redist = use_extension("//extensions:nvshmem_redist.bzl", "nvshmem_redist_ext")
use_repo(nvshmem_redist, "nvidia_nvshmem")

##############################################################
# NCCL configuration

Expand Down
19 changes: 19 additions & 0 deletions extensions/nvshmem_redist.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Module extension for nvshmem_redist_init_repository."""

load(
"//gpu/nvshmem:nvshmem_redist_init_repository.bzl",
"nvshmem_redist_init_repository",
)
load(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It should be this instead:

load(
      "@nvshmem_redist_json//:distributions.bzl",
      "NVSHMEM_REDISTRIBUTIONS",
   )

"@cuda_redist_json//:distributions.bzl",
"CUDA_REDISTRIBUTIONS",
)

def _nvshmem_redist_ext_impl(mctx):
nvshmem_redist_init_repository(
nvshmem_redistributions = CUDA_REDISTRIBUTIONS,
)

nvshmem_redist_ext = module_extension(
implementation = _nvshmem_redist_ext_impl,
)
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_cccl.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ filegroup(
%{comment}"include" + cuda_lib_header_prefix(_cudart_version, 13, "/cccl", "") + "/cuda/**",
%{comment}"include" + cuda_lib_header_prefix(_cudart_version, 13, "/cccl", "") + "/nv/**",
%{comment}"include" + cuda_lib_header_prefix(_cudart_version, 13, "/cccl", "") + "/thrust/**",
]),
], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
8 changes: 4 additions & 4 deletions gpu/cuda/build_templates/cuda_cccl_github.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ filegroup(
name = "thrust_header_list",
srcs = glob([
%{comment}"thrust/thrust/**",
]),
], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand All @@ -33,7 +33,7 @@ filegroup(
name = "cuda_header_list",
srcs = glob([
%{comment}"libcudacxx/include/cuda/**",
]),
], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand All @@ -50,7 +50,7 @@ filegroup(
name = "nv_header_list",
srcs = glob([
%{comment}"libcudacxx/include/nv/**",
]),
], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand All @@ -67,7 +67,7 @@ filegroup(
name = "cub_header_list",
srcs = glob([
%{comment}"cub/cub/**",
]),
], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_crt.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ filegroup(
name = "header_list",
%{comment}srcs = if_cuda_newer_than(
%{comment}"13_0",
%{comment}if_true = glob(["include/crt/**"]),
%{comment}if_true = glob(["include/crt/**"], allow_empty = True),
%{comment}if_false = [],
%{comment}),
visibility = ["@local_config_cuda//cuda:__pkg__"],
Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_cudart.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ filegroup(
%{comment}"include/vector_functions.h",
%{comment}"include/vector_functions.hpp",
%{comment}"include/vector_types.h",
%{comment}]),
%{comment}], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_cudnn.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ filegroup(
name = "header_list",
%{comment}srcs = glob([
%{comment}"include/cudnn*.h",
%{comment}]),
%{comment}], allow_empty = True),
)


Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_cudnn8.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ filegroup(
name = "header_list",
%{comment}srcs = glob([
%{comment}"include/cudnn*.h",
%{comment}]),
%{comment}], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_cufft.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ filegroup(
%{comment}srcs = glob([
%{comment}"include/cudalibxt.h",
%{comment}"include/cufft*.h"
%{comment}]),
%{comment}], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_curand.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cc_library(

filegroup(
name = "header_list",
%{comment}srcs = glob(["include/curand*.h"]),
%{comment}srcs = glob(["include/curand*.h"], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_cusolver.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ filegroup(
name = "header_list",
%{comment}srcs = glob([
%{comment}"include/cusolver*.h",
%{comment}]),
%{comment}], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
6 changes: 3 additions & 3 deletions gpu/cuda/build_templates/cuda_nvcc.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ filegroup(
srcs = glob([
"bin/**",
"nvvm/bin/**",
]),
], allow_empty = True),
visibility = ["//visibility:public"],
)

Expand Down Expand Up @@ -89,10 +89,10 @@ filegroup(
%{comment}srcs = glob([
%{comment}"include/fatbinary_section.h",
%{comment}"include/nvPTXCompiler.h",
%{comment}]) + if_cuda_newer_than(
%{comment}], allow_empty = True) + if_cuda_newer_than(
%{comment}"13_0",
%{comment}if_true = [],
%{comment}if_false = glob(["include/crt/**"]),
%{comment}if_false = glob(["include/crt/**"], allow_empty = True),
%{comment}),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)
Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_nvtx.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ filegroup(
%{comment}srcs = glob([
%{comment}"include/nvToolsExt*.h",
%{comment}"include/nvtx3/**",
%{comment}]),
%{comment}], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
2 changes: 1 addition & 1 deletion gpu/cuda/build_templates/cuda_profiler.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ licenses(["restricted"]) # NVIDIA proprietary license

filegroup(
name = "header_list",
%{comment}srcs = glob(["include/**"]),
%{comment}srcs = glob(["include/**"], allow_empty = True),
visibility = ["@local_config_cuda//cuda:__pkg__"],
)

Expand Down
3 changes: 2 additions & 1 deletion gpu/nvidia_common_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ def _get_orig_repo_name(repository_ctx):
return repository_ctx.original_name

# With Bzlmod, the repo name will be something like `_main~cuda_redist_init_ext~cuda_nvml`,
# or `rules_ml_toolchain++cuda_redist_init_ext+cuda_nvml` in Bazel 8.
# we need to extract the original repo name.
return repository_ctx.name.split("~")[-1]
return repository_ctx.name.split("~")[-1].split("+")[-1]

def get_archive_name(url):
# buildifier: disable=function-docstring-return
Expand Down