ó
    „ñ:i_  ã                   ó$  • S SK Jr  S SKJrJr  S SKJr  S SKJrJ	r	  S SK
Jr  S SKJr  S SKJr  S SKJr  S	 r\S
 5       r\S 5       r\S 5       r\" \R,                  " \5      SSS9S 5       r\S 5       rS r\S 5       r\S 5       r\S 5       rg)é    )Úir)ÚcudaÚtypes)Úcgutils)ÚRequireLiteralValueÚNumbaValueError)Ú	signature)Úoverload_attribute)Ú	nvvmutils)Ú	intrinsicc                 óê   • U R                   nUS:X  a  [        R                  nO7US;   a&  [        R                  " [        R                  U5      nO[	        S5      e[        U[        R                  5      $ )Né   )é   é   zargument can only be 1, 2, 3)Úliteral_valuer   Úint64ÚUniTupler   r	   Úint32)ÚndimÚvalÚrestypes      ÚX/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/numba/cuda/intrinsics.pyÚ_type_grid_functionr      sU   € Ø
×
Ñ
€CØ
ˆaƒxÜ—+‘+‰Ø	�‹Ü—.’.¤§¡¨cÓ2‰äÐ<Ó=Ð=ä�WœeŸk™kÓ*Ð*ó    c                 óx   • [        U[        R                  5      (       d  [        U5      e[	        U5      nS nX#4$ )aô  grid(ndim)

Return the absolute position of the current thread in the entire grid of
blocks.  *ndim* should correspond to the number of dimensions declared when
instantiating the kernel. If *ndim* is 1, a single integer is returned.
If *ndim* is 2 or 3, a tuple of the given number of integers is returned.

Computation of the first integer is as follows::

    cuda.threadIdx.x + cuda.blockIdx.x * cuda.blockDim.x

and is similar for the other two indices, but using the ``y`` and ``z``
attributes.
c                 ó  • UR                   nU[        R                  :X  a  [        R                  " USS9$ [        U[        R                  5      (       a4  [        R                  " XR                  S9n[        R                  " X5      $ g )Nr   )Údim)
Úreturn_typer   r   r   Úget_global_idÚ
isinstancer   Úcountr   Ú
pack_array)ÚcontextÚbuilderÚsigÚargsr   Úidss         r   ÚcodegenÚgrid.<locals>.codegen1   se   € Ø—/‘/ˆØ”e—k‘kÓ!Ü×*Ò*¨7¸Ñ:Ð:Ü˜¤§¡×0Ñ0Ü×)Ò)¨'·}±}ÑEˆCÜ×%Ò% gÓ3Ð3ð 1r   ©r    r   ÚIntegerLiteralr   r   )Ú	typingctxr   r%   r(   s       r   Úgridr-      s;   € ô" �dœE×0Ñ0×1Ñ1Ü! $Ó'Ð'ä
˜dÓ
#€Cò4ð ˆ<Ðr   c                 ó†   ^• [        U[        R                  5      (       d  [        U5      e[	        U5      nS mU4S jnX#4$ )aß  gridsize(ndim)

Return the absolute size (or shape) in threads of the entire grid of
blocks. *ndim* should correspond to the number of dimensions declared when
instantiating the kernel. If *ndim* is 1, a single integer is returned.
If *ndim* is 2 or 3, a tuple of the given number of integers is returned.

Computation of the first integer is as follows::

    cuda.blockDim.x * cuda.gridDim.x

and is similar for the other two indices, but using the ``y`` and ``z``
attributes.
c                 óö   • [         R                  " S5      n[        R                  " U SU 35      n[        R                  " U SU 35      nU R	                  U R                  X25      U R                  XB5      5      $ )Né@   zntid.znctaid.)r   ÚIntTyper   Ú	call_sregÚmulÚsext)r$   r   Úi64ÚntidÚnctaids        r   Ú_nthreads_for_dimÚ#gridsize.<locals>._nthreads_for_dimR   sb   € Ü�jŠj˜‹nˆÜ×"Ò" 7¨e°C°5¨MÓ:ˆÜ×$Ò$ W°¸°u¨oÓ>ˆØ�{‰{˜7Ÿ<™<¨Ó2°G·L±LÀÓ4MÓNÐNr   c                 ó`  >• UR                   nT" US5      nU[        R                  :X  a  U$ [        U[        R                  5      (       ac  T" US5      nUR
                  S:X  a  [        R                  " XU45      $ UR
                  S:X  a!  T" US5      n[        R                  " XXg45      $ g g )NÚxÚyr   r   Úz)r   r   r   r    r   r!   r   r"   )	r#   r$   r%   r&   r   ÚnxÚnyÚnzr8   s	           €r   r(   Úgridsize.<locals>.codegenX   sž   ø€ Ø—/‘/ˆÙ˜w¨Ó,ˆà”e—k‘kÓ!ØˆIÜ˜¤§¡×0Ñ0Ù" 7¨CÓ0ˆBà�}‰} Ó!Ü×)Ò)¨'¸°8Ó<Ð<Ø—‘ !Ó#Ù& w°Ó4�Ü×)Ò)¨'¸°<Ó@Ð@ð $ð 1r   r*   )r,   r   r%   r(   r8   s       @r   ÚgridsizerB   <   sC   ø€ ô" �dœE×0Ñ0×1Ñ1Ü! $Ó'Ð'ä
˜dÓ
#€CòOõAð ˆ<Ðr   c                 ó@   • [        [        R                  5      nS nX4$ )Nc                 ó0   • [         R                  " US5      $ )NÚwarpsize)r   r2   )r#   r$   r%   r&   s       r   r(   Ú_warpsize.<locals>.codegenn   s   € Ü×"Ò" 7¨JÓ7Ð7r   )r	   r   r   ©r,   r%   r(   s      r   Ú	_warpsizerH   j   s   € ä
”E—K‘KÓ
 €Cò8ð ˆ<Ðr   rE   r   )Útargetc                 ó   • S nU$ )zS
The size of a warp. All architectures implemented to date have a warp size
of 32.
c                 ó   • [        5       $ )N)rH   )Úmods    r   ÚgetÚcuda_warpsize.<locals>.getz   s
   € Ü‹{Ðr   © )rL   rM   s     r   Úcuda_warpsizerP   t   s   € òà€Jr   c                 ó@   • [        [        R                  5      nS nX4$ )a  
Synchronize all threads in the same thread block.  This function implements
the same pattern as barriers in traditional multi-threaded programming: this
function waits until all threads in the block call it, at which point it
returns control to all its callers.
c                 óä   • SnUR                   n[        R                  " [        R                  " 5       S5      n[        R
                  " XVU5      nUR                  US5        U R                  5       $ )Nzllvm.nvvm.barrier0rO   )Úmoduler   ÚFunctionTypeÚVoidTyper   Úget_or_insert_functionÚcallÚget_dummy_value)r#   r$   r%   r&   ÚfnameÚlmodÚfntyÚsyncs           r   r(   Úsyncthreads.<locals>.codegenŒ   sU   € Ø$ˆØ�~‰~ˆÜ�ŠœrŸ{š{›}¨bÓ1ˆÜ×-Ò-¨d¸%Ó@ˆØ�‰�T˜2ÔØ×&Ñ&Ó(Ð(r   )r	   r   ÚnonerG   s      r   Úsyncthreadsr_   ‚   s!   € ô ”E—J‘JÓ
€Cò)ð ˆ<Ðr   c                 ó¦   ^• [        U[        R                  5      (       d  g [        [        R                  [        R                  5      nU4S jnX44$ )Nc                 óê   >• [         R                  " [         R                  " S5      [         R                  " S5      45      n[        R                  " UR
                  UT5      nUR                  XS5      $ )Né    )r   rT   r1   r   rV   rS   rW   )r#   r$   r%   r&   r[   r\   rY   s         €r   r(   Ú'_syncthreads_predicate.<locals>.codegen�   sM   ø€ Ü�ŠœrŸzšz¨"›~´·
²
¸2³Ð/@ÓAˆÜ×-Ò-¨g¯n©n¸dÀEÓJˆØ�|‰|˜DÓ'Ð'r   )r    r   ÚIntegerr	   Úi4)r,   Ú	predicaterY   r%   r(   s     `  r   Ú_syncthreads_predicaterg   —   s:   ø€ Ü�i¤§¡×/Ñ/Øä
”E—H‘HœeŸh™hÓ
'€Cõ(ð
 ˆ<Ðr   c                 ó   • Sn[        XU5      $ )z�
syncthreads_count(predicate)

An extension to numba.cuda.syncthreads where the return value is a count
of the threads where predicate is true.
zllvm.nvvm.barrier0.popc©rg   ©r,   rf   rY   s      r   Úsyncthreads_countrk   ¥   s   € ð &€EÜ! )¸Ó>Ð>r   c                 ó   • Sn[        XU5      $ )z�
syncthreads_and(predicate)

An extension to numba.cuda.syncthreads where 1 is returned if predicate is
true for all threads or 0 otherwise.
zllvm.nvvm.barrier0.andri   rj   s      r   Úsyncthreads_andrm   ±   s   € ð %€EÜ! )¸Ó>Ð>r   c                 ó   • Sn[        XU5      $ )z‹
syncthreads_or(predicate)

An extension to numba.cuda.syncthreads where 1 is returned if predicate is
true for any thread or 0 otherwise.
zllvm.nvvm.barrier0.orri   rj   s      r   Úsyncthreads_orro   ½   s   € ð $€EÜ! )¸Ó>Ð>r   N)Úllvmliter   Únumbar   r   Ú
numba.corer   Únumba.core.errorsr   r   Únumba.core.typingr	   Únumba.core.extendingr
   Ú
numba.cudar   Únumba.cuda.extendingr   r   r-   rB   rH   ÚModulerP   r_   rg   rk   rm   ro   rO   r   r   Ú<module>ry      sÜ   ðÝ ç Ý ß BÝ 'Ý 3Ý  Ý *ò	+ð ñó ðð@ ñ*ó ð*ðZ ñó ðñ �E—L’L Ó&¨
¸6ÑBñó Cðð ñó ðò(ð ñ?ó ð?ð ñ?ó ð?ð ñ?ó ñ?r   