
    Iri6                        U d dl mZmZ d dlmZ  G d de          Z G d de          Z G d d          Z e            Z ed	e
          Z	ee         e
d	<   deddfdZ G d d          Z ee          Zdee         ddfdZdS )    )OptionalProtocol)
ContextVarc                       e Zd ZdefdZdS )Bufferreturnc                     d S N selfs    r/var/www/html/bestrading.cuttalo.com/models/btc_v9/venv/lib/python3.11/site-packages/triton/runtime/_allocation.pydata_ptrzBuffer.data_ptr           N)__name__
__module____qualname__intr   r   r   r   r   r      s/        #      r   r   c                   2    e Zd Zdededee         defdZdS )	Allocatorsize	alignmentstreamr   c                     d S r
   r   r   r   r   r   s       r   __call__zAllocator.__call__   r   r   Nr   r   r   r   r   r   r   r   r   r   r   r      sH        S S (3- F      r   r   c                   2    e Zd Zdededee         defdZdS )NullAllocatorr   r   r   r   c                      t          d          )NzxKernel requires a runtime memory allocation, but no allocator was set. Use triton.set_allocator to specify an allocator.)RuntimeErrorr   s       r   r   zNullAllocator.__call__   s     O P P 	Pr   Nr   r   r   r   r    r       sR        PS PS P(3- PF P P P P P Pr   r    
_allocator)default	allocatorr   Nc                 :    t                               |            dS )z
    The allocator function is called during kernel launch for kernels that
    require additional global memory workspace.
    N)r#   setr%   s    r   set_allocatorr)      s    
 NN9r   c                   b    e Zd ZdZdeddfdZdefdZdeddfdZded	ed
e	e         de
fdZdS )_AllocatorWrapperz
    Wrapper to provide ContextVar-like .get()/.set() methods. profile_allocator is
    used in same way as allocator so it is useful to maintain the interface.
    r%   r   Nc                     || _         d S r
   r#   r   r%   s     r   __init__z_AllocatorWrapper.__init__+       #r   c                     | j         S r
   r-   r   s    r   getz_AllocatorWrapper.get.   s
    r   c                     || _         d S r
   r-   r.   s     r   r'   z_AllocatorWrapper.set1   r0   r   r   r   r   c                 0    |                      |||          S r
   r-   r   s       r   r   z_AllocatorWrapper.__call__4   s    tY777r   )r   r   r   __doc__r   r/   r2   r'   r   r   r   r   r   r   r   r+   r+   %   s         
$) $ $ $ $ $Y    $Y $4 $ $ $ $8S 8S 8(3- 8F 8 8 8 8 8 8r   r+   c                 L    t                               | | nt                     dS )z
    The profile allocator function is called before kernel launch for kernels
    that require additional global memory workspace.
    N)_profile_allocatorr'   _NULL_ALLOCATORr(   s    r   set_profile_allocatorr9   ;   s'    
 	(=99?SSSSSr   )typingr   r   contextvarsr   r   r   r    r8   r#   __annotations__r)   r+   r7   r9   r   r   r   <module>r=      s}   % % % % % % % % % " " " " " "    X          P P P P P P P P  -//$.J|_$U$U$U
Jy! U U UY 4    8 8 8 8 8 8 8 8& '&77 TXi%8 TT T T T T T Tr   