
    xKg
                     *   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j"                   ej$                  d            Zed	        Zej+                  ej,                        ej+                  ej.                        d
               Zej+                  ej2                        d        Zej+                  ej6                        d        Z ee ej<                  ej>                              d        Z y)    )singledispatch)ir)typescgutils)NumbaWarning)Registry)	nvvmutils)warn   c                     t        d|       )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 )NotImplementedError)tycontextbuildervals       X/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/cuda/printimpl.py
print_itemr      s     !#& ' '    c                     | t         j                  v rd}t         j                  }nd}t         j                  }|j	                  ||| |      }||gfS )Nz%lluz%lld)r   unsigned_domainuint64int64cast)r   r   r   r   rawfmtdsttypellds          r   int_print_implr      sN     
U""",,++
,,wR
1CC5=r   c                 P    |j                  ||| t        j                        }d|gfS )Nz%f)r   r   float64)r   r   r   r   r   s        r   real_print_implr    )   s&    
,,wR
7C#;r   c                 p    | j                   }t        |t              sJ d}|j                  ||      }||gfS )Nz%s)literal_value
isinstancestrinsert_string_const_addrspace)r   r   r   sigvalpyvalr   r   s          r   const_print_implr(   /   s@    EeS!!!F

/
/
?CC5=r   c                    t        j                  |j                        }g }g }t        t	        |j
                  |            D ];  \  }\  }}	t        || ||	      \  }
}|j                  |
       |j                  |       = dj                  |      dz   }t        |      dkD  r$d}t        |t               |j                  dd      }| j                  ||      }t        j                   ||      }t        j"                  ||      }t        j                  |j                        }|j%                  |||j'                  |t(              f       | j+                         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   sigr2   vprintformatsvaluesiargtypeargvalargfmtargvalsr   msgfmtarrayarrayptrs                    r   print_varargsrK   8   s+    %%gnn5FGF )#chh*= >GV$WgwGvg !?
 XXg%F
4y2~NS,T*

/
/
@C))'6:E((%8H%%gnn5FLL#wxABC""$$r   N)!	functoolsr   llvmliter   
numba.corer   r   numba.core.errorsr   numba.core.imputilsr   
numba.cudar	   warningsr
   registrylowerPointerTypeIntTyper<   r   registerIntegerIntegerLiteralr   Floatr    StringLiteralr(   printVarArgAnyrK    r   r   <module>r`      s   $  % * (   :
"..A
'
 ' ' U]]#U))* + $ U[[! "
 U(() * ulell599%&% '%r   