Skip to content
Draft
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
102 changes: 65 additions & 37 deletions cuda_bindings/cuda/bindings/_v2/nvrtc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
#
# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a36c7e54cf29166832dd9aebc1fa71cc3649498794a2846e707396419caebe10
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=81a8413522bab04b3eb89373f90a9879758fdeeeb8141425dc27c4504df84b78


# <<<< PREAMBLE CONTENT >>>>
Expand Down Expand Up @@ -657,6 +657,8 @@ cpdef tuple version():
cpdef int get_num_supported_archs() except? -1:
"""nvrtcGetNumSupportedArchs sets the output parameter ``num_archs`` with the number of architectures supported by NVRTC. This can then be used to pass an array to ``nvrtcGetSupportedArchs`` to get the supported architectures.

see ``nvrtcGetSupportedArchs``.

Returns:
int: number of supported architectures.

Expand All @@ -672,6 +674,8 @@ cpdef int get_num_supported_archs() except? -1:
cpdef object get_supported_archs():
"""nvrtcGetSupportedArchs populates the array passed via the output parameter ``supported_archs`` with the architectures supported by NVRTC. The array is sorted in the ascending order. The size of the array to be passed can be determined using ``nvrtcGetNumSupportedArchs``.

see ``nvrtcGetNumSupportedArchs``.

Returns:
int: sorted array of supported architectures.

Expand All @@ -681,13 +685,19 @@ cpdef object get_supported_archs():
with nogil:
__status__ = nvrtcGetNumSupportedArchs(&numArchs)
check_status(__status__)
cdef _cyb_view.array supported_archs_alloc
cdef int *supported_archs_ptr
if numArchs == 0:
return _cyb_view.array(shape=(1,), itemsize=sizeof(int), format="i", mode="c")[:0]
cdef _cyb_view.array supported_archs = _cyb_view.array(shape=(numArchs,), itemsize=sizeof(int), format="i", mode="c")
cdef int *supported_archs_ptr = <int *>(supported_archs.data)
with nogil:
__status__ = nvrtcGetSupportedArchs(supported_archs_ptr)
check_status(__status__)
supported_archs_alloc = _cyb_view.array(shape=(1,), itemsize=sizeof(int), format="i", mode="c")
supported_archs = supported_archs_alloc[:0]
else:
supported_archs_alloc = _cyb_view.array(shape=(numArchs,), itemsize=sizeof(int), format="i", mode="c")
supported_archs = supported_archs_alloc
supported_archs_ptr = <int *>(supported_archs_alloc.data)
if numArchs != 0:
with nogil:
__status__ = nvrtcGetSupportedArchs(supported_archs_ptr)
check_status(__status__)
return supported_archs


Expand Down Expand Up @@ -739,13 +749,12 @@ cpdef bytes get_ptx(intptr_t prog):
with nogil:
__status__ = nvrtcGetPTXSize(<Program>prog, &ptxSizeRet)
check_status(__status__)
if ptxSizeRet == 0:
return b""
cdef bytes _ptx_ = bytes(ptxSizeRet)
cdef char* ptx = _ptx_
with nogil:
__status__ = nvrtcGetPTX(<Program>prog, ptx)
check_status(__status__)
if ptxSizeRet != 0:
with nogil:
__status__ = nvrtcGetPTX(<Program>prog, ptx)
check_status(__status__)
return _ptx_


Expand Down Expand Up @@ -782,13 +791,12 @@ cpdef bytes get_cubin(intptr_t prog):
with nogil:
__status__ = nvrtcGetCUBINSize(<Program>prog, &cubinSizeRet)
check_status(__status__)
if cubinSizeRet == 0:
return b""
cdef bytes _cubin_ = bytes(cubinSizeRet)
cdef char* cubin = _cubin_
with nogil:
__status__ = nvrtcGetCUBIN(<Program>prog, cubin)
check_status(__status__)
if cubinSizeRet != 0:
with nogil:
__status__ = nvrtcGetCUBIN(<Program>prog, cubin)
check_status(__status__)
return _cubin_


Expand Down Expand Up @@ -825,13 +833,12 @@ cpdef bytes get_ltoir(intptr_t prog):
with nogil:
__status__ = nvrtcGetLTOIRSize(<Program>prog, &LTOIRSizeRet)
check_status(__status__)
if LTOIRSizeRet == 0:
return b""
cdef bytes _ltoir_ = bytes(LTOIRSizeRet)
cdef char* ltoir = _ltoir_
with nogil:
__status__ = nvrtcGetLTOIR(<Program>prog, ltoir)
check_status(__status__)
if LTOIRSizeRet != 0:
with nogil:
__status__ = nvrtcGetLTOIR(<Program>prog, ltoir)
check_status(__status__)
return _ltoir_


