Repository navigation
cuda-bindings: remove external patches, re-land under NVIDIA authorship, add CI guard - #152
Merged
Merged
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/cuda-bindingsships 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:crates/cuda-bindingsto its pre-patch state (build.rsis byte-identical to the tree before the first patch) and pointscuda-core'sCudaEvent::elapsed_msback atcuEventElapsedTime_v2so the commit builds standalone.CUDA_HOMEfallback for toolkit discovery, acuda.hprobe for the CUDA 12.8cuEventElapsedTime_v2rename, and thecu_event_elapsed_timedispatch shim. It also fixes two gaps the originals left: the runtimecuda_toolkit_dir()helper now honorsCUDA_HOME(restoring its documented parity withbuild.rs), and the crate docs/README now documentCUDA_HOME.cuda-bindings-guard.yml: PRs fail when any commit touchingcrates/cuda-bindings/has a non-@nvidia.comauthor email or non-NVIDIACo-authored-bytrailers; 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-oxidearch 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 warningscargo test -p cuda-bindings -p cuda-core -p cargo-oxideCUDA_HOME-only build resolves a CUDA 13.3 toolkit and the version probe emits the cfgCudaEvent::elapsed_msthrough the new shim returns sane timings on GPU