Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --show-fixes, --target-version=py39]
exclude: ^cuda_bindings/cuda/bindings/_internal/_fast_enum\.py$
- id: ruff-format

- repo: local
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_bindings/cydriver.pxd.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
from cuda.bindings.cydriver cimport *

{{if 'cuGetErrorString' in found_functions}}
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_bindings/cydriver.pyx.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
{{if 'Windows' == platform.system()}}
import os
cimport cuda.bindings._lib.windll as windll
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
from cuda.bindings.cynvrtc cimport *

{{if 'nvrtcGetErrorString' in found_functions}}
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
{{if 'Windows' == platform.system()}}
import os
cimport cuda.bindings._lib.windll as windll
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
include "../cyruntime_types.pxi"

include "../_lib/cyruntime/cyruntime.pxd"
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
include "../cyruntime_functions.pxi"

import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
cdef extern from "":
"""
#define CUDA_API_PER_THREAD_DEFAULT_STREAM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

# This code was automatically generated with version 12.9.0, generator version 0d24f4f. Do not modify it directly.
# This code was automatically generated with version 12.9.0, generator version 49a8141. Do not modify it directly.
cdef extern from "":
"""
#define CUDA_API_PER_THREAD_DEFAULT_STREAM
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/_fast_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE


# This code was automatically generated across versions from 12.9.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.9.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.


"""
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/cufile.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated with version 12.9.1. Do not modify it directly.
# This code was automatically generated with version 12.9.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from ..cycufile cimport *

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated with version 12.9.1. Do not modify it directly.
# This code was automatically generated with version 12.9.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t, uintptr_t
import threading
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvfatbin.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.4.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.4.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from ..cynvfatbin cimport *

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.4.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.4.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t, uintptr_t

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvfatbin_windows.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.4.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.4.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvjitlink.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.0.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.0.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from ..cynvjitlink cimport *

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvjitlink_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.0.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.0.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t, uintptr_t

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.0.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.0.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvvm.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.0.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.0.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from ..cynvvm cimport *

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvvm_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.0.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.0.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t, uintptr_t

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated across versions from 12.0.1 to 13.1.1. Do not modify it directly.
# This code was automatically generated across versions from 12.0.1 to 13.1.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t

Expand Down
14 changes: 12 additions & 2 deletions cuda_bindings/cuda/bindings/_lib/utils.pxd.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cimport cuda.bindings.driver as driver
cimport cuda.bindings.cydriver as cydriver
cimport cuda.bindings.cyruntime as cyruntime
from libcpp.vector cimport vector
from cpython.buffer cimport PyBuffer_Release, Py_buffer

cdef class _HelperKernelParams:
cdef Py_buffer _pybuffer
Expand All @@ -14,10 +15,19 @@ cdef class _HelperKernelParams:
cdef int _length
cdef bint _malloc_list_created

cdef struct _HelperInputVoidPtrStruct:
Py_buffer _pybuffer

cdef class _HelperInputVoidPtr:
cdef Py_buffer _pybuffer
cdef _HelperInputVoidPtrStruct _helper
cdef void* _cptr
cdef bint _pyobj_acquired

cdef void * _helper_input_void_ptr(ptr, _HelperInputVoidPtrStruct *buffer)

cdef inline void * _helper_input_void_ptr_free(_HelperInputVoidPtrStruct *helper):
if helper[0]._pybuffer.buf != NULL:
PyBuffer_Release(&helper[0]._pybuffer)

{{if 'CUmemPool_attribute_enum' in found_types}}

cdef class _HelperCUmemPool_attribute:
Expand Down
35 changes: 18 additions & 17 deletions cuda_bindings/cuda/bindings/_lib/utils.pxi.in
Original file line number Diff line number Diff line change
Expand Up @@ -129,31 +129,32 @@ cdef class _HelperKernelParams:

cdef class _HelperInputVoidPtr:
def __cinit__(self, ptr):
self._pyobj_acquired = False
self._cptr = _helper_input_void_ptr(ptr, &self._helper)

def __dealloc__(self):
_helper_input_void_ptr_free(&self._helper)

@property
def cptr(self):
return <void_ptr>self._cptr


cdef void * _helper_input_void_ptr(ptr, _HelperInputVoidPtrStruct *helper):
helper[0]._pybuffer.buf = NULL
try:
return <void *><void_ptr>ptr
except:
if ptr is None:
self._cptr = NULL
elif isinstance(ptr, (int)):
# Easy run, user gave us an already configured void** address
self._cptr = <void*><void_ptr>ptr
elif isinstance(ptr, (_driver.CUdeviceptr)):
self._cptr = <void*><void_ptr>int(ptr)
return NULL
elif PyObject_CheckBuffer(ptr):
# Easy run, get address from Python Buffer Protocol
err_buffer = PyObject_GetBuffer(ptr, &self._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS)
err_buffer = PyObject_GetBuffer(ptr, &helper[0]._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS)
if err_buffer == -1:
raise RuntimeError("Failed to retrieve buffer through Buffer Protocol")
self._pyobj_acquired = True
self._cptr = <void*><void_ptr>self._pybuffer.buf
return <void*><void_ptr>(helper[0]._pybuffer.buf)
else:
raise TypeError("Provided argument is of type {} but expected Type {}, {} or object with Buffer Protocol".format(type(ptr), type(None), type(int)))

def __dealloc__(self):
if self._pyobj_acquired is True:
PyBuffer_Release(&self._pybuffer)

@property
def cptr(self):
return <void_ptr>self._cptr

{{if 'CUmemPool_attribute_enum' in found_types}}

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/cuda/bindings/cufile.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
#
# This code was automatically generated with version 12.9.1. Do not modify it directly.
# This code was automatically generated with version 12.9.1, generator version 0.3.1.dev1324+gb402107a2. Do not modify it directly.

from libc.stdint cimport intptr_t

Expand Down
Loading
Loading