Expand Down Expand Up @@ -868,19 +875,21 @@ cpdef bytes get_optix_ir(intptr_t prog):
with nogil:
__status__ = nvrtcGetOptiXIRSize(<Program>prog, &optixirSizeRet)
check_status(__status__)
if optixirSizeRet == 0:
return b""
cdef bytes _optixir_ = bytes(optixirSizeRet)
cdef char* optixir = _optixir_
with nogil:
__status__ = nvrtcGetOptiXIR(<Program>prog, optixir)
check_status(__status__)
if optixirSizeRet != 0:
with nogil:
__status__ = nvrtcGetOptiXIR(<Program>prog, optixir)
check_status(__status__)
return _optixir_


cpdef size_t get_program_log_size(intptr_t prog) except? 0:
"""nvrtcGetProgramLogSize sets ``log_size_ret`` with the size of the log generated by the previous compilation of ``prog`` (including the trailing ``NULL``).

Note that compilation log may be generated with warnings and informative
messages, even when the compilation of ``prog`` succeeds.

Args:
prog (intptr_t): CUDA Runtime Compilation program.

Expand Down Expand Up @@ -912,19 +921,21 @@ cpdef bytes get_program_log(intptr_t prog):
with nogil:
__status__ = nvrtcGetProgramLogSize(<Program>prog, &logSizeRet)
check_status(__status__)
if logSizeRet == 0:
return b""
cdef bytes _log_ = bytes(logSizeRet)
cdef char* log = _log_
with nogil:
__status__ = nvrtcGetProgramLog(<Program>prog, log)
check_status(__status__)
if logSizeRet != 0:
with nogil:
__status__ = nvrtcGetProgramLog(<Program>prog, log)
check_status(__status__)
return _log_


cpdef add_name_expression(intptr_t prog, name_expression):
"""nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device/__constant__ variable.

The identical name expression string must be provided on a subsequent call
to nvrtcGetLoweredName to extract the lowered name.

Args:
prog (intptr_t): CUDA Runtime Compilation program.
name_expression (str): constant expression denoting the
Expand Down Expand Up @@ -961,6 +972,10 @@ cpdef size_t get_pch_heap_size() except? 0:
cpdef set_pch_heap_size(size_t size):
"""set the size of the PCH Heap.

The requested size may be rounded up to a platform dependent alignment
(e.g. page size). If the PCH Heap has already been allocated, the heap
memory will be freed and a new PCH Heap will be allocated.

Args:
size (size_t): requested size of the PCH Heap, in bytes.

Expand All @@ -974,6 +989,20 @@ cpdef set_pch_heap_size(size_t size):
cpdef int get_pch_create_status(intptr_t prog) except? -1:
"""returns the PCH creation status.

NVRTC_SUCCESS indicates that the PCH was successfully created.
NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED indicates that no PCH creation was
attempted, either because PCH functionality was not requested during the
preceding nvrtcCompileProgram call, or automatic PCH processing was
requested, and compiler chose not to create a PCH file.
NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED indicates that a PCH file could
potentially have been created, but the compiler ran out space in the PCH
heap. In this scenario, the :func:`get_pch_heap_size_required` can be used
to query the required heap size, the heap can be reallocated for this size
with :func:`set_pch_heap_size` and PCH creation may be reattempted again
invoking :func:`compile_program` with a new NVRTC program instance.
NVRTC_ERROR_PCH_CREATE indicates that an error condition prevented the PCH
file from being created.

Args:
prog (intptr_t): CUDA Runtime Compilation program.

Expand Down Expand Up @@ -1037,13 +1066,12 @@ cpdef bytes get_tile_ir(intptr_t prog):
with nogil:
__status__ = nvrtcGetTileIRSize(<Program>prog, &TileIRSizeRet)
check_status(__status__)
if TileIRSizeRet == 0:
return b""
cdef bytes _tile_ir_ = bytes(TileIRSizeRet)
cdef char* tile_ir = _tile_ir_
with nogil:
__status__ = nvrtcGetTileIR(<Program>prog, tile_ir)
check_status(__status__)
if TileIRSizeRet != 0:
with nogil:
__status__ = nvrtcGetTileIR(<Program>prog, tile_ir)
check_status(__status__)
return _tile_ir_


Expand Down
18 changes: 15 additions & 3 deletions cuda_bindings/cuda/bindings/nvml.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
#
# This code was automatically generated across versions from 12.9.1 to 13.3.0. Do not modify it directly.
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=b6fe9a4efd0077f8c09ef4f826880ad0a54100455d4465953c4127d3de8c4d91
# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c45bc4c9772d2e6fe0163353f54a44655db866a025cc1adab756e44df3b39731



