Skip to content

Commit a3ec89a

Browse files
committed
Merge branch 'main' into agent/cuda-bindings-12-on-main
2 parents 4ce0da6 + fb57dbf commit a3ec89a

5 files changed

Lines changed: 63 additions & 99 deletions

File tree

cuda_bindings/cuda/bindings/nvrtc.pxd

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# This code was automatically generated with version 13.3.0. Do not modify it directly.
5-
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=06a058e3c626563f034714cce129fd58b33dd80c0e4a954723e92d0ae61c7c58
5+
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ee485e830fdb8037d58a70b73a413f3ce362819576fd86e91d55ce14ba3f9149
66
cimport cuda.bindings.cynvrtc as cynvrtc
77

88
include "_lib/utils.pxd"
@@ -21,69 +21,35 @@ cdef class nvrtcProgram:
2121
cdef cynvrtc.nvrtcProgram _pvt_val
2222
cdef cynvrtc.nvrtcProgram* _pvt_ptr
2323

24-
cdef class anon_struct0:
24+
cdef class nvrtcBundledHeadersInfo:
2525
"""
26-
Attributes
27-
----------
28-
29-
available : int
30-
31-
32-
33-
compressedSize : size_t
34-
35-
36-
37-
uncompressedSize : size_t
38-
39-
40-
41-
cudaVersionMajor : int
42-
43-
44-
45-
cudaVersionMinor : int
46-
26+
Structure containing information about bundled headers.
4727
48-
49-
numFiles : unsigned int
50-
51-
52-
53-
Methods
54-
-------
55-
getPtr()
56-
Get memory address of class instance
57-
"""
58-
cdef cynvrtc.nvrtcBundledHeadersInfo* _pvt_ptr
59-
60-
cdef class nvrtcBundledHeadersInfo(anon_struct0):
61-
"""
6228
Attributes
6329
----------
6430
6531
available : int
66-
32+
Non-zero if bundled headers are available
6733
6834
6935
compressedSize : size_t
70-
36+
Size of compressed archive in bytes
7137
7238
7339
uncompressedSize : size_t
74-
40+
Estimated size when extracted in bytes
7541
7642
7743
cudaVersionMajor : int
78-
44+
CUDA major version of bundled headers
7945
8046
8147
cudaVersionMinor : int
82-
48+
CUDA minor version of bundled headers
8349
8450
8551
numFiles : unsigned int
86-
52+
Number of header files in the bundle
8753
8854
8955
Methods
@@ -92,3 +58,4 @@ cdef class nvrtcBundledHeadersInfo(anon_struct0):
9258
Get memory address of class instance
9359
"""
9460
cdef cynvrtc.nvrtcBundledHeadersInfo _pvt_val
61+
cdef cynvrtc.nvrtcBundledHeadersInfo* _pvt_ptr

cuda_bindings/cuda/bindings/nvrtc.pyx

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# This code was automatically generated with version 13.3.0. Do not modify it directly.
5-
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=5d36f91a9f04660caaf0a8a7afa443d43899bc6eb70e61a26415485d9a39475a
5+
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=9c30b7a3d79561c6721e7df7b758eaee6afdd2763d9692ff638815abb64417e0
66
from typing import Any, Optional
77
import cython
88
import ctypes
@@ -141,44 +141,48 @@ cdef class nvrtcProgram:
141141
def getPtr(self):
142142
return <void_ptr>self._pvt_ptr
143143

144-
cdef class anon_struct0:
144+
cdef class nvrtcBundledHeadersInfo:
145145
"""
146+
Structure containing information about bundled headers.
147+
146148
Attributes
147149
----------
148150
149151
available : int
150-
152+
Non-zero if bundled headers are available
151153
152154
153155
compressedSize : size_t
154-
156+
Size of compressed archive in bytes
155157
156158
157159
uncompressedSize : size_t
158-
160+
Estimated size when extracted in bytes
159161
160162
161163
cudaVersionMajor : int
162-
164+
CUDA major version of bundled headers
163165
164166
165167
cudaVersionMinor : int
166-
168+
CUDA minor version of bundled headers
167169
168170
169171
numFiles : unsigned int
170-
172+
Number of header files in the bundle
171173
172174
173175
Methods
174176
-------
175177
getPtr()
176178
Get memory address of class instance
177179
"""
178-
def __cinit__(self, void_ptr _ptr):
179-
self._pvt_ptr = <cynvrtc.nvrtcBundledHeadersInfo *>_ptr
180-
181-
def __init__(self, void_ptr _ptr):
180+
def __cinit__(self, void_ptr _ptr = 0):
181+
if _ptr == 0:
182+
self._pvt_ptr = &self._pvt_val
183+
else:
184+
self._pvt_ptr = <cynvrtc.nvrtcBundledHeadersInfo *>_ptr
185+
def __init__(self, void_ptr _ptr = 0):
182186
pass
183187
def __dealloc__(self):
184188
pass
@@ -275,49 +279,6 @@ cdef class anon_struct0:
275279
self._pvt_ptr[0].numFiles = numFiles
276280

