33# SPDX-License-Identifier: Apache-2.0
44#
55# This code was automatically generated across versions from 12.9.0 to 13.3.0. Do not modify it directly.
6- # CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a36c7e54cf29166832dd9aebc1fa71cc3649498794a2846e707396419caebe10
6+ # CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=81a8413522bab04b3eb89373f90a9879758fdeeeb8141425dc27c4504df84b78
77
88
99# <<<< PREAMBLE CONTENT >>>>
@@ -657,6 +657,8 @@ cpdef tuple version():
657657cpdef int get_num_supported_archs() except ? - 1 :
658658 """ 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.
659659
660+ see ``nvrtcGetSupportedArchs``.
661+
660662 Returns:
661663 int: number of supported architectures.
662664
@@ -672,6 +674,8 @@ cpdef int get_num_supported_archs() except? -1:
672674cpdef object get_supported_archs():
673675 """ 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``.
674676
677+ see ``nvrtcGetNumSupportedArchs``.
678+
675679 Returns:
676680 int: sorted array of supported architectures.
677681
@@ -681,13 +685,19 @@ cpdef object get_supported_archs():
681685 with nogil:
682686 __status__ = nvrtcGetNumSupportedArchs(& numArchs)
683687 check_status(__status__)
688+ cdef _cyb_view.array supported_archs_alloc
689+ cdef int * supported_archs_ptr
684690 if numArchs == 0 :
685- return _cyb_view.array(shape = (1 ,), itemsize = sizeof(int ), format = " i" , mode = " c" )[:0 ]
686- cdef _cyb_view.array supported_archs = _cyb_view.array(shape = (numArchs,), itemsize = sizeof(int ), format = " i" , mode = " c" )
687- cdef int * supported_archs_ptr = < int * > (supported_archs.data)
688- with nogil:
689- __status__ = nvrtcGetSupportedArchs(supported_archs_ptr)
690- check_status(__status__)
691+ supported_archs_alloc = _cyb_view.array(shape = (1 ,), itemsize = sizeof(int ), format = " i" , mode = " c" )
692+ supported_archs = supported_archs_alloc[:0 ]
693+ else :
694+ supported_archs_alloc = _cyb_view.array(shape = (numArchs,), itemsize = sizeof(int ), format = " i" , mode = " c" )
695+ supported_archs = supported_archs_alloc
696+ supported_archs_ptr = < int * > (supported_archs_alloc.data)
697+ if numArchs != 0 :
698+ with nogil:
699+ __status__ = nvrtcGetSupportedArchs(supported_archs_ptr)
700+ check_status(__status__)
691701 return supported_archs
692702
693703
@@ -739,13 +749,12 @@ cpdef bytes get_ptx(intptr_t prog):
739749 with nogil:
740750 __status__ = nvrtcGetPTXSize(< Program> prog, & ptxSizeRet)
741751 check_status(__status__)
742- if ptxSizeRet == 0 :
743- return b" "
744752 cdef bytes _ptx_ = bytes(ptxSizeRet)
745753 cdef char * ptx = _ptx_
746- with nogil:
747- __status__ = nvrtcGetPTX(< Program> prog, ptx)
748- check_status(__status__)
754+ if ptxSizeRet != 0 :
755+ with nogil:
756+ __status__ = nvrtcGetPTX(< Program> prog, ptx)
757+ check_status(__status__)
749758 return _ptx_
750759
751760
@@ -782,13 +791,12 @@ cpdef bytes get_cubin(intptr_t prog):
782791 with nogil:
783792 __status__ = nvrtcGetCUBINSize(< Program> prog, & cubinSizeRet)
784793 check_status(__status__)
785- if cubinSizeRet == 0 :
786- return b" "
787794 cdef bytes _cubin_ = bytes(cubinSizeRet)
788795 cdef char * cubin = _cubin_
789- with nogil:
790- __status__ = nvrtcGetCUBIN(< Program> prog, cubin)
791- check_status(__status__)
796+ if cubinSizeRet != 0 :
797+ with nogil:
798+ __status__ = nvrtcGetCUBIN(< Program> prog, cubin)
799+ check_status(__status__)
792800 return _cubin_
793801
794802
@@ -825,13 +833,12 @@ cpdef bytes get_ltoir(intptr_t prog):
825833 with nogil:
826834 __status__ = nvrtcGetLTOIRSize(< Program> prog, & LTOIRSizeRet)
827835 check_status(__status__)
828- if LTOIRSizeRet == 0 :
829- return b" "
830836 cdef bytes _ltoir_ = bytes(LTOIRSizeRet)
831837 cdef char * ltoir = _ltoir_
832- with nogil:
833- __status__ = nvrtcGetLTOIR(< Program> prog, ltoir)
834- check_status(__status__)
838+ if LTOIRSizeRet != 0 :
839+ with nogil:
840+ __status__ = nvrtcGetLTOIR(< Program> prog, ltoir)
841+ check_status(__status__)
835842 return _ltoir_
836843
837844
@@ -868,19 +875,21 @@ cpdef bytes get_optix_ir(intptr_t prog):
868875 with nogil:
869876 __status__ = nvrtcGetOptiXIRSize(< Program> prog, & optixirSizeRet)
870877 check_status(__status__)
871- if optixirSizeRet == 0 :
872- return b" "
873878 cdef bytes _optixir_ = bytes(optixirSizeRet)
874879 cdef char * optixir = _optixir_
875- with nogil:
876- __status__ = nvrtcGetOptiXIR(< Program> prog, optixir)
877- check_status(__status__)
880+ if optixirSizeRet != 0 :
881+ with nogil:
882+ __status__ = nvrtcGetOptiXIR(< Program> prog, optixir)
883+ check_status(__status__)
878884 return _optixir_
879885
880886
881887cpdef size_t get_program_log_size(intptr_t prog) except ? 0 :
882888 """ nvrtcGetProgramLogSize sets ``log_size_ret`` with the size of the log generated by the previous compilation of ``prog`` (including the trailing ``NULL``).
883889
890+ Note that compilation log may be generated with warnings and informative
891+ messages, even when the compilation of ``prog`` succeeds.
892+
884893 Args:
885894 prog (intptr_t): CUDA Runtime Compilation program.
886895
@@ -912,19 +921,21 @@ cpdef bytes get_program_log(intptr_t prog):
912921 with nogil:
913922 __status__ = nvrtcGetProgramLogSize(< Program> prog, & logSizeRet)
914923 check_status(__status__)
915- if logSizeRet == 0 :
916- return b" "
917924 cdef bytes _log_ = bytes(logSizeRet)
918925 cdef char * log = _log_
919- with nogil:
920- __status__ = nvrtcGetProgramLog(< Program> prog, log)
921- check_status(__status__)
926+ if logSizeRet != 0 :
927+ with nogil:
928+ __status__ = nvrtcGetProgramLog(< Program> prog, log)
929+ check_status(__status__)
922930 return _log_
923931
924932
925933cpdef add_name_expression(intptr_t prog, name_expression):
926934 """ nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device/__constant__ variable.
927935
936+ The identical name expression string must be provided on a subsequent call
937+ to nvrtcGetLoweredName to extract the lowered name.
938+
928939 Args:
929940 prog (intptr_t): CUDA Runtime Compilation program.
930941 name_expression (str): constant expression denoting the
@@ -961,6 +972,10 @@ cpdef size_t get_pch_heap_size() except? 0:
961972cpdef set_pch_heap_size(size_t size):
962973 """ set the size of the PCH Heap.
963974
975+ The requested size may be rounded up to a platform dependent alignment
976+ (e.g. page size). If the PCH Heap has already been allocated, the heap
977+ memory will be freed and a new PCH Heap will be allocated.
978+
964979 Args:
965980 size (size_t): requested size of the PCH Heap, in bytes.
966981
@@ -974,6 +989,20 @@ cpdef set_pch_heap_size(size_t size):
974989cpdef int get_pch_create_status(intptr_t prog) except ? - 1 :
975990 """ returns the PCH creation status.
976991
992+ NVRTC_SUCCESS indicates that the PCH was successfully created.
993+ NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED indicates that no PCH creation was
994+ attempted, either because PCH functionality was not requested during the
995+ preceding nvrtcCompileProgram call, or automatic PCH processing was
996+ requested, and compiler chose not to create a PCH file.
997+ NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED indicates that a PCH file could
998+ potentially have been created, but the compiler ran out space in the PCH
999+ heap. In this scenario, the :func:`get_pch_heap_size_required` can be used
1000+ to query the required heap size, the heap can be reallocated for this size
1001+ with :func:`set_pch_heap_size` and PCH creation may be reattempted again
1002+ invoking :func:`compile_program` with a new NVRTC program instance.
1003+ NVRTC_ERROR_PCH_CREATE indicates that an error condition prevented the PCH
1004+ file from being created.
1005+
9771006 Args:
9781007 prog (intptr_t): CUDA Runtime Compilation program.
9791008
@@ -1037,13 +1066,12 @@ cpdef bytes get_tile_ir(intptr_t prog):
10371066 with nogil:
10381067 __status__ = nvrtcGetTileIRSize(< Program> prog, & TileIRSizeRet)
10391068 check_status(__status__)
1040- if TileIRSizeRet == 0 :
1041- return b" "
10421069 cdef bytes _tile_ir_ = bytes(TileIRSizeRet)
10431070 cdef char * tile_ir = _tile_ir_
1044- with nogil:
1045- __status__ = nvrtcGetTileIR(< Program> prog, tile_ir)
1046- check_status(__status__)
1071+ if TileIRSizeRet != 0 :
1072+ with nogil:
1073+ __status__ = nvrtcGetTileIR(< Program> prog, tile_ir)
1074+ check_status(__status__)
10471075 return _tile_ir_
10481076
10491077
0 commit comments