
    J/PhW                        d Z ddlZddlmZ ddlZddlZddlmZm	Z	  G d de
          Zd Z G d d	e          Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d  d!e          Z G d" d#e          Z G d$ d%e          Z G d& d'e          Z G d( d)e          Z G d* d+e          Z G d, d-e          Z G d. d/e          Z  G d0 d1e          Z! G d2 d3e          Z" G d4 d5e          Z# G d6 d7e          Z$ G d8 d9e          Z% G d: d;e          Z& G d< d=e          Z' G d> d?e          Z( G d@ dAe          Z) G dB dCe          Z*dD Z+dE Z, e+            Z- e,e-           dS )Fz1
This scripts specifies all PTX special objects.
    N)defaultdict)	Signature	Parameterc                   &    e Zd ZdZdZdZd Zd ZdS )Stubzr
    A stub object to represent special objects that are meaningless
    outside the context of a CUDA kernel
    z<ptx special value> c                 &    t          d| z            )Nz%s is not instantiableNotImplementedError)clss    P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/cuda/stubs.py__new__zStub.__new__   s    !":S"@AAA    c                     | j         S N)_description_selfs    r   __repr__zStub.__repr__   s    !!r   N)__name__
__module____qualname____doc__r   	__slots__r   r   r   r   r   r   r      sK          *MIB B B" " " " "r   r   c                 F     t          j                    fd            }|S )zv
    A stub function to represent special functions that are meaningless
    outside the context of a CUDA kernel
    c                  (    t          dz            )Nz"%s cannot be called from host coder
   )argskwargsfns     r   wrappedzstub_function.<locals>.wrapped   s    !"F"KLLLr   )	functoolswraps)r   r    s   ` r   stub_functionr#      s=    
 _RM M M M MNr   c                   X    e Zd ZdZdZed             Zed             Zed             ZdS )Dim3zA triple, (x, y, z)z<Dim3>c                     d S r   r   r   s    r   xzDim3.x-       r   c                     d S r   r   r   s    r   yzDim3.y1   r(   r   c                     d S r   r   r   s    r   zzDim3.z5   r(   r   N)	r   r   r   r   r   propertyr'   r*   r,   r   r   r   r%   r%   )   sn        M  X   X   X  r   r%   c                       e Zd ZdZdZdS )	threadIdxz
    The thread indices in the current thread block. Each index is an integer
    spanning the range from 0 inclusive to the corresponding value of the
    attribute in :attr:`numba.cuda.blockDim` exclusive.
    z<threadIdx.{x,y,z}>Nr   r   r   r   r   r   r   r   r/   r/   :   s         
 *MMMr   r/   c                       e Zd ZdZdZdS )blockIdxz
    The block indices in the grid of thread blocks. Each index is an integer
    spanning the range from 0 inclusive to the corresponding value of the
    attribute in :attr:`numba.cuda.gridDim` exclusive.
    z<blockIdx.{x,y,z}>Nr0   r   r   r   r2   r2   C            
 )MMMr   r2   c                       e Zd ZdZdZdS )blockDimz
    The shape of a block of threads, as declared when instantiating the kernel.
    This value is the same for all threads in a given kernel launch, even if
    they belong to different blocks (i.e. each block is "full").
    z<blockDim.{x,y,z}>Nr0   r   r   r   r5   r5   L   r3   r   r5   c                       e Zd ZdZdZdS )gridDimzo
    The shape of the grid of blocks. This value is the same for all threads in
    a given kernel launch.
    z<gridDim.{x,y,z}>Nr0   r   r   r   r7   r7   U   s          (MMMr   r7   c                       e Zd ZdZdZdS )warpsizez_
    The size of a warp. All architectures implemented to date have a warp size
    of 32.
    z
<warpsize>Nr0   r   r   r   r9   r9   ]   s          !MMMr   r9   c                       e Zd ZdZdZdS )laneidza
    This thread's lane within a warp. Ranges from 0 to
    :attr:`numba.cuda.warpsize` - 1.
    z<laneid>Nr0   r   r   r   r;   r;   e   s          MMMr   r;   c                   ,    e Zd ZdZdZed             ZdS )sharedz!
    Shared memory namespace
    z<shared>c                     dS )a  
        Allocate a shared array of the given *shape* and *type*. *shape* is
        either an integer or a tuple of integers representing the array's
        dimensions.  *type* is a :ref:`Numba type <numba-types>` of the
        elements needing to be stored in the array.

        The returned array-like object can be read and written to like any
        normal device array (e.g. through indexing).
        Nr   shapedtypes     r   arrayzshared.arrayv         r   Nr   r   r   r   r   r#   rB   r   r   r   r=   r=   p   s>          M	 	 ]	 	 	r   r=   c                   ,    e Zd ZdZdZed             ZdS )localz 
    Local memory namespace
    z<local>c                     dS )a  
        Allocate a local array of the given *shape* and *type*. The array is
        private to the current thread, and resides in global memory. An
        array-like object is returned which can be read and written to like any
        standard array (e.g.  through indexing).
        Nr   r?   s     r   rB   zlocal.array   rC   r   NrD   r   r   r   rF   rF      s>          M  ]  r   rF   c                   (    e Zd ZdZed             ZdS )constz#
    Constant memory namespace
    c                     dS )z
        Create a const array from *ndarry*. The resulting const array will have
        the same shape, type, and values as *ndarray*.
        Nr   )ndarrays    r   
array_likezconst.array_like   rC   r   N)r   r   r   r   r#   rL   r   r   r   rI   rI      s9            ]  r   rI   c                       e Zd ZdZdZdS )syncwarpz[
    syncwarp(mask=0xFFFFFFFF)

    Synchronizes a masked subset of threads in a warp.
    z<warp_sync()>Nr0   r   r   r   rN   rN      s         
 $MMMr   rN   c                       e Zd ZdZdZdS )shfl_sync_intrinsicz
    shfl_sync_intrinsic(mask, mode, value, mode_offset, clamp)

    Nvvm intrinsic for shuffling data across a warp
    docs.nvidia.com/cuda/nvvm-ir-spec/index.html#nvvm-intrin-warp-level-datamove
    z<shfl_sync()>Nr0   r   r   r   rP   rP                $MMMr   rP   c                       e Zd ZdZdZdS )vote_sync_intrinsicz
    vote_sync_intrinsic(mask, mode, predictate)

    Nvvm intrinsic for performing a reduce and broadcast across a warp
    docs.nvidia.com/cuda/nvvm-ir-spec/index.html#nvvm-intrin-warp-level-vote
    z<vote_sync()>Nr0   r   r   r   rS   rS      rQ   r   rS   c                       e Zd ZdZdZdS )match_any_syncz
    match_any_sync(mask, value)

    Nvvm intrinsic for performing a compare and broadcast across a warp.
    Returns a mask of threads that have same value as the given value from
    within the masked warp.
    z<match_any_sync()>Nr0   r   r   r   rU   rU      s          )MMMr   rU   c                       e Zd ZdZdZdS )match_all_synca  
    match_all_sync(mask, value)

    Nvvm intrinsic for performing a compare and broadcast across a warp.
    Returns a tuple of (mask, pred), where mask is a mask of threads that have
    same value as the given value from within the masked warp, if they
    all have the same value, otherwise it is 0. Pred is a boolean of whether
    or not all threads in the mask warp have the same warp.
    z<match_all_sync()>Nr0   r   r   r   rW   rW      s          )MMMr   rW   c                       e Zd ZdZdZdS )
activemaskaY  
    activemask()

    Returns a 32-bit integer mask of all currently active threads in the
    calling warp. The Nth bit is set if the Nth lane in the warp is active when
    activemask() is called. Inactive threads are represented by 0 bits in the
    returned mask. Threads which have exited the kernel are always marked as
    inactive.
    z<activemask()>Nr0   r   r   r   rY   rY      s          %MMMr   rY   c                       e Zd ZdZdZdS )lanemask_ltz
    lanemask_lt()

    Returns a 32-bit integer mask of all lanes (including inactive ones) with
    ID less than the current lane.
    z<lanemask_lt()>Nr0   r   r   r   r[   r[      s          &MMMr   r[   c                       e Zd ZdZdZdS )threadfence_blockz.
    A memory fence at thread block level
    z<threadfence_block()>Nr0   r   r   r   r]   r]      s          ,MMMr   r]   c                       e Zd ZdZdZdS )threadfence_systemz8
    A memory fence at system level: across devices
    z<threadfence_system()>Nr0   r   r   r   r_   r_      s          -MMMr   r_   c                       e Zd ZdZdZdS )threadfencez(
    A memory fence at device level
    z<threadfence()>Nr0   r   r   r   ra   ra      s          &MMMr   ra   c                       e Zd ZdZdS )popcz;
    popc(x)

    Returns the number of set bits in x.
    Nr   r   r   r   r   r   r   rc   rc   
             r   rc   c                       e Zd ZdZdS )brevzs
    brev(x)

    Returns the reverse of the bit pattern of x. For example, 0b10110110
    becomes 0b01101101.
    Nrd   r   r   r   rg   rg                r   rg   c                       e Zd ZdZdS )clzz?
    clz(x)

    Returns the number of leading zeros in z.
    Nrd   r   r   r   rj   rj     re   r   rj   c                       e Zd ZdZdS )ffsz
    ffs(x)

    Returns the position of the first (least significant) bit set to 1 in x,
    where the least significant bit position is 1. ffs(0) returns 0.
    Nrd   r   r   r   rl   rl   #  rh   r   rl   c                       e Zd ZdZdS )selpzt
    selp(a, b, c)

    Select between source operands, based on the value of the predicate source
    operand.
    Nrd   r   r   r   rn   rn   /  rh   r   rn   c                       e Zd ZdZdS )fmazE
    fma(a, b, c)

    Perform the fused multiply-add operation.
    Nrd   r   r   r   rp   rp   ;  re   r   rp   c                       e Zd ZdZdS )cbrtz8"
    cbrt(a)

    Perform the cube root operation.
    Nrd   r   r   r   rr   rr   C  re   r   rr   c                      e Zd ZdZdZ G d de          Z G d de          Z G d de          Z G d	 d
e          Z	 G d de          Z
 G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS ) atomicz$Namespace for atomic operations
    z<atomic>c                       e Zd ZdZdS )
atomic.addzadd(ary, idx, val)

        Perform atomic ``ary[idx] += val``. Supported on int32, float32, and
        float64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   addrv   S          	 	 	 	r   rw   c                       e Zd ZdZdS )
atomic.subzsub(ary, idx, val)

        Perform atomic ``ary[idx] -= val``. Supported on int32, float32, and
        float64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   subrz   ]  rx   r   r{   c                       e Zd ZdZdS )atomic.and_zand_(ary, idx, val)

        Perform atomic ``ary[idx] &= val``. Supported on int32, int64, uint32
        and uint64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   and_r}   g  rx   r   r~   c                       e Zd ZdZdS )
atomic.or_zor_(ary, idx, val)

        Perform atomic ``ary[idx] |= val``. Supported on int32, int64, uint32
        and uint64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   or_r   q  rx   r   r   c                       e Zd ZdZdS )
atomic.xorzxor(ary, idx, val)

        Perform atomic ``ary[idx] ^= val``. Supported on int32, int64, uint32
        and uint64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   xorr   {  rx   r   r   c                       e Zd ZdZdS )
atomic.inczinc(ary, idx, val)

        Perform atomic ``ary[idx] += 1`` up to val, then reset to 0. Supported
        on uint32, and uint64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   incr     rx   r   r   c                       e Zd ZdZdS )
atomic.deca:  dec(ary, idx, val)

        Performs::

           ary[idx] = (value if (array[idx] == 0) or
                       (array[idx] > value) else array[idx] - 1)

        Supported on uint32, and uint64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   decr     s        	 	 	 	r   r   c                       e Zd ZdZdS )atomic.exchzexch(ary, idx, val)

        Perform atomic ``ary[idx] = val``. Supported on int32, int64, uint32 and
        uint64 operands only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   exchr     rx   r   r   c                       e Zd ZdZdS )
atomic.maxa  max(ary, idx, val)

        Perform atomic ``ary[idx] = max(ary[idx], val)``.

        Supported on int32, int64, uint32, uint64, float32, float64 operands
        only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   maxr             		 		 		 		r   r   c                       e Zd ZdZdS )
atomic.mina  min(ary, idx, val)

        Perform atomic ``ary[idx] = min(ary[idx], val)``.

        Supported on int32, int64, uint32, uint64, float32, float64 operands
        only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   minr     r   r   r   c                       e Zd ZdZdS )atomic.nanmaxa~  nanmax(ary, idx, val)

        Perform atomic ``ary[idx] = max(ary[idx], val)``.

        NOTE: NaN is treated as a missing value such that:
        nanmax(NaN, n) == n, nanmax(n, NaN) == n

        Supported on int32, int64, uint32, uint64, float32, float64 operands
        only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   nanmaxr             	 	 	 	r   r   c                       e Zd ZdZdS )atomic.nanmina  nanmin(ary, idx, val)

        Perform atomic ``ary[idx] = min(ary[idx], val)``.

        NOTE: NaN is treated as a missing value, such that:
        nanmin(NaN, n) == n, nanmin(n, NaN) == n

        Supported on int32, int64, uint32, uint64, float32, float64 operands
        only.

        Returns the old value at the index location as if it is loaded
        atomically.
        Nrd   r   r   r   nanminr     r   r   r   c                       e Zd ZdZdS )atomic.compare_and_swapa(  compare_and_swap(ary, old, val)

        Conditionally assign ``val`` to the first element of an 1D array ``ary``
        if the current value matches ``old``.

        Supported on int32, int64, uint32, uint64 operands only.

        Returns the old value as if it is loaded atomically.
        Nrd   r   r   r   compare_and_swapr             	 	 	 	r   r   c                       e Zd ZdZdS )
atomic.casa/  cas(ary, idx, old, val)

        Conditionally assign ``val`` to the element ``idx`` of an array
        ``ary`` if the current value of ``ary[idx]`` matches ``old``.

        Supported on int32, int64, uint32, uint64 operands only.

        Returns the old value as if it is loaded atomically.
        Nrd   r   r   r   casr     r   r   r   N)r   r   r   r   r   r   rw   r{   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rt   rt   N  so        M    d       d       t       d       d       d       d       t   
 
 
 
 
d 
 
 

 
 
 
 
d 
 
 
              	 	 	 	 	4 	 	 		 	 	 	 	d 	 	 	 	 	r   rt   c                       e Zd ZdZdZdS )	nanosleepz
    nanosleep(ns)

    Suspends the thread for a sleep duration approximately close to the delay
    `ns`, specified in nanoseconds.
    z<nansleep()>Nr0   r   r   r   r   r     s          #MMMr   r   c                   ^   e Zd ZdZdZ G d de          Z G d de          Z G d de          Z G d	 d
e          Z	 G d de          Z
 G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z G d% d&e          Z G d' d(e          Z G d) d*e          Z G d+ d,e          Z G d- d.e          Z G d/ d0e          Z G d1 d2e          Z G d3 d4e          Z G d5 d6e          Z G d7 d8e          Z  G d9 d:e          Z! G d; d<e          Z" G d= d>e          Z#d?S )@fp16z"Namespace for fp16 operations
    z<fp16>c                       e Zd ZdZdS )	fp16.haddzhadd(a, b)

        Perform fp16 addition, (a + b) in round to nearest mode. Supported
        on fp16 operands only.

        Returns the fp16 result of the addition.

        Nrd   r   r   r   haddr   	  rx   r   r   c                       e Zd ZdZdS )	fp16.hsubzhsub(a, b)

        Perform fp16 subtraction, (a - b) in round to nearest mode. Supported
        on fp16 operands only.

        Returns the fp16 result of the subtraction.

        Nrd   r   r   r   hsubr     rx   r   r   c                       e Zd ZdZdS )	fp16.hmulzhmul(a, b)

        Perform fp16 multiplication, (a * b) in round to nearest mode. Supported
        on fp16 operands only.

        Returns the fp16 result of the multiplication.

        Nrd   r   r   r   hmulr     rx   r   r   c                       e Zd ZdZdS )	fp16.hdivzhdiv(a, b)

        Perform fp16 division, (a / b) in round to nearest mode. Supported
        on fp16 operands only.

        Returns the fp16 result of the division

        Nrd   r   r   r   hdivr   '  rx   r   r   c                       e Zd ZdZdS )	fp16.hfmazhfma(a, b, c)

        Perform fp16 multiply and accumulate, (a * b) + c in round to nearest
        mode. Supported on fp16 operands only.

        Returns the fp16 result of the multiplication.

        Nrd   r   r   r   hfmar   1  rx   r   r   c                       e Zd ZdZdS )	fp16.hnegzhneg(a)

        Perform fp16 negation, -(a). Supported on fp16 operands only.

        Returns the fp16 result of the negation.

        Nrd   r   r   r   hnegr   ;          	 	 	 	r   r   c                       e Zd ZdZdS )	fp16.habszhabs(a)

        Perform fp16 absolute value, |a|. Supported on fp16 operands only.

        Returns the fp16 result of the absolute value.

        Nrd   r   r   r   habsr   D  r   r   r   c                       e Zd ZdZdS )	fp16.hsinzhsin(a)

        Calculate sine in round to nearest even mode. Supported on fp16
        operands only.

        Returns the sine result.

        Nrd   r   r   r   hsinr   M  rx   r   r   c                       e Zd ZdZdS )	fp16.hcoszhsin(a)

        Calculate cosine in round to nearest even mode. Supported on fp16
        operands only.

        Returns the cosine result.

        Nrd   r   r   r   hcosr   W  rx   r   r   c                       e Zd ZdZdS )	fp16.hlogzhlog(a)

        Calculate natural logarithm in round to nearest even mode. Supported
        on fp16 operands only.

        Returns the natural logarithm result.

        Nrd   r   r   r   hlogr   a  rx   r   r   c                       e Zd ZdZdS )fp16.hlog10zhlog10(a)

        Calculate logarithm base 10 in round to nearest even mode. Supported
        on fp16 operands only.

        Returns the logarithm base 10 result.

        Nrd   r   r   r   hlog10r   k  rx   r   r   c                       e Zd ZdZdS )
fp16.hlog2zhlog2(a)

        Calculate logarithm base 2 in round to nearest even mode. Supported
        on fp16 operands only.

        Returns the logarithm base 2 result.

        Nrd   r   r   r   hlog2r   u  rx   r   r   c                       e Zd ZdZdS )	fp16.hexpzhexp(a)

        Calculate natural exponential, exp(a), in round to nearest mode.
        Supported on fp16 operands only.

        Returns the natural exponential result.

        Nrd   r   r   r   hexpr     rx   r   r   c                       e Zd ZdZdS )fp16.hexp10zhexp10(a)

        Calculate exponential base 10 (10 ** a) in round to nearest mode.
        Supported on fp16 operands only.

        Returns the exponential base 10 result.

        Nrd   r   r   r   hexp10r     rx   r   r   c                       e Zd ZdZdS )
fp16.hexp2zhexp2(a)

        Calculate exponential base 2 (2 ** a) in round to nearest mode.
        Supported on fp16 operands only.

        Returns the exponential base 2 result.

        Nrd   r   r   r   hexp2r     rx   r   r   c                       e Zd ZdZdS )fp16.hfloorzhfloor(a)

        Calculate the floor, the largest integer less than or equal to 'a'.
        Supported on fp16 operands only.

        Returns the floor result.

        Nrd   r   r   r   hfloorr     rx   r   r   c                       e Zd ZdZdS )
fp16.hceilzhceil(a)

        Calculate the ceil, the smallest integer greater than or equal to 'a'.
        Supported on fp16 operands only.

        Returns the ceil result.

        Nrd   r   r   r   hceilr     rx   r   r   c                       e Zd ZdZdS )
fp16.hsqrtzhsqrt(a)

        Calculate the square root of the input argument in round to nearest
        mode. Supported on fp16 operands only.

        Returns the square root result.

        Nrd   r   r   r   hsqrtr     rx   r   r   c                       e Zd ZdZdS )fp16.hrsqrtzhrsqrt(a)

        Calculate the reciprocal square root of the input argument in round
        to nearest even mode. Supported on fp16 operands only.

        Returns the reciprocal square root result.

        Nrd   r   r   r   hrsqrtr     rx   r   r   c                       e Zd ZdZdS )	fp16.hrcpzhrcp(a)

        Calculate the reciprocal of the input argument in round to nearest
        even mode. Supported on fp16 operands only.

        Returns the reciprocal result.

        Nrd   r   r   r   hrcpr     rx   r   r   c                       e Zd ZdZdS )
fp16.hrintzhrint(a)

        Round the input argument to nearest integer value. Supported on fp16
        operands only.

        Returns the rounded result.

        Nrd   r   r   r   hrintr     rx   r   r   c                       e Zd ZdZdS )fp16.htrunczhtrunc(a)

        Truncate the input argument to its integer portion. Supported
        on fp16 operands only.

        Returns the truncated result.

        Nrd   r   r   r   htruncr     rx   r   r   c                       e Zd ZdZdS )fp16.heqzheq(a, b)

        Perform fp16 comparison, (a == b). Supported
        on fp16 operands only.

        Returns True if a and b are equal and False otherwise.

        Nrd   r   r   r   heqr     rx   r   r   c                       e Zd ZdZdS )fp16.hnezhne(a, b)

        Perform fp16 comparison, (a != b). Supported
        on fp16 operands only.

        Returns True if a and b are not equal and False otherwise.

        Nrd   r   r   r   hner     rx   r   r   c                       e Zd ZdZdS )fp16.hgezhge(a, b)

        Perform fp16 comparison, (a >= b). Supported
        on fp16 operands only.

        Returns True if a is >= b and False otherwise.

        Nrd   r   r   r   hger     rx   r   r   c                       e Zd ZdZdS )fp16.hgtzhgt(a, b)

        Perform fp16 comparison, (a > b). Supported
        on fp16 operands only.

        Returns True if a is > b and False otherwise.

        Nrd   r   r   r   hgtr     rx   r   r   c                       e Zd ZdZdS )fp16.hlezhle(a, b)

        Perform fp16 comparison, (a <= b). Supported
        on fp16 operands only.

        Returns True if a is <= b and False otherwise.

        Nrd   r   r   r   hler     rx   r   r   c                       e Zd ZdZdS )fp16.hltzhlt(a, b)

        Perform fp16 comparison, (a < b). Supported
        on fp16 operands only.

        Returns True if a is < b and False otherwise.

        Nrd   r   r   r   hltr     rx   r   r   c                       e Zd ZdZdS )	fp16.hmaxzhmax(a, b)

        Perform fp16 maximum operation, max(a,b) Supported
        on fp16 operands only.

        Returns a if a is greater than b, returns b otherwise.

        Nrd   r   r   r   hmaxr     rx   r   r   c                       e Zd ZdZdS )	fp16.hminzhmin(a, b)

        Perform fp16 minimum operation, min(a,b). Supported
        on fp16 operands only.

        Returns a if a is less than b, returns b otherwise.

        Nrd   r   r   r   hminr   )  rx   r   r  N)$r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r     s        M    t       t       t       t       t       t       t       t       t       t                     t                                                 t                     d       d       d       d       d       d       t       t     r   r   c                  B   g } d}d}d}t          j        ||          D ]\  }}| d| }|d|         }t          |t          fi d |D             d| dt	          d	 |d|         D             
          d| dddg i          }|                     |           | S )z)Make user facing objects for vector types)
int8int16int32int64uint8uint16uint32uint64float32float64)            )r'   r*   r,   wr'   Nc                     i | ]}|d  S )c                     d S r   r   r   s    r   <lambda>z3make_vector_type_stubs.<locals>.<dictcomp>.<lambda>R  s    d r   r   ).0attrs     r   
<dictcomp>z*make_vector_type_stubs.<locals>.<dictcomp>R  s    BBBt4**BBBr   <>c                 D    g | ]}t          |t           j                   S ))namekind)r   POSITIONAL_ONLY)r  	attr_names     r   
<listcomp>z*make_vector_type_stubs.<locals>.<listcomp>U  sA     ; ; ; ( "!*1J  ; ; ;r   )
parameterszA stub for z to be used in CUDA kernels.)r   __signature__r   aliases)	itertoolsproducttyper   r   append)	vector_type_stubsvector_type_prefixvector_type_element_countsvector_type_attribute_namesprefixnelem	type_name
attr_namesvector_type_stubs	            r   make_vector_type_stubsr0  7  s5    "."6"*6  3 3 ''''	0%8
wBBzBBB &6%5%5%5%. ; ; ,6fuf+=; ; ; & & &
 $Y  $  $  $	 	 b/
 
" 	  !12222r   c                    dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j	                  j        dz   dt          j        t           j
                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   dt          j        t           j                  j        dz   d}t          t                     }| D ]*}||j        dd                                      |           +|                                D ]=\  }}||         } | D ]-}|j        d         }|j                            | |            .>dS )	zVFor each of the stubs, create its aliases.

    For example: float64x3 -> double3
    int   uintfloat)charshortr2  longlonglongucharushortr4  ulong	ulonglongr5  doubleN)nprA   byteitemsizer7  intcint_r9  ubyter;  uintcr4  r=  singler>  r   listr   r&  itemsr"  )r'  base_type_to_aliasbase_type_to_vector_typestubalias	base_typer,  s          r   map_vector_type_stubs_to_aliasrP  d  sF    7bhrw''014668rx))2Q6885RXbg&&/!3556bhrw''01466>"(2;//81<>>9**3a799;"),,59;;8rx))2Q6888))2Q688ABHR\22;a?AA;"),,59;;<"(29--6:<<   +400! B B ss!34;;DAAAA.4466 3 3y4Y?% 	3 	3DM"%EL5 1% 1 12222	33 3r   ).r   numpyrA  collectionsr   r!   r#  inspectr   r   objectr   r#   r%   r/   r2   r5   r7   r9   r;   r=   rF   rI   rN   rP   rS   rU   rW   rY   r[   r]   r_   ra   rc   rg   rj   rl   rn   rp   rr   rt   r   r   r0  rP  _vector_type_stubsr   r   r   <module>rV     s        # # # # # #         ( ( ( ( ( ( ( (" " " " "6 " " "      4   "* * * * * * * *) ) ) ) )t ) ) )) ) ) ) )t ) ) )( ( ( ( (d ( ( (! ! ! ! !t ! ! !    T       T   &    D    
 
 
 
 
D 
 
 
 $ $ $ $ $t $ $ $$ $ $ $ $$ $ $ $$ $ $ $ $$ $ $ $) ) ) ) )T ) ) )
) 
) 
) 
) 
)T 
) 
) 
)
% 
% 
% 
% 
% 
% 
% 
%& & & & &$ & & &, , , , , , , ,- - - - - - - -& & & & &$ & & &    4       4       $       $       4       $       4   c c c c cT c c cR# # # # # # # #m m m m m4 m m mf	* * *Z3 3 3B ,+--   1 2 2 2 2 2r   