ó
    „ñ:i>  ã                   óì  • S SK Jr  S SKJr  S SKJrJrJrJrJ	r	J
r
  S SKJrJrJrJrJrJr  S SKJr  S SKJrJrJr  S SKJr  S SKJrJrJr  S S	KJr  S S
K J!r!  S SK"J#r#  S r$ " S S\5      r% " S S\5      r&S r'\" SSS9 " S S\5      5       r(\" SSS9 " S S\5      5       r) " S S\5      r*\   S&S j5       r+S r,\   S'S j5       r-   S(S jr.  S)S  jr/   S*S! jr0S" r1S# r2 " S$ S%\35      r4g)+é    )Úir)ÚConcreteTemplate)ÚtypesÚtypingÚfuncdescÚconfigÚcompilerÚsigutils)Úsanitize_compile_result_entriesÚCompilerBaseÚDefaultPassBuilderÚFlagsÚOptionÚCompileResult)Úglobal_compiler_lock)ÚLoweringPassÚPassManagerÚregister_pass)ÚNumbaInvalidConfigWarning)ÚIRLegalizationÚNativeLoweringÚAnnotateTypes)Úwarn)Úget_current_device)ÚCUDACABICallConvc                 ó<   • U c  g [        U [        5      (       d   eU $ ©N)Ú
isinstanceÚdict)Úxs    ÚV/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/numba/cuda/compiler.pyÚ_nvvm_options_typer"      s$   € Ø�yØô ˜!œT×"Ñ"Ð"Ð"Øˆó    c                   ó4   • \ rS rSr\" \SSS9r\" \SSS9rSr	g)Ú	CUDAFlagsé   NzNVVM options)ÚtypeÚdefaultÚdoczCompute Capability© )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r"   Únvvm_optionsÚtupleÚcompute_capabilityÚ__static_attributes__r*   r#   r!   r%   r%      s+   † ÙØØØñ€Lñ
  ØØØ ñÓr#   r%   c                   ó$   • \ rS rSr\S 5       rSrg)ÚCUDACompileResulté8   c                 ó   • [        U 5      $ r   )Úid©Úselfs    r!   Úentry_pointÚCUDACompileResult.entry_point9   s   € ä�$‹xˆr#   r*   N)r+   r,   r-   r.   Úpropertyr:   r2   r*   r#   r!   r4   r4   8   s   † Øñó ór#   r4   c                  ó.   • [        U 5      n [        S0 U D6$ )Nr*   )r   r4   )Úentriess    r!   Úcuda_compile_resultr?   >   s   € Ü-¨gÓ6€GÜÑ'˜wÑ'Ð'r#   TF)Úmutates_CFGÚanalysis_onlyc                   ó$   • \ rS rSrSrS rS rSrg)ÚCUDABackendéC   Úcuda_backendc                 ó0   • [         R                  " U 5        g r   ©r   Ú__init__r8   s    r!   rH   ÚCUDABackend.__init__H   ó   € Ü×Ò˜dÕ#r#   c                 ó.  • US   n[         R                  " UR                  /UR                  Q76 n[	        UR
                  UR                  UR                  R                  UR                  UR                  UR                  UUR                  S9Ul        g)z8
