ó
    „ñ:iÝ%  ã                   óâ   • S SK JrJrJrJrJrJrJr  S SKJ	r	  S SK
Jr  S SKJrJrJr  S SKrS SKrS SKrS SKr\r\r " S S\	5      r\R.                  " 5       r " S S	5      r " S
 S5      rS rg)é    )ÚbyrefÚc_charÚc_char_pÚc_intÚc_size_tÚc_void_pÚPOINTER)ÚIntEnum)Úconfig)Ú
NvrtcErrorÚNvrtcCompilationErrorÚNvrtcSupportErrorNc                   óD   • \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrg)ÚNvrtcResulté   r   é   é   é   é   é   é   é   é   é	   é
   é   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚNVRTC_SUCCESSÚNVRTC_ERROR_OUT_OF_MEMORYÚ$NVRTC_ERROR_PROGRAM_CREATION_FAILUREÚNVRTC_ERROR_INVALID_INPUTÚNVRTC_ERROR_INVALID_PROGRAMÚNVRTC_ERROR_INVALID_OPTIONÚNVRTC_ERROR_COMPILATIONÚ%NVRTC_ERROR_BUILTIN_OPERATION_FAILUREÚ1NVRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATIONÚ/NVRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATIONÚ%NVRTC_ERROR_NAME_EXPRESSION_NOT_VALIDÚNVRTC_ERROR_INTERNAL_ERRORÚ__static_attributes__r   ó    Ú[/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/numba/cuda/cudadrv/nvrtc.pyr   r      sI   † Ø€MØ !ÐØ+,Ð(Ø !ÐØ"#ÐØ!"ÐØÐØ,-Ð)Ø89Ð5Ø67Ð3Ø,.Ð)Ø!#Ór/   r   c                   ó4   • \ rS rSrSrS r\S 5       rS rSr	g)ÚNvrtcProgramé%   zÑ
A class for managing the lifetime of nvrtcProgram instances. Instances of
the class own an nvrtcProgram; when an instance is deleted, the underlying
nvrtcProgram is destroyed using the appropriate NVRTC API.
c                 ó   • Xl         X l        g ©N)Ú_nvrtcÚ_handle)ÚselfÚnvrtcÚhandles      r0   Ú__init__ÚNvrtcProgram.__init__+   s   € ØŒØ�r/   c                 ó   • U R                   $ r5   )r7   ©r8   s    r0   r:   ÚNvrtcProgram.handle/   s   € à�|‰|Ðr/   c                 ó^   • U R                   (       a  U R                  R                  U 5        g g r5   )r7   r6   Údestroy_programr>   s    r0   Ú__del__ÚNvrtcProgram.__del__3   s    € Ø�<�<Ø�K‰K×'Ñ'¨Õ-ð r/   )r7   r6   N)
r   r   r    r!   Ú__doc__r;   Úpropertyr:   rB   r.   r   r/   r0   r2   r2   %   s%   † ñò
ð ñó ðõ.r/   r2   c                   ó  • \ rS rSrSr\\" \5      \" \5      4\\\	\	\\" \	5      \" \	5      4\\" \5      4\\\\" \	5      4\\\" \
5      4\\\	4\\\" \
5      4\\\	4\\\" \
5      4\\\	4S.
rSrS rS rS rS rS	 rS
 rS rSrg)ÚNVRTCé8   a*  
Provides a Pythonic interface to the NVRTC APIs, abstracting away the C API
calls.

