o
    i
                     @   s   d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ e
 ZejZeedZed	d
 Zeejeejdd Zeejdd Zeejdd Zeeeejdd Z dS )    )singledispatch)ir)typescgutils)NumbaWarning)Registry)	nvvmutils)warn   c                 C   s   t d| f )z
    Handle printing of a single value of the given Numba type.
    A (format string, [list of arguments]) is returned that will allow
    forming the final printf()-like call.
    z,printing unimplemented for values of type %s)NotImplementedError)tycontextbuilderval r   Q/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/numba/cuda/printimpl.py
print_item   s   r   c                 C   s:   | t jv rd}t j}nd}t j}|||| |}||gfS )Nz%lluz%lld)r   unsigned_domainuint64int64cast)r   r   r   r   rawfmtdsttypelldr   r   r   int_print_impl   s   

r   c                 C   s   | ||| tj}d|gfS )Nz%f)r   r   float64)r   r   r   r   r   r   r   r   real_print_impl)   s   
r   c                 C   s.   | j }t|ts
J d}|||}||gfS )Nz%s)literal_value
isinstancestrinsert_string_const_addrspace)r   r   r   sigvalpyvalr   r   r   r   r   const_print_impl/   s
   
r#   c                 C   s   t |j}g }g }tt|j|D ]\}\}}	t|| ||	\}
}||
 || qd	|d }t
|dkrFd}t|t |dd}| ||}t||}t||}t |j}|||||tf |  S )zThis function is a generic 'print' wrapper for arbitrary types.
    It dispatches to the appropriate 'print' implementations above
    depending on the detected real types in the signature. 
    zjCUDA print() cannot print more than 32 items. The raw format string will be emitted by the kernel instead.%z%%)r   declare_vprintmodule	enumeratezipargsr   appendextendjoinlenr	   r   replacer    r   make_anonymous_structalloca_once_valuecallbitcastvoidptrget_dummy_value)r   r   sigr,   vprintformatsvaluesiargtypeargvalargfmtargvalsr   msgfmtarrayarrayptrr   r   r   print_varargs8   s$   

rE   N)!	functoolsr   llvmliter   
numba.corer   r   numba.core.errorsr   numba.core.imputilsr   
numba.cudar   warningsr	   registrylowerPointerTypeIntTyper6   r   registerIntegerIntegerLiteralr   Floatr   StringLiteralr#   printVarArgAnyrE   r   r   r   r   <module>   s*    







