Skip to content

Commit 66c55f0

Browse files
committed
Merge remote-tracking branch 'origin/main' into ajost/host-launch
2 parents 832969d + d649075 commit 66c55f0

12 files changed

Lines changed: 145 additions & 123 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## Description
22

3-
<!-- Every PR should have a corresponding issue that describes and motivates the work done in the PR -->
3+
<!-- Link the relevant issue, if any. -->
44
closes <!-- Link issue here -->
55

66
<!-- Provide a standalone description of changes in this PR. -->
77

88
<!-- Note: The pull request title will be included in the CHANGELOG. -->
99

1010
## Checklist
11-
<!-- TODO: - [ ] I am familiar with the [Contributing Guidelines](). -->
11+
- [ ] I have read the [Contributing Guidelines](https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md#coordinate-before-implementing).
1212
- [ ] New or existing tests cover these changes.
1313
- [ ] The documentation is up to date with these changes.

‎.github/workflows/runner-trust-probe.yml‎

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ name: "CI: Runner trust probe"
1111

1212
on:
1313
schedule:
14-
# Weekly on Mondays at 06:23 UTC
15-
- cron: "23 6 * * 1"
14+
# Daily at 06:00 PST (14:00 UTC)
15+
- cron: "0 14 * * *"
1616
workflow_dispatch:
1717
inputs:
1818
label-filter:
@@ -31,7 +31,10 @@ defaults:
3131
jobs:
3232
compute-matrix:
3333
name: Compute runner label sets
34-
if: ${{ github.repository_owner == 'nvidia' }}
34+
# Skip on forks (which cannot reach the self-hosted runners). This is true on
35+
# both NVIDIA/cuda-python and the private development repo, so the one guard
36+
# works unchanged on both and the workflow does not diverge between branches.
37+
if: ${{ !github.event.repository.fork }}
3538
runs-on: ubuntu-latest
3639
timeout-minutes: 5
3740
outputs:
@@ -49,29 +52,48 @@ jobs:
4952
env:
5053
LABEL_FILTER: ${{ inputs.label-filter || '' }}
5154
run: |
52-
# Hosted and self-hosted CPU labels are listed explicitly; GPU labels
53-
# are derived from ci/test-matrix.yml.
54-
labels_json="$(yq -o json '.' ci/test-matrix.yml | jq -c --arg filter "${LABEL_FILTER}" '
55+
# GitHub-hosted labels are a small, stable seed. Self-hosted labels are
56+
# discovered from the runner labels referenced across this branch's own
57+
# workflows, so the probe self-adapts per branch (for example the
58+
# internal labels on the private development branch) without this file
59+
# diverging between branches. GPU labels that are built from
60+
# ci/test-matrix.yml at runtime are not literals in any workflow, so
61+
# they are still derived from that file.
62+
hosted='["ubuntu-latest","windows-latest","windows-2022","windows-11-arm"]'
63+
64+
# Discover runner-label literals from the workflows. The grammar matches
65+
# self-hosted labels (-cpuN, -gpu-, -internal, -1xgb10, riscv64) and any
66+
# GPU labels hard-coded in a workflow; GitHub-hosted names and
67+
# host-platform strings (e.g. 'linux-64') deliberately do not match.
68+
scanned="$(grep -rhoE \
69+
'(linux|windows|wsl)-[a-z0-9-]*(cpu[0-9]+|gpu-[a-z0-9]|internal|1xgb10)[a-z0-9-]*|(linux|windows|wsl)-riscv64-[a-z0-9][a-z0-9-]*[a-z0-9]' \
70+
.github/workflows/ --exclude=runner-trust-probe.yml \
71+
| sort -u | jq -Rsc 'split("\n") | map(select(length > 0 and (endswith("-") | not)))' || true)"
72+
scanned="${scanned:-[]}"
73+
74+
# GPU labels derived from the test matrix cover labels passed via matrix
75+
# outputs that never appear as literals in a workflow.
76+
gpu="$(yq -o json '.' ci/test-matrix.yml | jq -c '
5577
{
56-
host: (
57-
[
58-
"ubuntu-latest",
59-
"linux-amd64-cpu8",
60-
"linux-arm64-cpu8",
61-
"linux-amd64-cpu4",
62-
"windows-latest",
63-
"windows-2022",
64-
"windows-11-arm"
65-
] + [
66-
(.windows["pull-request"][]?, .windows["nightly"][]?)
67-
| "windows-\(.ARCH)-gpu-\(.GPU)-\(if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)-\(.GPU_COUNT)"
68-
]
69-
),
70-
linux_gpu: [
71-
(.linux["pull-request"][]?, .linux["nightly"][]?)
72-
| "\(.FLAVOR // "linux")-\(.ARCH)-gpu-\(.GPU)-\(if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)-\(.GPU_COUNT)"
73-
]
74-
}
78+
windows: [ (.windows["pull-request"][]?, .windows["nightly"][]?)
79+
| "windows-\(.ARCH)-gpu-\(.GPU)-\(if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)-\(.GPU_COUNT)" ],
80+
linux: [ (.linux["pull-request"][]?, .linux["nightly"][]?)
81+
| "\(.FLAVOR // "linux")-\(.ARCH)-gpu-\(.GPU)-\(if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)-\(.GPU_COUNT)" ]
82+
}')"
83+
84+
# A label runs in the Linux GPU container probe when it is a linux/wsl
85+
# GPU label; every other discovered label runs on the host probe.
86+
labels_json="$(jq -cn \
87+
--argjson hosted "${hosted}" \
88+
--argjson scanned "${scanned}" \
89+
--argjson gpu "${gpu}" \
90+
--arg filter "${LABEL_FILTER}" '
91+
def is_linux_gpu: test("^(linux|wsl)-.*-gpu-");
92+
(($scanned + $gpu.linux + $gpu.windows)) as $discovered
93+
| {
94+
host: ($hosted + ($discovered | map(select(is_linux_gpu | not)))),
95+
linux_gpu: ($discovered | map(select(is_linux_gpu)))
96+
}
7597
| map_values(unique | if $filter != "" then map(select(test($filter))) else . end)
7698
')"
7799

