U
    ,‰d¼  ã                   @   sN   d dl Z d dlmZ G dd„ deƒZG dd„ deƒZdZd e¡Zd	d
„ Z	dS )é    N)ÚLoweringErrorc                       s   e Zd Zd‡ fdd„	Z‡  ZS )ÚKernelRuntimeErrorNc                    s>   || _ || _|| _d}|| j | j| jf }tt| ƒ |¡ d S )Nz1An exception was raised in thread=%s block=%s
	%s)ÚtidÚctaidÚmsgÚsuperr   Ú__init__)Úselfr   r   r   Út©Ú	__class__© ú5/tmp/pip-unpacked-wheel-eu7e0c37/numba/cuda/errors.pyr      s    zKernelRuntimeError.__init__)NN)Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__r   r   r   r   r      s   r   c                   @   s   e Zd ZdS )ÚCudaLoweringErrorN)r   r   r   r   r   r   r   r      s   r   zJhttps://numba.readthedocs.io/en/stable/cuda/kernels.html#kernel-invocationz›
Kernel launch configuration was not specified. Use the syntax:

kernel_function[blockspergrid, threadsperblock](arg0, arg1, ..., argn)

See {} for help.

c                 C   s8   dd„ }d| |fkrt tƒ‚|| dƒ} ||dƒ}| |fS )zE
    Normalize and validate the user-supplied kernel dimensions.
    c                 S   s€   t | ttfƒs| g} nt| ƒ} t| ƒdkr:td|| f ƒ‚| D ] }t |tjƒs>td|| f ƒ‚q>t| ƒdk rx|  d¡ q`t| ƒS )Né   z3%s must be a sequence of 1, 2 or 3 integers, got %rz)%s must be a sequence of integers, got %ré   )	Ú
isinstanceÚtupleÚlistÚlenÚ
ValueErrorÚnumbersÚIntegralÚ	TypeErrorÚappend)ZdimÚnameÚvr   r   r   Ú	check_dim%   s    ÿÿz.normalize_kernel_dimensions.<locals>.check_dimNÚgriddimÚblockdim)r   Úmissing_launch_config_msg)r"   r#   r!   r   r   r   Únormalize_kernel_dimensions    s    

r%   )
r   Znumba.core.errorsr   ÚRuntimeErrorr   r   Z_launch_help_urlÚformatr$   r%   r   r   r   r   Ú<module>   s   ù
