Skip to content

Commit d5b5bbb

Browse files
leofangclaude
andcommitted
Merge branch 'main' into python-3.15
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 parents 6991490 + 6b81b50 commit d5b5bbb

144 files changed

Lines changed: 8789 additions & 1079 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
* text eol=lf
22
*.cmd text eol=crlf
33

4-
# we do not own any headers checked in, don't touch them
5-
*.h binary
6-
*.hpp binary
7-
# Exception: headers we own
8-
benchmarks/cuda_bindings/benchmarks/cpp/*.hpp -binary text diff
9-
cuda_bindings/cuda/bindings/_bindings/*.h -binary text diff
10-
cuda_bindings/cuda/bindings/_lib/*.h -binary text diff
11-
cuda_core/cuda/core/_cpp/*.h -binary text diff
12-
cuda_core/cuda/core/_cpp/*.hpp -binary text diff
4+
# Keep the vendored DLPack header byte-for-byte, but still show text diffs.
5+
cuda_core/cuda/core/_include/dlpack.h -text !eol diff
136
# git should not convert line endings in PNG files
147
*.png binary
158
*.svg binary

.github/workflows/bandit.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- "pull-request/[0-9]+"
11+
- "ctk-next"
1112
- "main"
1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
@@ -17,6 +18,8 @@ jobs:
1718
analyze:
1819
runs-on: ubuntu-latest
1920
permissions:
21+
actions: read
22+
contents: read
2023
security-events: write
2124
steps:
2225
- name: Checkout

.github/workflows/codeql.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- "pull-request/[0-9]+"
11+
- "ctk-next"
1112
- "main"
1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
@@ -18,6 +19,8 @@ jobs:
1819
name: Analyze (${{ matrix.language }})
1920
runs-on: ubuntu-latest
2021
permissions:
22+
actions: read
23+
contents: read
2124
security-events: write
2225

2326
strategy:

.github/workflows/restricted-paths-guard.yml

Lines changed: 116 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,27 @@ jobs:
2424
steps:
2525
- name: Inspect PR author signals for restricted paths
2626
env:
27-
# PR metadata inputs (author_association from event payload is
28-
# unreliable for fork PRs, so we query the collaborator API directly)
27+
# PR metadata inputs (the event payload's author_association can be
28+
# stale for fork PRs, so restricted-path PRs query the live PR API).
2929
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
3030
PR_NUMBER: ${{ github.event.pull_request.number }}
3131
PR_URL: ${{ github.event.pull_request.html_url }}
3232
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
3333

3434
# Workflow policy inputs
3535
REVIEW_LABEL: Needs-Restricted-Paths-Review
36+
# Temporary testing recipe for agents:
37+
# 1. Change pull_request_target to pull_request.
38+
# 2. Set DRY_RUN_REVIEW_LABEL_WRITES to true.
39+
# 3. Add a dummy comment or whitespace-only change in
40+
# cuda_bindings/README.md to trigger restricted-path detection
41+
# without affecting build/package behavior.
42+
# 4. Replace both trusted case patterns below with DRY_RUN_NEVER_MATCH
43+
# so the test does not depend on the tester's GitHub identity:
44+
# MEMBER|OWNER and admin|maintain|write|triage.
45+
# 5. Commit these changes as a temporary dry-run test commit and revert
46+
# that commit before merge.
47+
DRY_RUN_REVIEW_LABEL_WRITES: false
3648

3749
# API request context/auth
3850
GH_TOKEN: ${{ github.token }}
@@ -42,6 +54,8 @@ jobs:
4254
4355
COLLABORATOR_PERMISSION="not checked"
4456
COLLABORATOR_PERMISSION_API_ERROR=""
57+
AUTHOR_ASSOCIATION="not checked"
58+
AUTHOR_ASSOCIATION_API_ERROR=""
4559
4660
if ! MATCHING_RESTRICTED_PATHS=$(
4761
gh api \
@@ -68,6 +82,7 @@ jobs:
6882
echo ""
6983
echo "- **Error**: Failed to inspect the PR file list."
7084
echo "- **Author**: $PR_AUTHOR"
85+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
7186
echo "- **Collaborator permission**: $COLLABORATOR_PERMISSION"
7287
echo ""
7388
echo "Please update the PR at: $PR_URL"
@@ -88,6 +103,7 @@ jobs:
88103
echo ""
89104
echo "- **Error**: Failed to inspect the current PR labels."
90105
echo "- **Author**: $PR_AUTHOR"
106+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
91107
echo "- **Collaborator permission**: $COLLABORATOR_PERMISSION"
92108
echo ""
93109
echo "Please update the PR at: $PR_URL"
@@ -114,11 +130,32 @@ jobs:
114130
echo '```'
115131
}
116132
133+
write_author_association_api_error() {
134+
echo "- **Author association API error**:"
135+
echo '```text'
136+
printf '%s\n' "$AUTHOR_ASSOCIATION_API_ERROR"
137+
echo '```'
138+
}
139+
140+
build_review_label_comment() {
141+
printf '%s\n\n%s\n\n%s\n\n%s\n\n%s\n' \
142+
"\`$REVIEW_LABEL\` was assigned by \`CI: Restricted Paths Guard\`." \
143+
"For details, open [this workflow run]($RUN_URL) and click **Summary**." \
144+
"For external contributors: thank you for your interest in improving CUDA Python. The \`cuda_bindings/\` package is distributed under the [NVIDIA Software License](https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/LICENSE), which does not allow us to accept external contributions to files under \`cuda_bindings/\` in this repository." \
145+
"Please close this PR. If your changes also include updates outside \`cuda_bindings/\`, please open a new PR containing only those changes so we can review them separately under the applicable license." \
146+
"If you are an NVIDIA employee and believe this label was applied in error, no action is needed; a maintainer will review and remove the label if appropriate."
147+
}
148+
149+
write_review_label_comment_dry_run() {
150+
echo "- **Dry-run comment body**:"
151+
echo '```markdown'
152+
build_review_label_comment
153+
echo '```'
154+
}
155+
117156
post_review_label_comment() {
118157
local comment_body
119-
printf -v comment_body '%s\n\n%s\n' \
120-
"\`$REVIEW_LABEL\` was assigned by \`CI: Restricted Paths Guard\`." \
121-
"For details, open [this workflow run]($RUN_URL) and click **Summary**."
158+
comment_body=$(build_review_label_comment)
122159
123160
if gh api "repos/$REPO/issues/$PR_NUMBER/comments" \
124161
-f body="$comment_body" >/dev/null; then
@@ -135,46 +172,87 @@ jobs:
135172
COMMENT_ACTION="not needed"
136173
137174
if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ]; then
138-
# Distinguish a legitimate 404 "not a collaborator" response from
139-
# actual API failures. The former is an expected untrusted case;
140-
# the latter fails the workflow so it can be rerun later.
141-
if COLLABORATOR_PERMISSION_RESPONSE=$(
142-
gh api "repos/$REPO/collaborators/$PR_AUTHOR/permission" \
143-
--jq '.permission' 2>&1
175+
if AUTHOR_ASSOCIATION_RESPONSE=$(
176+
gh api "repos/$REPO/pulls/$PR_NUMBER" \
177+
--jq '.author_association // "NONE"' 2>&1
144178
); then
145-
COLLABORATOR_PERMISSION="$COLLABORATOR_PERMISSION_RESPONSE"
146-
elif [[ "$COLLABORATOR_PERMISSION_RESPONSE" == *"(HTTP 404)"* ]]; then
147-
COLLABORATOR_PERMISSION="none"
179+
AUTHOR_ASSOCIATION="$AUTHOR_ASSOCIATION_RESPONSE"
148180
else
149-
COLLABORATOR_PERMISSION="unknown"
150-
COLLABORATOR_PERMISSION_API_ERROR="$COLLABORATOR_PERMISSION_RESPONSE"
151-
echo "::error::Failed to inspect collaborator permission for $PR_AUTHOR."
181+
AUTHOR_ASSOCIATION="unknown"
182+
AUTHOR_ASSOCIATION_API_ERROR="$AUTHOR_ASSOCIATION_RESPONSE"
183+
echo "::error::Failed to inspect live author association for PR #$PR_NUMBER."
152184
{
153185
echo "## Restricted Paths Guard Failed"
154186
echo ""
155-
echo "- **Error**: Failed to inspect collaborator permission."
187+
echo "- **Error**: Failed to inspect live author association."
156188
echo "- **Author**: $PR_AUTHOR"
157-
echo "- **Collaborator permission**: $COLLABORATOR_PERMISSION"
189+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
158190
echo ""
159191
write_matching_restricted_paths
160192
echo ""
161-
write_collaborator_permission_api_error
193+
write_author_association_api_error
162194
echo ""
163-
echo "Please retry this workflow. If the failure persists, inspect the collaborator permission API error above."
195+
echo "Please retry this workflow. If the failure persists, inspect the author association API error above."
164196
} >> "$GITHUB_STEP_SUMMARY"
165197
exit 1
166198
fi
167199
168-
case "$COLLABORATOR_PERMISSION" in
169-
admin|maintain|write|triage|read)
200+
case "$AUTHOR_ASSOCIATION" in
201+
MEMBER|OWNER)
170202
HAS_TRUSTED_SIGNAL=true
171-
LABEL_ACTION="not needed (collaborator permission is a trusted signal)"
172-
TRUSTED_SIGNALS="collaborator_permission:$COLLABORATOR_PERMISSION"
203+
LABEL_ACTION="not needed (live author association is a trusted signal)"
204+
TRUSTED_SIGNALS="author_association:$AUTHOR_ASSOCIATION"
173205
;;
174206
*)
175-
# none: not a trusted signal
207+
# COLLABORATOR can still be too broad for this policy; use the
208+
# collaborator permission API below for repo-level trust.
176209
;;
177210
esac
211+
212+
# Distinguish a legitimate 404 "not a collaborator" response from
213+
# actual API failures. The former is an expected untrusted case;
214+
# the latter fails the workflow so it can be rerun later.
215+
if [ "$HAS_TRUSTED_SIGNAL" = "false" ]; then
216+
if COLLABORATOR_PERMISSION_RESPONSE=$(
217+
gh api "repos/$REPO/collaborators/$PR_AUTHOR/permission" \
218+
--jq '.permission' 2>&1
219+
); then
220+
COLLABORATOR_PERMISSION="$COLLABORATOR_PERMISSION_RESPONSE"
221+
elif [[ "$COLLABORATOR_PERMISSION_RESPONSE" == *"(HTTP 404)"* ]]; then
222+
COLLABORATOR_PERMISSION="none"
223+
else
224+
COLLABORATOR_PERMISSION="unknown"
225+
COLLABORATOR_PERMISSION_API_ERROR="$COLLABORATOR_PERMISSION_RESPONSE"
226+
echo "::error::Failed to inspect collaborator permission for $PR_AUTHOR."
227+
{
228+
echo "## Restricted Paths Guard Failed"
229+
echo ""
230+
echo "- **Error**: Failed to inspect collaborator permission."
231+
echo "- **Author**: $PR_AUTHOR"
232+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
233+
echo "- **Collaborator permission**: $COLLABORATOR_PERMISSION"
234+
echo ""
235+
write_matching_restricted_paths
236+
echo ""
237+
write_collaborator_permission_api_error
238+
echo ""
239+
echo "Please retry this workflow. If the failure persists, inspect the collaborator permission API error above."
240+
} >> "$GITHUB_STEP_SUMMARY"
241+
exit 1
242+
fi
243+
244+
case "$COLLABORATOR_PERMISSION" in
245+
admin|maintain|write|triage)
246+
HAS_TRUSTED_SIGNAL=true
247+
LABEL_ACTION="not needed (collaborator permission is a trusted signal)"
248+
TRUSTED_SIGNALS="collaborator_permission:$COLLABORATOR_PERMISSION"
249+
;;
250+
*)
251+
# read or none: not a trusted signal. In a public repo, read
252+
# can be the effective permission for any GitHub user.
253+
;;
254+
esac
255+
fi
178256
fi
179257
180258
NEEDS_REVIEW_LABEL=false
@@ -190,13 +268,24 @@ jobs:
190268
if [ "$NEEDS_REVIEW_LABEL" = "true" ]; then
191269
if [ "$LABEL_ALREADY_PRESENT" = "true" ]; then
192270
LABEL_ACTION="already present"
271+
elif [ "$DRY_RUN_REVIEW_LABEL_WRITES" = "true" ]; then
272+
LABEL_ACTION="would add (dry run)"
273+
COMMENT_ACTION="would post (dry run)"
274+
{
275+
echo "## Restricted Paths Guard Dry Run"
276+
echo ""
277+
echo "- **Would add label**: \`$REVIEW_LABEL\`"
278+
echo ""
279+
write_review_label_comment_dry_run
280+
} >> "$GITHUB_STEP_SUMMARY"
193281
elif ! gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label "$REVIEW_LABEL"; then
194282
echo "::error::Failed to add the $REVIEW_LABEL label."
195283
{
196284
echo "## Restricted Paths Guard Failed"
197285
echo ""
198286
echo "- **Error**: Failed to add the \`$REVIEW_LABEL\` label."
199287
echo "- **Author**: $PR_AUTHOR"
288+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
200289
echo "- **Collaborator permission**: $COLLABORATOR_PERMISSION"
201290
echo ""
202291
write_matching_restricted_paths
@@ -216,6 +305,7 @@ jobs:
216305
echo "## Restricted Paths Guard Completed"
217306
echo ""
218307
echo "- **Author**: $PR_AUTHOR"
308+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
219309
echo "- **Collaborator permission**: $COLLABORATOR_PERMISSION"
220310
echo "- **Touches restricted paths**: $TOUCHES_RESTRICTED_PATHS"
221311
echo "- **Restricted paths**: \`cuda_bindings/\`, \`cuda_python/\`"

.github/workflows/test-sdist-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ permissions:
2222
jobs:
2323
test-sdist:
2424
name: Test sdist builds
25+
timeout-minutes: 60
2526
runs-on: linux-amd64-cpu8
2627
steps:
2728
- name: Checkout ${{ github.event.repository.name }}

.github/workflows/test-sdist-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ permissions:
2828
jobs:
2929
test-sdist:
3030
name: Test sdist builds
31+
timeout-minutes: 60
3132
runs-on: windows-2022
3233
steps:
3334
- name: Checkout ${{ github.event.repository.name }}

.github/workflows/test-wheel-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
9797
test:
9898
name: Python ${{ matrix.PY_VER }}, CUDA ${{ matrix.CUDA_VER }} (${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}), GPU ${{ matrix.GPU }}${{ matrix.GPU_COUNT != '1' && format(' (x{0})', matrix.GPU_COUNT) || '' }}${{ matrix.FLAVOR && format(', {0}', matrix.FLAVOR) || '' }}${{ matrix.TORCH_VER && format(', {0}', matrix.TORCH_VER) || '' }}${{ matrix.MODE == 'nightly-numba-cuda' && ', latest' || '' }}
99+
timeout-minutes: 60
99100
needs: compute-matrix
100101
strategy:
101102
fail-fast: false

.github/workflows/test-wheel-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
8989
test:
9090
name: Python ${{ matrix.PY_VER }}, CUDA ${{ matrix.CUDA_VER }} (${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}), GPU ${{ matrix.GPU }}${{ matrix.GPU_COUNT != '1' && format(' (x{0})', matrix.GPU_COUNT) || '' }} (${{ matrix.DRIVER_MODE }})${{ matrix.TORCH_VER && format(', {0}', matrix.TORCH_VER) || '' }}${{ matrix.MODE == 'nightly-numba-cuda' && ', latest' || '' }}
91+
timeout-minutes: 60
9192
# The build stage could fail but we want the CI to keep moving.
9293
needs: compute-matrix
9394
strategy:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CUDA Python is the home for accessing NVIDIA’s CUDA platform from Python. It c
77
* [cuda.pathfinder](https://nvidia.github.io/cuda-python/cuda-pathfinder/latest): Utilities for locating CUDA components installed in the user's Python environment
88
* [cuda.coop](https://nvidia.github.io/cccl/unstable/python/coop.html): A Python module providing CCCL's reusable block-wide and warp-wide *device* primitives for use within Numba CUDA kernels
99
* [cuda.compute](https://nvidia.github.io/cccl/unstable/python/compute/index.html): A Python module for easy access to CCCL's highly efficient and customizable parallel algorithms, like `sort`, `scan`, `reduce`, `transform`, etc. that are callable on the *host*
10+
* [numba-cuda-mlir](https://nvidia.github.io/numba-cuda-mlir/): An evolution of Numba CUDA that improves upon its technical foundation and performance to provide the future of CUDA Python JIT compilation. It currently supports developing CUDA **SIMT** kernels in Python, providing Python bindings for accelerated device libraries, and serving as a compiler for user-defined functions in accelerated libraries.
1011
* [numba.cuda](https://nvidia.github.io/numba-cuda/): A Python DSL that exposes CUDA **SIMT** programming model and compiles a restricted subset of Python code into CUDA kernels and device functions
1112
* [cuda.tile](https://docs.nvidia.com/cuda/cutile-python/): A new Python DSL that exposes CUDA **Tile** programming model and allows users to write NumPy-like code in CUDA kernels
1213
* [nvmath-python](https://docs.nvidia.com/cuda/nvmath-python/latest): Pythonic access to NVIDIA CPU & GPU Math Libraries, with [*host*](https://docs.nvidia.com/cuda/nvmath-python/latest/overview.html#host-apis), [*device*](https://docs.nvidia.com/cuda/nvmath-python/latest/overview.html#device-apis), and [*distributed*](https://docs.nvidia.com/cuda/nvmath-python/latest/distributed-apis/index.html) APIs. It also provides low-level Python bindings to host C APIs ([nvmath.bindings](https://docs.nvidia.com/cuda/nvmath-python/latest/bindings/index.html)).

0 commit comments

Comments
 (0)