The sole instance of this class is a process-wide singleton, similar to the
NVVM interface. Initialization is protected by a lock and uses the standard
(for Numba) open_cudalib function to load the NVRTC library.
)
ÚnvrtcVersionÚnvrtcCreateProgramÚnvrtcDestroyProgramÚnvrtcCompileProgramÚnvrtcGetPTXSizeÚnvrtcGetPTXÚnvrtcGetCUBINSizeÚnvrtcGetCUBINÚnvrtcGetProgramLogSizeÚnvrtcGetProgramLogNc                 ó  • [            U R                  c™  SSKJn  [        R                  U 5      =U l        n U" S5      nUR                  R                  5        HP  u  pV[        X55      nUS   Ul        USS  Ul        [        R                  " U5      XuS.S j5       n[        X%U5        MR     S S S 5        U R                  $ ! [         a  nS U l        [        S5      UeS nAff = f! , (       d  f       U R                  $ = f)Nr   )Úopen_cudalibr9   zNVRTC cannot be loadedr   )ÚfuncÚnamec                 óð   • U " U6 nU[         R                  :X  a
  [        5       eU[         R                  :w  a)   [        U5      R                  nSU SU 3n[        U5      eg ! [
         a	    SU S3n N&f = f)Nz"Unknown nvrtc_result (error code: Ú)zFailed to call z: )r   r(   r   r"   rV   Ú
ValueErrorr   )rU   rV   ÚargsÚerrorÚ
error_nameÚmsgs         r0   Úchecked_callÚ#NVRTC.__new__.<locals>.checked_callx   s‘   € á $ d ˜Ø ¤K×$GÑ$GÓGÜ"7Ó"9Ð9Ø"¤k×&?Ñ&?Ó?ðHÜ-8¸Ó-?×-DÑ-D 
ð %4°D°6¸¸J¸<Ð"H˜CÜ",¨S£/Ð1ð @øô $.ó Hð/>Ø>C¸WÀAð/G¢
ðHús   ¹A" Á"A5Á4A5)Ú_nvrtc_lockÚ_NVRTC__INSTANCEÚnumba.cuda.cudadrv.libsrT   ÚobjectÚ__new__ÚOSErrorr   Ú_PROTOTYPESÚitemsÚgetattrÚrestypeÚargtypesÚ	functoolsÚwrapsÚsetattr)	ÚclsrT   ÚinstÚlibÚerV   ÚprotorU   r^   s	            r0   rd   ÚNVRTC.__new__g   sð   € ÞØ�~‰~Ñ%Ý@Ü(.¯©°sÓ(;Ð;�” ðMÙ& wÓ/�Cð $(×#3Ñ#3×#9Ñ#9Ö#;‘K�DÜ" 3Ó-�DØ#(¨¡8�D”LØ$)¨!¨" I�D”Mä—_’_ TÓ*Ø15ô 2ó +ð2ô ˜D¨Ö5ñ' $<÷ ð@ �~‰~Ðøô5 ó MØ%)�C”NÜ+Ð,DÓEÈ1ÐLûðMú÷ Œ[ð@ �~‰~Ðús/   ‡0C'¸CÁ A.C'Ã
C$ÃCÃC$Ã$C'Ã'
D c                 ó¢   • [        5       n[        5       nU R                  [        U5      [        U5      5        UR                  UR                  4$ )z2
Get the NVRTC version as a tuple (major, minor).
)r   rI   r   Úvalue)r8   ÚmajorÚminors      r0   Úget_versionÚNVRTC.get_versionŠ   s=   € ô “ˆÜ“ˆØ×Ñœ% ›,¬¨e«Ô5Ø�{‰{˜EŸK™KÐ'Ð'r/   c                 óü   • [        U[        5      (       a  UR                  5       n[        U[        5      (       a  UR                  5       n[        5       nU R	                  [        U5      XSSS5        [        X5      $ )z0
Create an NVRTC program with managed lifetime.
r   N)Ú
isinstanceÚstrÚencodeÚnvrtc_programrJ   r   r2   )r8   ÚsrcrV   r:   s       r0   Úcreate_programÚNVRTC.create_program“   sb   € ô �cœ3×ÑØ—*‘*“,ˆCÜ�dœC× Ñ Ø—;‘;“=ˆDä“ˆð
 	×Ñ¤ f£¨s¸!¸TÀ4ÔHÜ˜DÓ)Ð)r/   c                 ó(  • U Vs/ s H  o3R                  5       PM     nnU Vs/ s H  n[        U5      PM     nn[        [        U5      -  nU" U6 n U R                  UR                  [        U5      U5        gs  snf s  snf ! [
         a     gf = f)z¬
Compile an NVRTC program. Compilation may fail due to a user error in
the source; this function returns ``True`` if there is a compilation
error and ``False`` on success.
FT)r}   r   ÚlenrL   r:   r   )r8   ÚprogramÚoptionsÚoptÚencoded_optionsÚoption_pointersÚc_options_typeÚ	c_optionss           r0   Úcompile_programÚNVRTC.compile_program¤   sŠ   € ñ 4;Ó;²7¨CŸ:™:ž<±7ˆÐ;Ù4CÓD²O¨Sœ8 Cž=±OˆÐDÜ"¤S¨£\Ñ1ˆÙ" OÐ4ˆ	ð	Ø×$Ñ$ W§^¡^´S¸³\À9ÔMØùò <ùÚDøô %ó 	Ùð	ús   …A:¤A?Á&B Â
BÂBc                 óL   • U R                  [        UR                  5      5        g)z
Destroy an NVRTC program.
N)rK   r   r:   )r8   r„   s     r0   rA   ÚNVRTC.destroy_program¶   s   € ð 	× Ñ ¤ w§~¡~Ó!6Õ7r/   c                 óü   • [        5       nU R                  UR                  [        U5      5        [        UR
                  -  " 5       nU R                  UR                  U5        UR
                  R                  5       $ )z)
Get the compile log as a Python string.
)r   rQ   r:   r   r   ru   rR   Údecode)r8   r„   Úlog_sizeÚlogs       r0   Úget_compile_logÚNVRTC.get_compile_log¼   s[   € ô “:ˆØ×#Ñ# G§N¡N´E¸(³OÔDä˜Ÿ™Ò&Ó)ˆØ×Ñ §¡°Ô4à�y‰y×ÑÓ!Ð!r/   c                 óü   • [        5       nU R                  UR                  [        U5      5        [        UR
                  -  " 5       nU R                  UR                  U5        UR
                  R                  5       $ )z*
Get the compiled PTX as a Python string.
)r   rM   r:   r   r   ru   rN   r�   )r8   r„   Úptx_sizeÚptxs       r0   Úget_ptxÚNVRTC.get_ptxÈ   s[   € ô “:ˆØ×Ñ˜WŸ^™^¬U°8«_Ô=ä˜Ÿ™Ò&Ó)ˆØ×Ñ˜Ÿ™¨Ô-à�y‰y×ÑÓ!Ð!r/   r   )r   r   r    r!   rD   Únvrtc_resultr	   r   r~   r   r   rf   ra   rd   rx   r€   r‹   rA   r“   r˜   r.   r   r/   r0   rG   rG   8   sì   † ñð &¡w¨u£~±w¸u³~ÐFð  ,¨]¸HÀhØ$¡g¨hÓ&7¹ÀÓ9JðLð !-©g°mÓ.DÐEð !-¨m¸UÙ '¨Ó 1ð 3ð )¨-¹ÀÓ9JÐKà$ m°XÐ>ð +¨M¹7À8Ó;LÐMà&¨°xÐ@ð $0°Ù#*¨8Ó#4ð#6ð  ,¨]¸HÐEñA!€KðH €Jò!òF(ò*ò"ò$8ò
"õ
"r/   rG   c                 ó4  • [        5       nUR                  X5      nUu  pVSU U 3nS[        R                   3n[        R
                  R                  [        R
                  R                  [        5      5      n	[        R
                  R                  U	5      n
SU
 3nXxUSS/nUR                  XL5      nUR                  U5      nU(       a  SU SU 3n[        U5      eU(       a  SU SU 3n[        R                  " U5        UR                  U5      nUU4$ )aV  
Compile a CUDA C/C++ source to PTX for a given compute capability.

:param src: The source code to compile
:type src: str
:param name: The filename of the source (for information only)
:type name: str
:param cc: A tuple ``(major, minor)`` of the compute capability
:type cc: tuple
:return: The compiled PTX and compilation log
:rtype: tuple
z--gpu-architecture=compute_z-Iz-rdcÚtruez+NVRTC Compilation failure whilst compiling z:

z$NVRTC log messages whilst compiling )rG   r€   r   ÚCUDA_INCLUDE_PATHÚosÚpathÚdirnameÚabspathÚ__file__r‹   r“   r   ÚwarningsÚwarnr˜   )r   rV   Úccr9   r„   rv   rw   ÚarchÚincludeÚcudadrv_pathÚnumba_cuda_pathÚnumba_includer…   Úcompile_errorr’   r]   r—   s                    r0   Úcompiler¬   Õ   s  € ô ‹G€EØ×"Ñ" 3Ó-€Gð �L€EØ(¨¨°¨wÐ7€DØ”6×+Ñ+Ð,Ð-€Gä—7‘7—?‘?¤2§7¡7§?¡?´8Ó#<Ó=€LÜ—g‘g—o‘o lÓ3€OØ˜Ð)Ð*€MØ˜m¨V°VÐ<€Gð ×)Ñ)¨'Ó;€Mð ×
Ñ
 Ó
(€Cö Ø<¸T¸FÀ%ÈÀuÐMˆÜ˜‹oÐö Ø5°d°V¸5ÀÀÐFˆÜ�Š�cÔà
�-‰-˜Ó
 €CØ�ˆ8€Or/   )Úctypesr   r   r   r   r   r   r	   Úenumr
   Ú
numba.corer   Únumba.cuda.cudadrv.errorr   r   r   rk   rž   Ú	threadingr£   r~   rš   r   ÚLockr`   r2   rG   r¬   r   r/   r0   Ú<module>r³      sp   ðß N× NÑ NÝ Ý ÷9ñ 9ó Û 	Û Û ð €ð €ô$�'ô $ð �nŠnÓ€÷.ñ .÷&Z"ñ Z"óz/r/   