Expand Down Expand Up @@ -62,7 +62,6 @@ ctypedef nvmlUnrepairableMemoryStatus_v1_t UnrepairableMemoryStatus_v1
ctypedef nvmlRusdSettings_v1_t RusdSettings_v1
ctypedef nvmlPowerValue_v2_t PowerValue_v2
ctypedef nvmlVgpuTypeMaxInstance_v1_t VgpuTypeMaxInstance_v1
ctypedef nvmlVgpuProcessUtilizationSample_t VgpuProcessUtilizationSample
ctypedef nvmlGpuFabricInfo_t GpuFabricInfo
ctypedef nvmlSystemEventSetCreateRequest_v1_t SystemEventSetCreateRequest_v1
ctypedef nvmlSystemEventSetFreeRequest_v1_t SystemEventSetFreeRequest_v1
Expand Down Expand Up @@ -163,13 +162,15 @@ cpdef int system_get_cuda_driver_version() except *
cpdef int system_get_cuda_driver_version_v2() except 0
cpdef str system_get_process_name(unsigned int pid)
cpdef object system_get_hic_version()
cpdef object system_get_topology_gpu_set(unsigned int cpu_number)
cpdef unsigned int unit_get_count() except? 0
cpdef intptr_t unit_get_handle_by_index(unsigned int index) except? 0
cpdef object unit_get_unit_info(intptr_t unit)
cpdef object unit_get_led_state(intptr_t unit)
cpdef object unit_get_psu_info(intptr_t unit)
cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0
cpdef object unit_get_fan_speed_info(intptr_t unit)
cpdef object unit_get_devices(intptr_t unit)
cpdef unsigned int device_get_count_v2() except? 0
cpdef object device_get_attributes_v2(intptr_t device)
cpdef intptr_t device_get_handle_by_index_v2(unsigned int index) except? 0
Expand All @@ -189,6 +190,7 @@ cpdef device_set_cpu_affinity(intptr_t device)
cpdef device_clear_cpu_affinity(intptr_t device)
cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0
cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1
cpdef object device_get_topology_nearest_gpus(intptr_t device, int level)
cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_index) except? -1
cpdef str device_get_uuid(intptr_t device)
cpdef unsigned int device_get_minor_number(intptr_t device) except? 0
Expand Down Expand Up @@ -271,6 +273,7 @@ cpdef object device_get_graphics_running_processes_v3(intptr_t device)
cpdef object device_get_mps_compute_running_processes_v3(intptr_t device)
cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0
cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1
cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp)
cpdef object device_get_bar1_memory_info(intptr_t device)
cpdef unsigned int device_get_irq_num(intptr_t device) except? 0
cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0
Expand All @@ -297,6 +300,7 @@ cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid)
cpdef object device_get_accounting_pids(intptr_t device)
cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0
cpdef object device_get_retired_pages(intptr_t device, int cause)
cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause)
cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1
cpdef tuple device_get_remapped_rows(intptr_t device)
cpdef object device_get_row_remapper_histogram(intptr_t device)
Expand Down Expand Up @@ -352,6 +356,8 @@ cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state)
cpdef object device_get_grid_licensable_features_v4(intptr_t device)
cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0
cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0
cpdef object device_get_supported_vgpus(intptr_t device)
cpdef object device_get_creatable_vgpus(intptr_t device)
cpdef str vgpu_type_get_class(unsigned int vgpu_type_id)
cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0
cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id)
Expand All @@ -363,6 +369,8 @@ cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) exc
cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0
cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0
cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id)
cpdef object device_get_active_vgpus(intptr_t device)
cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance)
cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance)
cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance)
cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0
Expand All @@ -388,8 +396,10 @@ cpdef object device_get_vgpu_scheduler_log(intptr_t device)
cpdef object device_get_vgpu_scheduler_state(intptr_t device)
cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device)
cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state)
cpdef tuple get_vgpu_version()
cpdef set_vgpu_version(intptr_t vgpu_version)
cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp)
cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp)
cpdef object device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp)
cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1
cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance)
cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid)
Expand All @@ -404,6 +414,7 @@ cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, u
cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0
cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0
cpdef gpu_instance_destroy(intptr_t gpu_instance)
cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id)
cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0
cpdef object gpu_instance_get_info(intptr_t gpu_instance)
cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile)
Expand All @@ -412,6 +423,7 @@ cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_
cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0
cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0
cpdef compute_instance_destroy(intptr_t compute_instance)
cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned int profile_id)
cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0
cpdef object compute_instance_get_info_v2(intptr_t compute_instance)
cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0
Expand Down
Loading
Loading