Skip to content

Commit 3a5c210

Browse files
committed
Merge branch 'main' into runtime-version-check
Integrate RAII handles architecture from main while preserving the version compatibility check feature. Resolved conflict in _device.pyx by keeping the refactored helper functions and updating field names to match RAII object structure.
2 parents fdb3a7e + 0f2949a commit 3a5c210

64 files changed

Lines changed: 3581 additions & 749 deletions

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ cuda/_version.py export-subst
66
# we do not own any headers checked in, don't touch them
77
*.h binary
88
*.hpp binary
9+
# Exception: headers we own (cuda_core C++ implementation)
10+
cuda_core/cuda/core/_cpp/*.h -binary text diff
11+
cuda_core/cuda/core/_cpp/*.hpp -binary text diff
912
# git should not convert line endings in PNG files
1013
*.png binary
1114
*.svg binary

‎.github/workflows/backport.yml‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,25 @@ on:
99
types: [closed, labeled]
1010
branches:
1111
- main
12+
workflow_dispatch:
13+
inputs:
14+
backport-branch:
15+
description: "Branch to backport commits onto"
16+
required: false
17+
type: string
18+
pull-request:
19+
description: "PR to backport"
20+
required: true
21+
type: number
22+
1223

1324
permissions:
1425
contents: write # so it can comment
1526
pull-requests: write # so it can create pull requests
1627

1728
jobs:
18-
backport:
19-
name: Backport pull request
29+
backport-from-pr:
30+
name: Backport directly from a pull request
2031
if: ${{ github.repository_owner == 'nvidia' &&
2132
github.event.pull_request.merged == true &&
2233
contains( github.event.pull_request.labels.*.name, 'to-be-backported')
@@ -38,3 +49,28 @@ jobs:
3849
copy_labels_pattern: true
3950
copy_requested_reviewers: true
4051
target_branches: ${{ env.OLD_BRANCH }}
52+
backport-to-branch:
53+
name: Backport a specific PR against a specific branch
54+
if: github.repository_owner == 'nvidia' && github.event_name == 'workflow_dispatch'
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
58+
59+
- name: Load branch from environment name
60+
if: inputs.backport-branch == null
61+
run: |
62+
BACKPORT_BRANCH=$(yq '.backport_branch' ci/versions.yml)
63+
echo "BACKPORT_BRANCH=${BRANCH}" >> $GITHUB_ENV
64+
65+
- name: Load branch name from input
66+
if: inputs.backport-branch != null
67+
run: echo "BACKPORT_BRANCH=${{ inputs.backport-branch }}" >> $GITHUB_ENV
68+
69+
- name: Create backport pull requests
70+
uses: korthout/backport-action@c656f5d5851037b2b38fb5db2691a03fa229e3b2 # v4.0.1
71+
with:
72+
copy_assignees: true
73+
copy_labels_pattern: true
74+
copy_requested_reviewers: true
75+
target_branches: ${{ env.BACKPORT_BRANCH }}
76+
source_pr_number: ${{ inputs.pull-request }}

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ __pycache__/
1111
.pytest_cache/
1212
.benchmarks/
1313
*.cpp
14+
!*_impl.cpp
1415
!cuda_bindings/cuda/bindings/_lib/param_packer.cpp
1516
!cuda_bindings/cuda/bindings/_bindings/loader.cpp
1617
cache_driver

‎ci/tools/merge_cuda_core_wheels.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,21 @@ def merge_wheels(wheels: List[Path], output_dir: Path, show_wheel_contents: bool
150150
"__init__.py",
151151
"_version.py",
152152
"_include",
153+
"_cpp", # Headers for Cython development
153154
"cu12",
154155
"cu13",
155156
)
157+
# _resource_handles is shared (not CUDA-version-specific) and must stay
158+
# at top level. It's imported early in __init__.py before versioned code.
159+
items_to_keep_prefix = ("_resource_handles",)
156160
all_items = os.scandir(base_wheel / base_dir)
157161
removed_count = 0
158162
for f in all_items:
159163
f_abspath = f.path
160164
if f.name in items_to_keep:
161165
continue
166+
if any(f.name.startswith(prefix) for prefix in items_to_keep_prefix):
167+
continue
162168
if f.is_dir():
163169
print(f" Removing directory: {f.name}", file=sys.stderr)
164170
shutil.rmtree(f_abspath)

‎cuda_bindings/cuda/bindings/_lib/utils.pxd.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ cdef class _HelperCUpointer_attribute:
5050
# Return values
5151
cdef driver.CUcontext _ctx
5252
cdef unsigned int _uint
53+
cdef int _int
5354
cdef driver.CUdeviceptr _devptr
5455
cdef void** _void
5556
cdef driver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS _token

‎cuda_bindings/cuda/bindings/_lib/utils.pxi.in‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,14 @@ cdef class _HelperCUpointer_attribute:
247247
else:
248248
self._cptr = <void*><void_ptr>init_value.getPtr()
249249
elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_MEMORY_TYPE'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_MEMORY_TYPE,{{endif}}
250-
{{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,{{endif}}
251250
{{if 'CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ALLOWED_HANDLE_TYPES,{{endif}}
252251
{{if 'CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_IS_GPU_DIRECT_RDMA_CAPABLE,{{endif}}
253252
{{if 'CU_POINTER_ATTRIBUTE_ACCESS_FLAGS'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_ACCESS_FLAGS,{{endif}}):
254253
self._uint = init_value
255254
self._cptr = <void*>&self._uint
255+
elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL,{{endif}}):
256+
self._int = init_value
257+
self._cptr = <void*>&self._int
256258
elif self._attr in ({{if 'CU_POINTER_ATTRIBUTE_DEVICE_POINTER'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_DEVICE_POINTER,{{endif}}
257259
{{if 'CU_POINTER_ATTRIBUTE_RANGE_START_ADDR'}}cydriver.CUpointer_attribute_enum.CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,{{endif}}):
258260
if self._is_getter:

0 commit comments

Comments
 (0)