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 cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# This code was automatically generated with version 12.9.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=497222751557bdc4a8756fe4782b96e2baa2e59daf890a40b166d80f97a74bf8
include "../cyruntime_types.pxi"

include "../_lib/cyruntime/cyruntime.pxd"
Expand Down
1 change: 1 addition & 0 deletions cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# This code was automatically generated with version 12.9.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=3eb7a8ac79c0415fa1dfeb13d6f9f72ff7ff9b867f08b683c267219576c8df15
include "../cyruntime_functions.pxi"

import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# This code was automatically generated with version 12.9.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=58ec8deb9f130e6305b7842d14d609fd871cd1d3f7bf0f0ff714957cd77772b5
cdef extern from "":
"""
#define CUDA_API_PER_THREAD_DEFAULT_STREAM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# This code was automatically generated with version 12.9.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=9ef99cae70f08efa9f2a007ad5234e8632e797d6fd4109ca8e61034c69bd9658
cdef extern from "":
"""
#define CUDA_API_PER_THREAD_DEFAULT_STREAM
Expand Down
3 changes: 1 addition & 2 deletions cuda_bindings/cuda/bindings/_internal/_fast_enum.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# This code was automatically generated across versions from 12.0.1 to 13.3.0. Do not modify it directly.


# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=581469c1fadb5f72c43b478d73f2b905562136c8723a25e2f4240b5b681e2894
"""
This is a replacement for the stdlib enum.IntEnum.
Expand Down
3 changes: 2 additions & 1 deletion cuda_bindings/cuda/bindings/_internal/cufile.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# This code was automatically generated with version 12.9.1, generator version 0.3.1.dev1364+ged01d643e. Do not modify it directly.
# This code was automatically generated with version 12.9.1. Do not modify it directly.

# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=1f7235000769edab9a1a3e7caf7036a967426f6f03a9839beb13d674e2b7a194
from ..cycufile cimport *


Expand Down
299 changes: 131 additions & 168 deletions cuda_bindings/cuda/bindings/_internal/cufile_linux.pyx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cuda_bindings/cuda/bindings/_internal/driver.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# This code was automatically generated with version 12.9.0. Do not modify it directly.

# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=395f93ae98b3b074267a9275aa19aff34b001e2b982b686301aace8270e40ea1
from ..cydriver cimport *


Expand Down
2,057 changes: 1,007 additions & 1,050 deletions cuda_bindings/cuda/bindings/_internal/driver_linux.pyx

Large diffs are not rendered by default.

2,076 changes: 1,009 additions & 1,067 deletions cuda_bindings/cuda/bindings/_internal/driver_windows.pyx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cuda_bindings/cuda/bindings/_internal/nvfatbin.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly.

# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b52d99b7f07615d6c5ecb869a5c632e6e9cb4d0cb4f6cb1e43977d29ecd9995c
from ..cynvfatbin cimport *


Expand Down
176 changes: 70 additions & 106 deletions cuda_bindings/cuda/bindings/_internal/nvfatbin_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,35 @@
# SPDX-License-Identifier: Apache-2.0
#
# This code was automatically generated across versions from 12.4.1 to 13.3.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=8a025fac12ad4fa9dc651c68c1ab7948f78cbb4b9450935db8f930c9d44988f4

from libc.stdint cimport intptr_t, uintptr_t

import threading
from .utils import FunctionNotFoundError, NotSupportedError

from cuda.pathfinder import load_nvidia_dynamic_lib


###############################################################################
# Extern
###############################################################################

# You must 'from .utils import NotSupportedError' before using this template
# <<<< PREAMBLE CONTENT >>>>

cdef extern from "<dlfcn.h>" nogil:
void* dlopen(const char*, int)
char* dlerror()
void* dlsym(void*, const char*)
int dlclose(void*)
cdef extern from "<dlfcn.h>":
void* _cyb_dlsym "dlsym"(void*, const char*) nogil
const void * _cyb_RTLD_DEFAULT "RTLD_DEFAULT"

enum:
RTLD_LAZY
RTLD_NOW
RTLD_GLOBAL
RTLD_LOCAL
from libc.stdint cimport intptr_t as _cyb_intptr_t

const void* RTLD_DEFAULT 'RTLD_DEFAULT'
import threading as _cyb_threading

cdef int get_cuda_version():
cdef void* handle = NULL
cdef int err, driver_ver = 0
cdef bint _cyb___py_nvfatbin_init = False
cdef dict _cyb_func_ptrs = None
cdef object _cyb_symbol_lock = _cyb_threading.Lock()

# Load driver to check version
handle = dlopen('libcuda.so.1', RTLD_NOW | RTLD_GLOBAL)
if handle == NULL:
err_msg = dlerror()
raise NotSupportedError(f'CUDA driver is not found ({err_msg.decode()})')
cuDriverGetVersion = dlsym(handle, "cuDriverGetVersion")
if cuDriverGetVersion == NULL:
raise RuntimeError('Did not find cuDriverGetVersion symbol in libcuda.so.1')
err = (<int (*)(int*) noexcept nogil>cuDriverGetVersion)(&driver_ver)
if err != 0:
raise RuntimeError(f'cuDriverGetVersion returned error code {err}')
# <<<< END OF PREAMBLE CONTENT >>>>

return driver_ver
from libc.stdint cimport uintptr_t

from .utils import FunctionNotFoundError, NotSupportedError
from cuda.pathfinder import load_nvidia_dynamic_lib


###############################################################################
# Wrapper init
###############################################################################

cdef object __symbol_lock = threading.Lock()
cdef bint __py_nvfatbin_init = False

cdef void* __nvFatbinGetErrorString = NULL
cdef void* __nvFatbinCreate = NULL
cdef void* __nvFatbinDestroy = NULL
Expand All @@ -72,173 +45,164 @@ cdef void* __nvFatbinAddIndex = NULL
cdef void* __nvFatbinAddReloc = NULL
cdef void* __nvFatbinAddTileIR = NULL


cdef void* load_library() except* with gil:
cdef uintptr_t handle = load_nvidia_dynamic_lib("nvfatbin")._handle_uint
return <void*>handle


cdef int _init_nvfatbin() except -1 nogil:
global __py_nvfatbin_init

global _cyb___py_nvfatbin_init
cdef void* handle = NULL
with gil, _cyb_symbol_lock:
if _cyb___py_nvfatbin_init: return 0

with gil, __symbol_lock:
# Recheck the flag after obtaining the locks
if __py_nvfatbin_init:
return 0

# Load function
global __nvFatbinGetErrorString
__nvFatbinGetErrorString = dlsym(RTLD_DEFAULT, 'nvFatbinGetErrorString')
__nvFatbinGetErrorString = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinGetErrorString')
if __nvFatbinGetErrorString == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinGetErrorString = dlsym(handle, 'nvFatbinGetErrorString')
__nvFatbinGetErrorString = _cyb_dlsym(handle, 'nvFatbinGetErrorString')

global __nvFatbinCreate
__nvFatbinCreate = dlsym(RTLD_DEFAULT, 'nvFatbinCreate')
__nvFatbinCreate = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinCreate')
if __nvFatbinCreate == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinCreate = dlsym(handle, 'nvFatbinCreate')
__nvFatbinCreate = _cyb_dlsym(handle, 'nvFatbinCreate')

global __nvFatbinDestroy
__nvFatbinDestroy = dlsym(RTLD_DEFAULT, 'nvFatbinDestroy')
__nvFatbinDestroy = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinDestroy')
if __nvFatbinDestroy == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinDestroy = dlsym(handle, 'nvFatbinDestroy')
__nvFatbinDestroy = _cyb_dlsym(handle, 'nvFatbinDestroy')

global __nvFatbinAddPTX
__nvFatbinAddPTX = dlsym(RTLD_DEFAULT, 'nvFatbinAddPTX')
__nvFatbinAddPTX = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddPTX')
if __nvFatbinAddPTX == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinAddPTX = dlsym(handle, 'nvFatbinAddPTX')
__nvFatbinAddPTX = _cyb_dlsym(handle, 'nvFatbinAddPTX')

global __nvFatbinAddCubin
__nvFatbinAddCubin = dlsym(RTLD_DEFAULT, 'nvFatbinAddCubin')
__nvFatbinAddCubin = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddCubin')
if __nvFatbinAddCubin == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinAddCubin = dlsym(handle, 'nvFatbinAddCubin')
__nvFatbinAddCubin = _cyb_dlsym(handle, 'nvFatbinAddCubin')

global __nvFatbinAddLTOIR
__nvFatbinAddLTOIR = dlsym(RTLD_DEFAULT, 'nvFatbinAddLTOIR')
__nvFatbinAddLTOIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddLTOIR')
if __nvFatbinAddLTOIR == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinAddLTOIR = dlsym(handle, 'nvFatbinAddLTOIR')
__nvFatbinAddLTOIR = _cyb_dlsym(handle, 'nvFatbinAddLTOIR')

global __nvFatbinSize
__nvFatbinSize = dlsym(RTLD_DEFAULT, 'nvFatbinSize')
__nvFatbinSize = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinSize')
if __nvFatbinSize == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinSize = dlsym(handle, 'nvFatbinSize')
__nvFatbinSize = _cyb_dlsym(handle, 'nvFatbinSize')

global __nvFatbinGet
__nvFatbinGet = dlsym(RTLD_DEFAULT, 'nvFatbinGet')
__nvFatbinGet = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinGet')
if __nvFatbinGet == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinGet = dlsym(handle, 'nvFatbinGet')
__nvFatbinGet = _cyb_dlsym(handle, 'nvFatbinGet')

global __nvFatbinVersion
__nvFatbinVersion = dlsym(RTLD_DEFAULT, 'nvFatbinVersion')
__nvFatbinVersion = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinVersion')
if __nvFatbinVersion == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinVersion = dlsym(handle, 'nvFatbinVersion')
__nvFatbinVersion = _cyb_dlsym(handle, 'nvFatbinVersion')

global __nvFatbinAddIndex
__nvFatbinAddIndex = dlsym(RTLD_DEFAULT, 'nvFatbinAddIndex')
__nvFatbinAddIndex = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddIndex')
if __nvFatbinAddIndex == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinAddIndex = dlsym(handle, 'nvFatbinAddIndex')
__nvFatbinAddIndex = _cyb_dlsym(handle, 'nvFatbinAddIndex')

global __nvFatbinAddReloc
__nvFatbinAddReloc = dlsym(RTLD_DEFAULT, 'nvFatbinAddReloc')
__nvFatbinAddReloc = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddReloc')
if __nvFatbinAddReloc == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinAddReloc = dlsym(handle, 'nvFatbinAddReloc')
__nvFatbinAddReloc = _cyb_dlsym(handle, 'nvFatbinAddReloc')

global __nvFatbinAddTileIR
__nvFatbinAddTileIR = dlsym(RTLD_DEFAULT, 'nvFatbinAddTileIR')
__nvFatbinAddTileIR = _cyb_dlsym(_cyb_RTLD_DEFAULT, 'nvFatbinAddTileIR')
if __nvFatbinAddTileIR == NULL:
if handle == NULL:
handle = load_library()
__nvFatbinAddTileIR = dlsym(handle, 'nvFatbinAddTileIR')
__nvFatbinAddTileIR = _cyb_dlsym(handle, 'nvFatbinAddTileIR')

__py_nvfatbin_init = True
_cyb___py_nvfatbin_init = True
return 0


cdef inline int _check_or_init_nvfatbin() except -1 nogil:
if __py_nvfatbin_init:
if _cyb___py_nvfatbin_init:
return 0

return _init_nvfatbin()

cdef dict func_ptrs = None


cpdef dict _inspect_function_pointers():
global func_ptrs
if func_ptrs is not None:
return func_ptrs
global _cyb_func_ptrs
if _cyb_func_ptrs is not None:
return _cyb_func_ptrs

_check_or_init_nvfatbin()
cdef dict data = {}

global __nvFatbinGetErrorString
data["__nvFatbinGetErrorString"] = <intptr_t>__nvFatbinGetErrorString
data["__nvFatbinGetErrorString"] = <_cyb_intptr_t>__nvFatbinGetErrorString

global __nvFatbinCreate
data["__nvFatbinCreate"] = <intptr_t>__nvFatbinCreate
data["__nvFatbinCreate"] = <_cyb_intptr_t>__nvFatbinCreate

global __nvFatbinDestroy
data["__nvFatbinDestroy"] = <intptr_t>__nvFatbinDestroy
data["__nvFatbinDestroy"] = <_cyb_intptr_t>__nvFatbinDestroy

global __nvFatbinAddPTX
data["__nvFatbinAddPTX"] = <intptr_t>__nvFatbinAddPTX
data["__nvFatbinAddPTX"] = <_cyb_intptr_t>__nvFatbinAddPTX

global __nvFatbinAddCubin
data["__nvFatbinAddCubin"] = <intptr_t>__nvFatbinAddCubin
data["__nvFatbinAddCubin"] = <_cyb_intptr_t>__nvFatbinAddCubin

global __nvFatbinAddLTOIR
data["__nvFatbinAddLTOIR"] = <intptr_t>__nvFatbinAddLTOIR
data["__nvFatbinAddLTOIR"] = <_cyb_intptr_t>__nvFatbinAddLTOIR

global __nvFatbinSize
data["__nvFatbinSize"] = <intptr_t>__nvFatbinSize
data["__nvFatbinSize"] = <_cyb_intptr_t>__nvFatbinSize

global __nvFatbinGet
data["__nvFatbinGet"] = <intptr_t>__nvFatbinGet
data["__nvFatbinGet"] = <_cyb_intptr_t>__nvFatbinGet

global __nvFatbinVersion
data["__nvFatbinVersion"] = <intptr_t>__nvFatbinVersion
data["__nvFatbinVersion"] = <_cyb_intptr_t>__nvFatbinVersion

global __nvFatbinAddIndex
data["__nvFatbinAddIndex"] = <intptr_t>__nvFatbinAddIndex
data["__nvFatbinAddIndex"] = <_cyb_intptr_t>__nvFatbinAddIndex

global __nvFatbinAddReloc
data["__nvFatbinAddReloc"] = <intptr_t>__nvFatbinAddReloc
data["__nvFatbinAddReloc"] = <_cyb_intptr_t>__nvFatbinAddReloc

global __nvFatbinAddTileIR
data["__nvFatbinAddTileIR"] = <intptr_t>__nvFatbinAddTileIR

func_ptrs = data
data["__nvFatbinAddTileIR"] = <_cyb_intptr_t>__nvFatbinAddTileIR
_cyb_func_ptrs = data
return data


cpdef _inspect_function_pointer(str name):
global func_ptrs
if func_ptrs is None:
func_ptrs = _inspect_function_pointers()
return func_ptrs[name]
global _cyb_func_ptrs
if _cyb_func_ptrs is None:
_cyb_func_ptrs = _inspect_function_pointers()
return _cyb_func_ptrs[name]




cdef void* load_library() except* with gil:
cdef uintptr_t handle = load_nvidia_dynamic_lib("nvfatbin")._handle_uint
return <void*>handle


###############################################################################
Expand Down
Loading
Loading