Skip to content

cuda-bindings: remove external patches, re-land under NVIDIA authorship, add CI guard - #152

Merged
nihalpasham merged 3 commits into
mainfrom
fix/cuda-bindings-license-compliance
Jun 10, 2026
Merged

nihalpasham merged 3 commits into
mainfrom
fix/cuda-bindings-license-compliance

Conversation

@nihalpasham

@nihalpasham nihalpasham commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

crates/cuda-bindings ships under the NVIDIA Software License (LICENSE-NVIDIA) and accepts no external contributions. Two externally-authored patches landed in it anyway (ddc6f07 via #17, and 1014ee5 via #15, which ported #7). This PR removes them and re-implements the functionality under NVIDIA authorship:

  • Commit 1 restores crates/cuda-bindings to its pre-patch state (build.rs is byte-identical to the tree before the first patch) and points cuda-core's CudaEvent::elapsed_ms back at cuEventElapsedTime_v2 so the commit builds standalone.
  • Commit 2 re-implements the same functionality, written again: CUDA_HOME fallback for toolkit discovery, a cuda.h probe for the CUDA 12.8 cuEventElapsedTime_v2 rename, and the cu_event_elapsed_time dispatch shim. It also fixes two gaps the originals left: the runtime cuda_toolkit_dir() helper now honors CUDA_HOME (restoring its documented parity with build.rs), and the crate docs/README now document CUDA_HOME.
  • Commit 3 adds cuda-bindings-guard.yml: PRs fail when any commit touching crates/cuda-bindings/ has a non-@nvidia.com author email or non-NVIDIA Co-authored-by trailers; commits without a GitHub-verified signature get a non-blocking warning. CODEOWNERS routes such changes to maintainer review.

The contributors' work in Apache-2.0 crates (cargo-oxide arch forwarding) is untouched and keeps its original authorship. Net behavior change for users: none.

Test plan

  • cargo clippy -p cuda-bindings -p cuda-core -p cargo-oxide -- -D warnings
  • cargo test -p cuda-bindings -p cuda-core -p cargo-oxide
  • CUDA_HOME-only build resolves a CUDA 13.3 toolkit and the version probe emits the cfg
  • vecadd/async_vecadd smoketest passes on sm_120
  • CudaEvent::elapsed_ms through the new shim returns sane timings on GPU
  • Guard script exercised directly: flags both historical external commits, passes this branch, flags a synthetic non-NVIDIA co-author while allowing an NVIDIA one

…mpliance)

crates/cuda-bindings is distributed under the NVIDIA Software License
(LICENSE-NVIDIA) and does not accept external contributions. Two
externally-authored patches landed in it anyway:

- 1014ee5 (PR #15, porting PR #7): build-time probe for
  cuEventElapsedTime_v2 in cuda.h plus a hand-written dispatch helper
  cu_event_elapsed_time in src/lib.rs.
- ddc6f07 (PR #17): CUDA_HOME fallback for toolkit discovery and a
  warning when cuda.h is unreadable, in build.rs.

This commit restores crates/cuda-bindings to its pre-patch state
(build.rs is byte-identical to the tree before 1014ee5; src/lib.rs
keeps only the later NVIDIA-authored rustdoc-lint block) and points
cuda-core's CudaEvent::elapsed_ms back at cuEventElapsedTime_v2
directly so this commit builds standalone.

The functionality is re-implemented under NVIDIA authorship in the
follow-up commit. Changes the same patches made to Apache-2.0 crates
(cargo-oxide arch forwarding) are unaffected and keep their original
authorship.
…m under NVIDIA authorship

Re-implements, as NVIDIA-authored code, the functionality removed in
the previous commit (license compliance: crates/cuda-bindings is under
LICENSE-NVIDIA and accepts no external contributions):

- build.rs resolves the toolkit root from CUDA_TOOLKIT_PATH, then
  CUDA_HOME, then /usr/local/cuda, with rerun-if-env-changed on both
  variables, and warns instead of silently skipping when cuda.h is
  unreadable. Issue originally reported in PR #17.
- build.rs probes cuda.h for cuEventElapsedTime_v2 (renamed in CUDA
  12.8) and emits the cuda_has_cuEventElapsedTime_v2 cfg; lib.rs gains
  the cu_event_elapsed_time dispatch shim so cuda-core works against
  both pre- and post-12.8 toolkits. Issue originally reported in
  PR #7 / PR #15.

Also fixes two gaps the original patches left:

- The runtime cuda_toolkit_dir() helper now honors CUDA_HOME too, so
  its documented "resolution matches build.rs" contract holds again.
- Crate docs and the README env-var table now document CUDA_HOME.

Verified: clippy -D warnings clean; crate tests pass; cuda-bindings
builds with CUDA_HOME-only resolution (probe emits the cfg against
CUDA 13.3 headers); vecadd/async_vecadd smoketest passes on sm_120;
CudaEvent::elapsed_ms through the new shim returns sane timings on GPU.
Adds cuda-bindings-guard.yml: PRs fail when any commit touching
crates/cuda-bindings/ has a [email protected] author email or carries
non-NVIDIA Co-authored-by trailers. Author emails are self-reported,
so the guard also warns (non-blocking) when such a commit lacks a
GitHub-verified signature; requiring signatures outright would block
contributors who do not sign commits, so impersonation is left to
maintainer review.

The failure message follows the maintainer-port protocol: external
contributors need no action; a maintainer splits the cuda-bindings
portion out and re-lands it under NVIDIA authorship.

No paths: filter, so the check always reports a status and can be
made required in branch protection. CODEOWNERS routes cuda-bindings
changes to maintainer review as the human layer of the same policy.

Tested by extracting the script and running it against: the two
historical external commits (both flagged, exit 1); this branch's
NVIDIA-authored commits (pass); and a synthetic commit with mixed
NVIDIA + external Co-authored-by trailers (external one flagged,
NVIDIA one allowed).
@nihalpasham nihalpasham added cuda-bindings Raw FFI bindings to the CUDA driver/runtime build-related Build scripts, toolchain discovery, or compilation setup refactor Internal restructuring with no behavior change labels Jun 10, 2026
@nihalpasham
nihalpasham merged commit e411623 into main Jun 10, 2026
23 checks passed
@nihalpasham
nihalpasham deleted the fix/cuda-bindings-license-compliance branch June 12, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup cuda-bindings Raw FFI bindings to the CUDA driver/runtime refactor Internal restructuring with no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant