Skip to content

Add system-provided CUDA library targets - #18

Merged
cerisier merged 2 commits into
hermeticbuild:mainfrom
cjm-dd:cjm/interface_targets
Aug 23, 2026
Merged

cerisier merged 2 commits into
hermeticbuild:mainfrom
cjm-dd:cjm/interface_targets

Conversation

@cjm-dd

@cjm-dd cjm-dd commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a system-provided sibling for each CUDA shared-library target. Consumers can select foo_system when CUDA is supplied by the runtime environment, while the existing foo and foo_static targets keep their current behavior.

At the lowest layer, each existing cc_import named *_shared_library now has a matching *_interface_library import with system_provided = True. The public foo_system wrappers mirror the dependency relationships of foo, while the interface imports themselves remain independent of other interface imports. This keeps the imports lightweight and makes composition explicit at the public target layer.

Header dependency closure now lives on each component's headers target. As a result, shared, static, and system-provided variants all receive the headers they need, but the system-provided graph does not acquire any packaged *_shared_library targets.

The interface imports prefer NVIDIA's lightweight linker stubs under lib/stubs/ whenever the redistribution ships them. Archives without a stub use the unversioned DSO as the interface-only linker input. The relevant component archives were checked across every supported CUDA version and applicable Linux x86_64/SBSA variant; the notable compatibility exception is CUDA 12.1.1's nvJitLink archive, which does not contain a stub and therefore falls back to lib/libnvJitLink.so.

The README documents the new target convention and the requirement that foo_system consumers provide the corresponding runtime libraries.

Validation

  • buildifier -mode=check on the changed BUILD and Starlark files
  • git diff --check
  • downstream Bzlmod consumer builds that compile component headers in isolation and link an aggregate system-interface target for CUDA 12.1.1, 12.8.1, and 13.2.1
  • configured dependency query confirming that the aggregate system-provided graph contains no *_shared_library labels
  • archive-member inventory across all 29 supported CUDA versions (594 version/platform records, 460 unique archives)

@cjm-dd cjm-dd changed the title Add system-provided CUDA interface libraries Add system-provided CUDA library targets Aug 14, 2026
@cjm-dd
cjm-dd marked this pull request as ready for review August 14, 2026 19:23

@cerisier cerisier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's just great thanks :)

@cerisier
cerisier merged commit edea7ad into hermeticbuild:main Aug 23, 2026
6 checks passed
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