‎AGENTS.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ pre-tag bootstrap should validate the resulting release tuple rather than
4444
hard-code the expected alpha/development suffix, and should report the
4545
effective `git describe` result for traceability.
4646

47+
# Contributions
48+
49+
Before starting implementation or preparing an issue or PR, follow the
50+
[contribution guidelines](CONTRIBUTING.md#coordinate-before-implementing).
51+
52+
For an external contribution, briefly explain any unmet coordination requirement
53+
for that change and the next step before starting implementation.
54+
4755
# Pull requests
4856

4957
Treat the canonical upstream repository as read-only by default. For normal

‎CONTRIBUTING.md‎

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
11
# Contributing to CUDA Python
22

3-
Thank you for your interest in contributing to CUDA Python! Based on the type of contribution, it will fall into two categories:
4-
5-
1. You want to report a bug, feature request, or documentation issue:
6-
- File an [issue](https://github.com/NVIDIA/cuda-python/issues/new/choose)
7-
describing what you encountered or what you want to see changed.
8-
- The NVIDIA team will evaluate the issues and triage them, scheduling
9-
them for a release. If you believe the issue needs priority attention
10-
comment on the issue to notify the team.
11-
2. You want to implement a feature, improvement, or bug fix:
12-
- Before starting work on an existing issue, please comment on the issue to express your interest and wait to be assigned by a maintainer. This helps avoid redundant effort in case the issue is already being worked on by another contributor or an NVIDIA team member.
13-
- Please refer to each component's guideline:
14-
- [`cuda.core`](https://nvidia.github.io/cuda-python/cuda-core/latest/contribute.html)
15-
- [`cuda.bindings`](https://nvidia.github.io/cuda-python/cuda-bindings/latest/contribute.html)<sup>[1](#footnote1)</sup>
16-
- [`cuda.pathfinder`](https://nvidia.github.io/cuda-python/cuda-pathfinder/latest/contribute.html)
3+
Thank you for your interest in contributing to CUDA Python! Bug reports,
4+
reproducers, documentation improvements, and code changes are welcome.
175

186
## Table of Contents
197

208
- [Contributing to CUDA Python](#contributing-to-cuda-python)
219
- [Table of Contents](#table-of-contents)
10+
- [Coordinate before implementing](#coordinate-before-implementing)
2211
- [Cloning the repository](#cloning-the-repository)
2312
- [Recommended clone](#recommended-clone)
2413
- [Updating your clone](#updating-your-clone)
@@ -32,6 +21,7 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
3221
- [Review Guidance](#review-guidance)
3322
- [Pull Request Reviews](#pull-request-reviews)
3423
- [Pixi lockfiles](#pixi-lockfiles)
24+
- [Secret Scanning](#secret-scanning)
3525
- [Signing Your Work](#signing-your-work)
3626
- [Code signing](#code-signing)
3727
- [Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco)
@@ -45,6 +35,27 @@ Thank you for your interest in contributing to CUDA Python! Based on the type of
4535
- [Code coverage](#code-coverage)
4636

4737

38+
## Coordinate before implementing
39+
40+
Review capacity is limited. If you are contributing from outside NVIDIA:
41+
42+
- **Existing issue:** comment and wait for a maintainer to assign it to you or
43+
explicitly ask you to implement it. Check existing assignments and requests
44+
to take the issue.
45+
- **New features, design changes, or CI/release infrastructure:** open an issue
46+
and agree on scope and validation before implementing.
47+
- **Small standalone bug or documentation fixes without an existing issue:**
48+
a direct PR is welcome. Explain the problem and how you checked the fix.
49+
50+
NVIDIA contributors may use normal team planning and self-assignment.
51+
52+
Feel free to report a bug or send reproducers, measurements, and suggestions
53+
without an assignment. Include relevant versions and expected versus observed
54+
behavior in bug reports.
55+
56+
Keep changes focused, understand the complete diff, and report which checks
57+
ran and any validation gaps.
58+
4859
## Cloning the repository
4960

5061
### Recommended clone
@@ -462,7 +473,3 @@ The CI pipeline diagram is maintained as Mermaid source in [`ci/ci-pipeline.mmd`
462473
Code coverage reports are produced nightly and posted to [GitHub Pages](https://nvidia.github.io/cuda-python/coverage).
463474

464475
Known limitations: Code coverage is only run on Linux x86_64 with an a100 GPU. We plan to add more platform and GPU coverage in the future.
465-
466-
---
467-
468-
<a>1</a>: The `cuda-python` meta package shares the same license and the contributing guidelines as those of `cuda-bindings`.

‎ci/tools/install_gpu_driver.sh‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,23 @@ in_container() {
9090
}
9191

9292
host_install() {
93-
apt-get -y install build-essential dkms "linux-headers-$(uname -r)" psmisc kmod
93+
local kernel_release kernel_gcc default_gcc
94+
kernel_release=$(uname -r)
95+
apt-get -y install build-essential
96+
97+
# Match the kernel's GCC major only when the default compiler differs.
98+
kernel_gcc=$(sed -nE 's/.*gcc(-[0-9]+)? (\([^)]*\) )?([0-9]+)\..*/\3/p' /proc/version)
99+
default_gcc=$(gcc -dumpversion | cut -d. -f1)
100+
echo "Kernel ${kernel_release}: GCC major=${kernel_gcc:-unknown}, default GCC major=${default_gcc}" >&2
101+
if [ -n "$kernel_gcc" ] && [ "$kernel_gcc" != "$default_gcc" ]; then
102+
apt-get -y install "gcc-${kernel_gcc}" "g++-${kernel_gcc}"
103+
# Installing a versioned compiler does not change the default; select it for DKMS.
104+
export CC="gcc-${kernel_gcc}" CXX="g++-${kernel_gcc}"
105+
echo "Kernel ${kernel_release}: using CC=${CC} CXX=${CXX}" >&2
106+
fi
107+
108+
# Header installation can trigger DKMS builds, so select the compiler first.
109+
apt-get -y install dkms "linux-headers-${kernel_release}" psmisc kmod
94110

95111
# Download and verify the installer before tearing down the existing
96112
# host driver so a download failure or SHA-256 mismatch leaves the

‎ci/tools/runner_trust_probe_node.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ module.exports = async function runNodeTrustProbe({
4848

4949
const tlsResult = await probeEndpoint();
5050
const rows = [
51-
['Node version', versionOk ? '**PASS**' : '**FAIL**', `\`${version}\` (require Node 24 \`>= v24.22.1\`; \`execPath=${execPath}\`)`],
52-
['Node env overrides', '**INFO**', `\`NODE_OPTIONS=${nodeOptions}\`, \`NODE_EXTRA_CA_CERTS=${extraCa}\`, \`NODE_USE_SYSTEM_CA=${useSystemCa}\``],
53-
['Node rejects test endpoint', `**${tlsResult.status}**`, tlsResult.detail],
51+
['Node version', versionOk ? '<strong>PASS</strong>' : '<strong>FAIL</strong>', `\`${version}\` (require Node 24 \`>= v24.22.1\`; \`execPath=${execPath}\`)`],
52+
['Node env overrides', '<strong>INFO</strong>', `\`NODE_OPTIONS=${nodeOptions}\`, \`NODE_EXTRA_CA_CERTS=${extraCa}\`, \`NODE_USE_SYSTEM_CA=${useSystemCa}\``],
53+
['Node rejects test endpoint', `<strong>${tlsResult.status}</strong>`, tlsResult.detail],
5454
];
5555

5656
await core.summary
Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
.. SPDX-License-Identifier: Apache-2.0
33
4+
.. _contributor_guide:
5+
46
Contributing
57
============
68

7-
Thank you for your interest in contributing to ``cuda-bindings``! Based on the
8-
type of contribution, it will fall into two categories:
9-
10-
1. You want to report a bug, feature request, or documentation issue.
11-
12-
File an `issue <https://github.com/NVIDIA/cuda-python/issues/new/choose>`_
13-
describing what you encountered or what you want to see changed. The NVIDIA
14-
team will evaluate the issue, triage it, and schedule it for a release. If
15-
you believe the issue needs priority attention, comment on the issue to
16-
notify the team.
17-
18-
2. You want to implement a feature, improvement, or bug fix.
19-
20-
Before starting work on an existing issue, comment on the issue to express
21-
your interest and wait to be assigned by a maintainer. This helps avoid
22-
redundant effort.
23-
24-
Follow the repository `contribution guide
25-
<https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md>`_, including
26-
signing off each commit under the Developer Certificate of Origin (DCO) and
27-
cryptographically signing commits.
9+
Thank you for your interest in contributing to ``cuda-bindings``!
10+
Please follow the repository `contribution guide
11+
<https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md>`_ for
12+
coordination, validation, and commit signing.
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
.. SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
.. SPDX-License-Identifier: Apache-2.0
33
44
.. _contributor_guide:
55

66
Contributing
77
------------
88

9-
Thank you for your interest in contributing to ``cuda-core``! Based on the type of contribution, it will fall into two categories:
10-
11-
1. You want to report a bug, feature request, or documentation issue
12-
13-
- File an `issue <https://github.com/NVIDIA/cuda-python/issues/new/choose>`_
14-
describing what you encountered or what you want to see changed.
15-
- The NVIDIA team will evaluate the issues and triage them, scheduling
16-
them for a release. If you believe the issue needs priority attention
17-
comment on the issue to notify the team.
18-
19-
2. You want to implement a feature, improvement, or bug fix:
20-
21-
- Before starting work on an existing issue, please comment on the issue to express your interest and wait to be assigned by a maintainer. This helps avoid redundant effort in case the issue is already being worked on by another contributor or an NVIDIA team member.
22-
- Please ensure that your commits are signed `following GitHub's instruction <https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification>`_.
9+
Thank you for your interest in contributing to ``cuda-core``!
10+
Please follow the repository `contribution guide
11+
<https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md>`_ for
12+
coordination, validation, and commit signing.

‎cuda_core/tests/graph/test_graph_node_update.py‎

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pytest
1515
from helpers.graph_kernels import compile_common_kernels
1616

17-
from cuda.core import Device, DeviceMemoryResource, LaunchConfig, LegacyPinnedMemoryResource
17+
from cuda.core import Device, DeviceMemoryResource, EventOptions, LaunchConfig, LegacyPinnedMemoryResource
1818
from cuda.core._memory._synchronous_memory_resource import _SynchronousMemoryResource
1919
from cuda.core._utils._weak_handles import weak_handle
2020
from cuda.core._utils.cuda_utils import CUDAError, driver, handle_return
@@ -96,36 +96,27 @@ def _update_executable_case(graph, case):
9696

9797

9898
def _event_record_case(device):
99-
"""Keep the selected event pending to identify each exec's record target."""
100-
original = device.create_event()
101-
replacement = device.create_event()
102-
invalid_replacement = device.create_event()
99+
"""Identify each exec's record target after completion."""
100+
event_options = EventOptions(timing_enabled=True)
101+
original = device.create_event(options=event_options)
102+
replacement = device.create_event(options=event_options)
103+
invalid_replacement = device.create_event(options=event_options)
103104
invalid_replacement.close()
104105

105-
callback_started = threading.Event()
106-
callback_release = threading.Event()
107-
108-
def blocking_callback():
109-
callback_started.set()
110-
callback_release.wait(timeout=30)
111-
112106
graph_def = GraphDefinition()
113-
callback_node = graph_def.callback(blocking_callback)
114-
node = callback_node.record(original)
107+
node = graph_def.record(original)
115108

116109
def assert_exec_uses(graph, expected):
117-
callback_started.clear()
118-
callback_release.clear()
119110
stream = device.create_stream()
111+
reference = stream.record(options=event_options)
112+
stream.sync()
113+
114+
with pytest.raises(RuntimeError, match=r"^Both Events must be recorded"):
115+
expected - reference
116+
120117
graph.launch(stream)
121-
try:
122-
assert callback_started.wait(timeout=5)
123-
assert expected.is_done is False
124-
unexpected = replacement if expected is original else original
125-
assert unexpected.is_done is True
126-
finally:
127-
callback_release.set()
128-
stream.sync()
118+
stream.sync()
119+
assert isinstance(expected - reference, float)
129120

130121
return _DefinitionUpdateCase(
131122
graph_def=graph_def,

‎cuda_core/tests/test_driver_table.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,14 @@ def test_missing_table_entry_names_the_mismatch(tmp_path):
169169

170170

171171
_INTERRUPTED_CHILD = textwrap.dedent("""
172+
import signal
172173
import warnings
173174
import cuda.bindings._internal.nvrtc as loader
174175
176+
# Non-interactive background shells inherit SIGINT as SIG_IGN; restore the
177+
# default handler so a re-armed interrupt becomes KeyboardInterrupt.
178+
signal.signal(signal.SIGINT, signal.default_int_handler)
179+
175180
real_inspect = loader._inspect_function_pointers
176181
177182
def interrupting_inspect():

0 commit comments

Comments
 (0)