@@ -36,6 +36,7 @@ cdef extern from "<dlfcn.h>" nogil:
36
36
cdef bint __py_nvvm_init = False
37
37
cdef void * __cuDriverGetVersion = NULL
38
38
39
+ cdef void * __nvvmGetErrorString = NULL
39
40
cdef void * __nvvmVersion = NULL
40
41
cdef void * __nvvmIRVersion = NULL
41
42
cdef void * __nvvmCreateProgram = NULL
@@ -82,6 +83,13 @@ cdef int _check_or_init_nvvm() except -1 nogil:
82
83
handle = NULL
83
84
84
85
# Load function
86
+ global __nvvmGetErrorString
87
+ __nvvmGetErrorString = dlsym(RTLD_DEFAULT, ' nvvmGetErrorString' )
88
+ if __nvvmGetErrorString == NULL :
89
+ if handle == NULL :
90
+ handle = load_library(driver_ver)
91
+ __nvvmGetErrorString = dlsym(handle, ' nvvmGetErrorString' )
92
+
85
93
global __nvvmVersion
86
94
__nvvmVersion = dlsym(RTLD_DEFAULT, ' nvvmVersion' )
87
95
if __nvvmVersion == NULL :
@@ -181,6 +189,9 @@ cpdef dict _inspect_function_pointers():
181
189
_check_or_init_nvvm()
182
190
cdef dict data = {}
183
191
192
+ global __nvvmGetErrorString
193
+ data[" __nvvmGetErrorString" ] = < intptr_t> __nvvmGetErrorString
194
+
184
195
global __nvvmVersion
185
196
data[" __nvvmVersion" ] = < intptr_t> __nvvmVersion
186
197
@@ -232,6 +243,16 @@ cpdef _inspect_function_pointer(str name):
232
243
# Wrapper functions
233
244
# ##############################################################################
234
245
246
+ cdef const char * _nvvmGetErrorString(nvvmResult result) except ?NULL nogil:
247
+ global __nvvmGetErrorString
248
+ _check_or_init_nvvm()
249
+ if __nvvmGetErrorString == NULL :
250
+ with gil:
251
+ raise FunctionNotFoundError(" function nvvmGetErrorString is not found" )
252
+ return (< const char * (* )(nvvmResult) noexcept nogil> __nvvmGetErrorString)(
253
+ result)
254
+
255
+
235
256
cdef nvvmResult _nvvmVersion(int * major, int * minor) except ?_NVVMRESULT_INTERNAL_LOADING_ERROR nogil:
236
257
global __nvvmVersion
237
258
_check_or_init_nvvm()
0 commit comments