Back-end: Packages lowering output in a compile result
Úcr)Útyping_contextÚtarget_contextÚtyping_errorÚtype_annotationÚlibraryÚcall_helperÚ	signatureÚfndescT)r   rS   Úreturn_typeÚargsr?   Ú	typingctxÚ	targetctxÚstatusÚfail_reasonrP   rQ   rR   rT   rL   )r9   ÚstateÚloweredrS   s       r!   Úrun_passÚCUDABackend.run_passK   s{   € ð ˜‘+ˆÜ×$Ò$ U×%6Ñ%6ÐD¸¿¹ÒDˆ	ä&Ø Ÿ?™?Ø Ÿ?™?ØŸ™×1Ñ1Ø!×1Ñ1Ø—M‘MØ×+Ñ+ØØ—>‘>ñ	
ˆŒð r#   r*   N)r+   r,   r-   r.   Ú_namerH   r]   r2   r*   r#   r!   rC   rC   C   s   † ð €Eò$õr#   rC   c                   ó(   • \ rS rSrSrSrS rS rSrg)ÚCreateLibraryé_   zÕ
Create a CUDACodeLibrary for the NativeLowering pass to populate. The
NativeLowering pass will create a code library if none exists, but we need
to set it up with nvvm_options from the flags if they are present.
Úcreate_libraryc                 ó0   • [         R                  " U 5        g r   rG   r8   s    r!   rH   ÚCreateLibrary.__init__i   rJ   r#   c                 óì   • UR                   R                  5       nUR                  R                  nUR                  R
                  nUR                  X4S9Ul        UR                  R                  5         g)N)r/   T)	rX   ÚcodegenÚfunc_idÚfunc_qualnameÚflagsr/   rc   rQ   Úenable_object_caching)r9   r[   rg   Únamer/   s        r!   r]   ÚCreateLibrary.run_passl   sZ   € Ø—/‘/×)Ñ)Ó+ˆØ�}‰}×*Ñ*ˆØ—{‘{×/Ñ/ˆØ×.Ñ.¨tÐ.ÐOˆŒà�‰×+Ñ+Ô-àr#   r*   N)	r+   r,   r-   r.   Ú__doc__r_   rH   r]   r2   r*   r#   r!   ra   ra   _   s   † ñð €Eò$õr#   ra   c                   ó    • \ rS rSrS rS rSrg)ÚCUDACompileréw   c                 óÊ  • [         n[        S5      nUR                  U R                  5      nUR                  R                  UR                  5        UR                  U R                  5      nUR                  R                  UR                  5        U R                  U R                  5      nUR                  R                  UR                  5        UR                  5         U/$ )NÚcuda)	r   r   Údefine_untyped_pipeliner[   ÚpassesÚextendÚdefine_typed_pipelineÚdefine_cuda_lowering_pipelineÚfinalize)r9   ÚdpbÚpmÚuntyped_passesÚtyped_passesÚlowering_passess         r!   Údefine_pipelinesÚCUDACompiler.define_pipelinesx   s¥   € Ü ˆÜ˜Ó ˆà×4Ñ4°T·Z±ZÓ@ˆØ
�	‰	×Ñ˜×.Ñ.Ô/à×0Ñ0°·±Ó<ˆØ
�	‰	×Ñ˜×,Ñ,Ô-à×<Ñ<¸T¿Z¹ZÓHˆØ
�	‰	×Ñ˜×/Ñ/Ô0à
�‰ŒØˆtˆr#   c                 ó  • [        S5      nUR                  [        S5        UR                  [        S5        UR                  [        S5        UR                  [
        S5        UR                  [        S5        UR                  5         U$ )NÚcuda_loweringz$ensure IR is legal prior to loweringzannotate typeszcreate libraryznative loweringzcuda backend)r   Úadd_passr   r   ra   r   rC   ry   )r9   r[   r{   s      r!   rx   Ú*CUDACompiler.define_cuda_lowering_pipelineˆ   sh   € Ü˜Ó)ˆà
�‰”NØ:ô	<à
�‰”MÐ#3Ô4ð 	�‰”MÐ#3Ô4Ø
�‰”NÐ$5Ô6Ø
�‰”K Ô0à
�‰ŒØˆ	r#   r*   N)r+   r,   r-   r.   r   rx   r2   r*   r#   r!   rp   rp   w   s   † òõ r#   rp   Nc	                 ó2  • Uc  [        S5      eSSKJn	  U	R                  n
U	R                  n[        5       nSUl        SUl        SUl        U(       d  U(       a  SUl	        U(       a  SUl
        U(       a  SUl        OSUl        U(       a  SUl        U(       a  SUl        U(       a  X|l        XŒl        SSKJn  U" S	5         [$        R&                  " U
UU UUU0 [(        S
9nS S S 5        WR*                  nUR-                  5         U$ ! , (       d  f       N,= f)Nz#Compute Capability must be suppliedé   ©Úcuda_targetTÚpythonÚnumpyr   )Útarget_overriders   )rW   rX   ÚfuncrV   rU   rj   ÚlocalsÚpipeline_class)Ú
ValueErrorÚ
descriptorrˆ   rM   rN   r%   Ú
no_compileÚno_cpython_wrapperÚno_cfunc_wrapperÚ	debuginfoÚdbg_directives_onlyÚerror_modelÚforceinlineÚfastmathr/   r1   Únumba.core.target_extensionr‹   r	   Úcompile_extrarp   rQ   ry   )ÚpyfuncrU   rV   ÚdebugÚlineinfoÚinliner˜   r/   Úccrˆ   rW   rX   rj   r‹   ÚcresrQ   s                   r!   Úcompile_cudar¡   ˜   sü   € ð 
�zÜÐ>Ó?Ð?å'Ø×*Ñ*€IØ×*Ñ*€Iä‹K€Eà€EÔØ#€EÔØ!€EÔö –ØˆŒæØ$(ˆÔ!æØ$ˆÕà#ˆÔæØ ˆÔÞØˆŒÞØ)ÔØ!Ôõ <Ù	˜Õ	 Ü×%Ò%°	Ø09Ø+1Ø+/Ø2=Ø,1Ø-/Ü5AñCˆ÷ 
!ð �l‰l€GØ×ÑÔà€K÷ 
!Õ	 ús   Ã DÄ
Dc                 ó  • UR                   R                  UR                   S3UUS9nUR                  U5        UR                  nUR
                  n[        U 5      nUR                  Xv5      n	U R                  R                  UR
                  U5      n
U R                  S5      n[        R                  " XºUR                  5      n[        R                  " X¹U5      n[        R                  " UR                  S5      5      nU R                  U5      nUR!                  XíR"                  5      nU R                  R%                  XìXvU5      u  nnUR'                  U5        UR)                  U5        UR+                  5         U$ )zŽ
Wrap a Numba ABI function in a C ABI wrapper at the NVVM IR level.

The C ABI wrapper will have the same name as the source Python function.
Ú
_function_)Ú
entry_namer/   zcuda.cabi.wrapperÚ )rg   rc   rl   Úadd_linking_libraryÚargtypesÚrestyper   Úget_function_typeÚ	call_convÚcreate_moduler   ÚFunctionÚllvm_func_nameÚ	IRBuilderÚappend_basic_blockÚget_arg_packerÚfrom_argumentsrV   Úcall_functionÚretÚadd_ir_modulery   )ÚcontextÚlibrT   Úwrapper_function_namer/   rQ   r§   r¨   Úc_call_convÚwrapfntyÚfntyÚwrapper_modulerŒ   ÚwrapfnÚbuilderÚarginfoÚcallargsÚ_Úreturn_values                      r!   Úcabi_wrap_functionrÂ   Ó   sR  € ð �k‰k×(Ñ(¨C¯H©H¨:°ZÐ)@Ø4IØ6Bð )ð D€Gð ×Ñ Ô$ð �‰€HØ�n‰n€GÜ" 7Ó+€KØ×,Ñ,¨WÓ?€HØ×Ñ×.Ñ.¨v¯~©~¸xÓH€Dð ×*Ñ*Ð+>Ó?€NÜ�;Š;�~¨V×-BÑ-BÓC€Dô
 �[Š[˜Ð3HÓI€FÜ�lŠl˜6×4Ñ4°RÓ8Ó9€Gà×$Ñ$ XÓ.€GØ×%Ñ% g¯{©{Ó;€Hð ×'Ñ'×5Ñ5Ø�w¨(ó4�O€A€|à‡K�K�Ôà×Ñ˜.Ô)Ø×ÑÔØ€Nr#   c                 óà  • US;  a  [        SU 35      eUS:X  a  U(       d  [        S5      eU
S;  a  [        SU
 35      eU(       a  U(       a  Sn[        [        U5      5        U
S:H  nU	=(       d
    [        5       n	UU(       a  S	OS
S.nU(       a  SUS'   [        R
                  " U5      u  pïU=(       d    [        R                  n[        XXâX5XÖS9nUR                  R                  nU(       a&  U(       d  U[        R                  :w  a  [        S5      eUR                  nU(       aH  UR                  nUS:X  a5  U	R!                  SU R"                  5      n[%        UUUR&                  UU5      nOQU R(                  nUR*                  nUR,                  nUR/                  UR                  UR&                  UX=UU5      u  nnU(       a  UR1                  US9nUU4$ UR3                  US9nUU4$ )a#  Compile a Python function to PTX or LTO-IR for a given set of argument
types.

:param pyfunc: The Python function to compile.
:param sig: The signature representing the function's input and output
            types. If this is a tuple of argument types without a return
            type, the inferred return type is returned by this function. If
            a signature including a return type is passed, the compiled code
            will include a cast from the inferred return type to the
            specified return type, and this function will return the
            specified return type.
:param debug: Whether to include debug info in the compiled code.
:type debug: bool
:param lineinfo: Whether to include a line mapping from the compiled code
                 to the source code. Usually this is used with optimized
                 code (since debug mode would automatically include this),
                 so we want debug info in the LLVM IR but only the line
                 mapping in the final output.
:type lineinfo: bool
:param device: Whether to compile a device function.
:type device: bool
:param fastmath: Whether to enable fast math flags (ftz=1, prec_sqrt=0,
                 prec_div=, and fma=1)
:type fastmath: bool
:param cc: Compute capability to compile for, as a tuple
           ``(MAJOR, MINOR)``. Defaults to ``(5, 0)``.
:type cc: tuple
:param opt: Enable optimizations. Defaults to ``True``.
:type opt: bool
:param abi: The ABI for a compiled function - either ``"numba"`` or
            ``"c"``. Note that the Numba ABI is not considered stable.
            The C ABI is only supported for device functions at present.
:type abi: str
:param abi_info: A dict of ABI-specific options. The ``"c"`` ABI supports
                 one option, ``"abi_name"``, for providing the wrapper
                 function's name. The ``"numba"`` ABI has no options.
:type abi_info: dict
:param output: Type of output to generate, either ``"ptx"`` or ``"ltoir"``.
:type output: str
:return: (code, resty): The compiled code and inferred return type
:rtype: tuple
)ÚnumbaÚczUnsupported ABI: rÅ   z&The C ABI is not supported for kernels)ÚptxÚltoirzUnsupported output type: z{debug=True with opt=True (the default) is not supported by CUDA. This may result in a crash - set debug=False or opt=False.rÇ   é   r   )r˜   ÚoptNzgen-lto)rœ   r�   r˜   r/   rŸ   z'CUDA kernel must have void return type.Úabi_name)rŸ   )ÚNotImplementedErrorr   r   r   r
   Únormalize_signaturer   ÚCUDA_DEFAULT_PTX_CCr¡   rS   rU   r   ÚvoidÚ	TypeErrorrN   rQ   Úgetr+   rÂ   rT   Ú__code__Úco_filenameÚco_firstlinenoÚprepare_cuda_kernelÚ	get_ltoirÚget_asm_str)r›   Úsigrœ   r�   Údevicer˜   rŸ   rÉ   ÚabiÚabi_infoÚoutputÚmsgÚltor/   rV   rU   r    ÚrestyÚtgtr¶   Úwrapper_nameÚcodeÚfilenameÚlinenumÚkernels                            r!   Úcompilerå   ÿ   sÝ  € ð\ �.Ó Ü!Ð$5°c°UÐ";Ó<Ð<à
ˆcƒzž&Ü!Ð"JÓKÐKàÐ%Ó%Ü!Ð$=¸f¸XÐ"FÓGÐGæ–ð2ˆô 	Ô& sÓ+Ô,à�WÑ€CØ×!œ4›6€Hð Þ‰q˜Qñ€Lö
 Ø"&ˆ�YÑä ×4Ò4°SÓ9Ñ€Dà	×	)Œv×)Ñ)€BÜ˜¨TØ!)Ø%1ñ:€Dð �N‰N×&Ñ&€Eæ–V ¬¯©Ó 3ÜÐAÓBÐBà
×
Ñ
€CæØ�l‰lˆØ�#‹:Ø#Ÿ<™<¨
°F·O±OÓDˆLÜ$ S¨#¨t¯{©{¸LØ%1ó3ˆCøð �‰ˆØ×#Ñ#ˆØ×%Ñ%ˆà×-Ñ-¨d¯l©l¸D¿K¹KÈØ.6ÀhØ.5ó7‰ˆˆVö Ø�}‰} ˆ}Ð#ˆð �ˆ;Ðð �‰ "ˆÐ%ˆØ�ˆ;Ðr#   c
                 óF   • [        5       R                  n
[        XX#UXZXgX‰S9$ )zÃCompile a Python function to PTX or LTO-IR for a given signature for the
current device's compute capabilility. This calls :func:`compile` with an
appropriate ``cc`` value for the current device.©	rœ   r�   rØ   r˜   rŸ   rÉ   rÙ   rÚ   rÛ   )r   r1   rå   )r›   r×   rœ   r�   rØ   r˜   rÉ   rÙ   rÚ   rÛ   rŸ   s              r!   Úcompile_for_current_devicerè   j  s-   € ô 
Ó	×	0Ñ	0€BÜ�6 eÀvØ$°Ø$ñ5ð 5r#   c
                 ó    • [        XX#UXVXxU	SS9$ )zìCompile a Python function to PTX for a given signature. See
:func:`compile`. The defaults for this function are to compile a kernel
with the Numba ABI, rather than :func:`compile`'s default of compiling a
device function with the C ABI.rÆ   rç   )rå   )
r›   r×   rœ   r�   rØ   r˜   rŸ   rÉ   rÙ   rÚ   s
             r!   Úcompile_ptxrê   v  s!   € ô �6 eÀvØ$°Ø$¨Uñ4ð 4r#   c	                 óD   • [        5       R                  n	[        XX#XEX–XxS9
$ )z~Compile a Python function to PTX for a given signature for the current
device's compute capabilility. See :func:`compile_ptx`.)rœ   r�   rØ   r˜   rŸ   rÉ   rÙ   rÚ   )r   r1   rê   )
r›   r×   rœ   r�   rØ   r˜   rÉ   rÙ   rÚ   rŸ   s
             r!   Úcompile_ptx_for_current_devicerì   �  s+   € ô
 
Ó	×	0Ñ	0€BÜ�v¨%Ø$¸BØñ3ð 3r#   c                 ó.   • [        XU5      R                  $ r   )Ú declare_device_function_templateÚkey©rl   r¨   r§   s      r!   Údeclare_device_functionrñ   Œ  s   € Ü+¨D¸8ÓD×HÑHÐHr#   c                 ó$  ^^	• SSK Jn  UR                  nUR                  n[        R
                  " U/UQ76 m	[        U T	5      m " UU	4S jS[        5      n[        R                  " XUS9nUR                  TU5        UR                  TU5        U$ )Nr†   r‡   c                   ó$   >• \ rS rSr Y r Y/rSrg)ÚBdeclare_device_function_template.<locals>.device_function_templatei—  r*   N)r+   r,   r-   r.   rï   Úcasesr2   )Úextfnr×   s   €€r!   Údevice_function_templaterô   —  s   ø† ÙˆÙ�‹r#   r÷   rð   )r�   rˆ   rM   rN   r   rS   ÚExternFunctionr   r   ÚExternalFunctionDescriptorÚinsert_user_function)
rl   r¨   r§   rˆ   rW   rX   r÷   rT   rö   r×   s
           @@r!   rî   rî   �  s�   ù€ Ý'Ø×*Ñ*€IØ×*Ñ*€IÜ
×
Ò
˜7Ð
. XÒ
.€CÜ˜4 Ó%€E÷ð Ô#3ô ô ×0Ò0Ø¨Xñ7€Fà×"Ñ" 5Ð*BÔCØ×"Ñ" 5¨&Ô1à#Ð#r#   c                   ó   • \ rS rSrS rSrg)rø   i£  c                 ó   • Xl         X l        g r   ©rl   r×   )r9   rl   r×   s      r!   rH   ÚExternFunction.__init__¤  s   € ØŒ	Ø�r#   rý   N)r+   r,   r-   r.   rH   r2   r*   r#   r!   rø   rø   £  s   † õr#   rø   )FFFFNN)	FFTFNTrÅ   NrÆ   )FFTFTrÅ   NrÆ   )FFFFNTrÄ   N)FFFFTrÄ   N)5Úllvmliter   Únumba.core.typing.templatesr   Ú
numba.corer   r   r   r   r	   r
   Únumba.core.compilerr   r   r   r   r   r   Únumba.core.compiler_lockr   Únumba.core.compiler_machineryr   r   r   Únumba.core.errorsr   Únumba.core.typed_passesr   r   r   Úwarningsr   Únumba.cuda.apir   Únumba.cuda.targetr   r"   r%   r4   r?   rC   ra   rp   r¡   rÂ   rå   rè   rê   rì   rñ   rî   Úobjectrø   r*   r#   r!   Ú<module>r     sC  ðÝ Ý 8ß J× J÷0÷ 0õ :÷Gñ Gå 7÷4ñ 4å Ý -Ý .òô
�ô 
ô:˜ô ò(ñ
 ˜4¨uÑ5ô�,ó ó 6ðñ6 ˜5°Ñ6ô�Ló ó 7ðô.�<ô ðB ØBGØ<@Øó7ó ð7òt)ðX Ø=AØAEØógó ðgðT CHØ@DØ>Cô	5ð BGØIMô4ð GLØEIØ9=ô3òIò$ô&�Võ r#   