277281

278-
cdef class nvrtcBundledHeadersInfo(anon_struct0):
279-
"""
280-
Attributes
281-
----------
282-
283-
available : int
284-
285-
286-
287-
compressedSize : size_t
288-
289-
290-
291-
uncompressedSize : size_t
292-
293-
294-
295-
cudaVersionMajor : int
296-
297-
298-
299-
cudaVersionMinor : int
300-
301-
302-
303-
numFiles : unsigned int
304-
305-
306-
307-
Methods
308-
-------
309-
getPtr()
310-
Get memory address of class instance
311-
"""
312-
def __cinit__(self, void_ptr _ptr = 0):
313-
if _ptr == 0:
314-
self._pvt_ptr = <cynvrtc.nvrtcBundledHeadersInfo *>&self._pvt_val
315-
else:
316-
self._pvt_ptr = <cynvrtc.nvrtcBundledHeadersInfo *>_ptr
317-
318-
def __init__(self, void_ptr _ptr = 0):
319-
pass
320-
321282
@cython.embedsignature(True)
322283
def nvrtcGetErrorString(result not None : nvrtcResult):
323284
""" nvrtcGetErrorString is a helper function that returns a string describing the given :py:obj:`~.nvrtcResult` code, e.g., NVRTC_SUCCESS to `"NVRTC_SUCCESS"`. For unrecognized enumeration values, it returns `"NVRTC_ERROR unknown"`.

cuda_bindings/docs/source/module/nvrtc.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
.. This code was automatically generated with version 13.3.0. Do not modify it directly.
55
6-
.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c324889e2f86a6302cc610b49d290d545483f3fc0fa05d62ee47eb8aed781ae1
6+
.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c0aad81d1be715fcef6b97fc6fa560c100a9c66fd9a67306e78653884618047c
77
-----
88
nvrtc
99
-----
@@ -122,6 +122,7 @@ Bundled Headers Installation
122122

123123
NVRTC defines the following types and functions for bundled headers installation and management.
124124

125+
.. autoclass:: cuda.bindings.nvrtc.nvrtcBundledHeadersInfo
125126
.. autoclass:: cuda.bindings.nvrtc.nvrtcBundledHeadersInfo
126127
.. autofunction:: cuda.bindings.nvrtc.nvrtcInstallBundledHeaders
127128
.. autofunction:: cuda.bindings.nvrtc.nvrtcGetBundledHeadersInfo

cuda_bindings/tests/legacy_api/test_legacy_nvrtc.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,21 @@ def test_nvrtcGetLoweredName_failure():
3535
err, name = nvrtc.nvrtcGetLoweredName(0, b"I'm another elevated name!")
3636
assert err == nvrtc.nvrtcResult.NVRTC_ERROR_INVALID_PROGRAM
3737
assert name is None
38+
39+
40+
@pytest.mark.agent_authored(model="claude-sonnet-5")
41+
@pytest.mark.skipif(nvrtcVersionLessThan(13, 3), reason="When nvrtcGetBundledHeadersInfo was introduced")
42+
def test_nvrtcGetBundledHeadersInfo():
43+
info = nvrtc.nvrtcBundledHeadersInfo()
44+
assert isinstance(info, nvrtc.nvrtcBundledHeadersInfo)
45+
46+
err, info, errorLog = nvrtc.nvrtcGetBundledHeadersInfo()
47+
ASSERT_DRV(err)
48+
assert isinstance(info, nvrtc.nvrtcBundledHeadersInfo)
49+
assert info.available in (0, 1)
50+
assert info.compressedSize >= 0
51+
assert info.uncompressedSize >= 0
52+
assert info.cudaVersionMajor >= 0
53+
assert info.cudaVersionMinor >= 0
54+
assert info.numFiles >= 0
55+
assert errorLog is None

cuda_bindings/tests/test_nvrtc.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,20 @@ def test_get_lowered_name_failure():
2323
nvrtc.get_lowered_name(0, b"I'm an elevated name!")
2424
with pytest.raises(nvrtc.InvalidProgramError):
2525
nvrtc.get_lowered_name(0, b"I'm another elevated name!")
26+
27+
28+
@pytest.mark.agent_authored(model="claude-sonnet-5")
29+
@pytest.mark.skipif(nvrtc_version_less_than(13, 3), reason="When nvrtcGetBundledHeadersInfo was introduced")
30+
def test_get_bundled_headers_info():
31+
info = nvrtc.BundledHeadersInfo()
32+
assert isinstance(info, nvrtc.BundledHeadersInfo)
33+
34+
info, error_log = nvrtc.get_bundled_headers_info()
35+
assert isinstance(info, nvrtc.BundledHeadersInfo)
36+
assert info.available in (0, 1)
37+
assert info.compressed_size >= 0
38+
assert info.uncompressed_size >= 0
39+
assert info.cuda_version_major >= 0
40+
assert info.cuda_version_minor >= 0
41+
assert info.num_files >= 0
42+
assert error_log is None

0 commit comments

Comments
 (0)