B
     \m                 @   sT  d Z ddlmZmZ ddlmZ ddlZddlZddlm	Z	 ddl
ZddlmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZmZ ddlmZ ddlmZ dd Zdd Zdd ZG dd deZdd Z G dd deZ!G dd deZ"dd Z#dd Z$dd  Z%d!d" Z&G d#d$ d$eZ'G d%d& d&eZ(G d'd( d(eZ)G d)d* d*eZ*dS )+zA
Implements custom ufunc dispatch mechanism for non-CPU devices.
    )print_functionabsolute_import)OrderedDictN)reduce)exec_)longint)IS_PY3)_BaseUFuncBuilderparse_identity)sigutilstypes)	signature)parse_signaturec             C   s8   | |kr| S | dkr|S |dkr$| S t d| |dS )z=
    Raises
    ------
    ValueError if broadcast fails
       zfailed to broadcast {0} and {1}N)
ValueErrorformat)ab r   9lib/python3.7/site-packages/numba/npyufunc/deviceufunc.py_broadcast_axis   s    r   c             C   sf   t t| |g\} }xt| t|k r.d|  } qW xt| t|krLd| }q2W tdd t| |D S )z=
    Raises
    ------
    ValueError if broadcast fails
    )r   c             s   s   | ]\}}t ||V  qd S )N)r   ).0r   r   r   r   r   	<genexpr>4   s    z&_pairwise_broadcast.<locals>.<genexpr>)maptuplelenzip)Zshape1Zshape2r   r   r   _pairwise_broadcast&   s    r   c              G   sp   | st | d }| dd }y(x"t|ddD ]\}}t||}q,W W n" tk
rf   td|Y nX |S dS )z=
    Raises
    ------
    ValueError if broadcast fails
    r   r   N)startz!failed to broadcast argument #{0})AssertionError	enumerater   r   r   )	shapelistresultZothersiZeachr   r   r   _multi_broadcast7   s    r$   c               @   s   e Zd ZdZdZdZdd Zdd Zdd	 Zd
d Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zedd Zdd Zd d! Zd"d# Zd$d% ZdS )&UFuncMechanismz0
    Prepare ufunc arguments for vectorize.
    NFc             C   s>   || _ || _t| j}dg| | _g | _d| _dg| | _dS )zFNever used directly by user. Invoke by UFuncMechanism.call().
        N)typemapargsr   argtypes	scalarposr   arrays)selfr&   r'   nargsr   r   r   __init__Q   s    
zUFuncMechanism.__init__c             C   s   xt | jD ]x\}}t|tjr,|| j|< q| |rH| || j|< qt|tt	t
ttjfrl| j| qtd|d t|f qW dS )z1
        Get all arguments in array form
        z#argument #%d has invalid type of %sr   N)r    r'   
isinstancenpZndarrayr*   is_device_arrayas_device_arrayintr   floatcomplexZnumberr)   append	TypeErrortype)r+   r#   argr   r   r   _fill_arrays\   s    
zUFuncMechanism._fill_arraysc             C   s0   x*t | jD ]\}}|dk	r|j| j|< qW dS )z
        Get dtypes
        N)r    r*   dtyper(   )r+   r#   aryr   r   r   _fill_argtypesl   s    zUFuncMechanism._fill_argtypesc             C   s   g }| j rzxn| jD ]d}g }xHtt|| jD ]4\}\}}|dkrRt| j| j}|	||k q,W t
|r|	| qW |sg }x6| jD ],}t
dd t|| jD }|r|	| qW |stdt|dkrtd|d | _dS )z<Resolve signature.
        May have ambiguous case.
        Nc             s   s"   | ]\}}|d kp||kV  qd S )Nr   )r   formalactualr   r   r   r      s   z4UFuncMechanism._resolve_signature.<locals>.<genexpr>zNo matching version.  GPU ufunc requires array arguments to have the exact types.  This behaves like regular ufunc with casting='no'.r   zqFailed to resolve ufunc due to ambiguous signature. Too many untyped scalars. Use numpy dtype object to type tag.r   )r)   r&   r    r   r(   r/   asarrayr'   r:   r5   allr6   r   )r+   ZmatchesZ	formaltysZ	match_mapr#   r=   r>   Zall_matchesr   r   r   _resolve_signaturet   s.    z!UFuncMechanism._resolve_signaturec             C   s8   x0| j D ]&}tj| j| g| j| d| j|< qW | jS )zPReturn the actual arguments
        Casts scalar arguments to np.array.
        )r:   )r)   r/   Zarrayr'   r(   r*   )r+   r#   r   r   r   _get_actual_args   s    &zUFuncMechanism._get_actual_argsc       	         s   dd |D }t | xt|D ]\}  jkr4q |  rP|  ||< q  fddttD }tt j }dg| t j }x|D ]}d||< qW t	j
jj |d}| |||< q W |S )z)Perform numpy ufunc broadcasting
        c             S   s   g | ]
}|j qS r   )shape)r   r   r   r   r   
<listcomp>   s    z-UFuncMechanism._broadcast.<locals>.<listcomp>c                s,   g | ]$}| j ks$ j| | kr|qS r   )ndimrC   )r   ax)r;   rC   r   r   rD      s    
r   )rC   strides)r$   r    rC   r0   broadcast_deviceranger   listrG   r/   libZstride_tricksZ
as_stridedforce_array_layout)	r+   arysr!   r#   Z
ax_differsZ
missingdimrG   rF   Zstridedr   )r;   rC   r   
_broadcast   s"    



zUFuncMechanism._broadcastc             C   s*   |    |   |   |  }| |S )z[Prepare and return the arguments for the ufunc.
        Does not call to_device().
        )r9   r<   rA   rB   rN   )r+   rM   r   r   r   get_arguments   s
    zUFuncMechanism.get_argumentsc             C   s   | j | j S )z)Returns (result_dtype, function)
        )r&   r(   )r+   r   r   r   get_function   s    zUFuncMechanism.get_functionc             C   s   dS )zBIs the `obj` a device array?
        Override in subclass
        Fr   )r+   objr   r   r   r0      s    zUFuncMechanism.is_device_arrayc             C   s   |S )zConvert the `obj` to a device array
        Override in subclass

        Default implementation is an identity function
        r   )r+   rQ   r   r   r   r1      s    zUFuncMechanism.as_device_arrayc             C   s   t ddS )zTHandles ondevice broadcasting

        Override in subclass to add support.
        z'broadcasting on device is not supportedN)NotImplementedError)r+   r;   rC   r   r   r   rH      s    zUFuncMechanism.broadcast_devicec             C   s   |S )zSEnsures array layout met device requirement.

        Override in sublcass
        r   )r+   r;   r   r   r   rL      s    z!UFuncMechanism.force_array_layoutc                s  | d| j| dd}|r2tdd|  | || } \}}|d j}|dk	rv|rv	|}fdd |d j
d	kr fd
d|D }g }d}	x>|D ]6}
|
r||
 d}	qj|
d}|| qW |d j}|dkrPj||d}||g ||d | |	r@||S | |S n|r|j
d	krp |}|}||g ||d | ||S |j|kst|j|kstj||d}||g ||d | |j|d|S dS )z1Perform the entire ufunc call mechanism.
        streamoutNzunrecognized keywords: %sz, r   c                sV    j r
ty|  S  tk
rP    | s0 n |  } |S Y nX d S )N)SUPPORT_DEVICE_SLICINGrR   Zravelr0   to_host	to_device)r   hostary)crrS   r   r   attempt_ravel
  s    
z*UFuncMechanism.call.<locals>.attempt_ravelr   c                s   g | ]} |qS r   r   )r   r   )rZ   r   r   rD     s    z'UFuncMechanism.call.<locals>.<listcomp>FT)rS   )popDEFAULT_STREAMwarningswarnjoinrO   rP   rC   r0   r1   rE   r5   rW   device_arrayextendlaunchreshapeZcopy_to_hostr   r:   )clsr&   r'   kwsrT   ZrestyfuncZoutshapeZdevarysZ
any_devicer   Zdev_arC   Zdevoutr   )rZ   rY   rS   r   call   sT    









zUFuncMechanism.callc             C   s   t dS )zBImplement to device transfer
        Override in subclass
        N)rR   )r+   rX   rS   r   r   r   rW   N  s    zUFuncMechanism.to_devicec             C   s   t dS )z@Implement to host transfer
        Override in subclass
        N)rR   )r+   devaryrS   r   r   r   rV   T  s    zUFuncMechanism.to_hostc             C   s   t dS )zBImplements device allocation
        Override in subclass
        N)rR   )r+   rC   r:   rS   r   r   r   r`   Z  s    zUFuncMechanism.device_arrayc             C   s   t dS )zKImplements device function invocation
        Override in subclass
        N)rR   )r+   rf   countrS   r'   r   r   r   rb   `  s    zUFuncMechanism.launch)__name__
__module____qualname____doc__r\   rU   r-   r9   r<   rA   rB   rN   rO   rP   r0   r1   rH   rL   classmethodrg   rW   rV   r`   rb   r   r   r   r   r%   J   s(   +	!
Zr%   c             C   s   t t| S )N)r/   r:   str)Ztyr   r   r   to_dtypeg  s    rp   c               @   sZ   e Zd Zddi fddZedd ZdddZd	d
 Zdd Zdd Z	dd Z
dd ZdS )DeviceVectorizeNFc             C   s0   |rt d|rt|| _t|| _t | _d S )Nzcaching is not supported)r6   r   py_funcr
   identityr   	kernelmap)r+   rf   rs   cachetargetoptionsr   r   r   r-   l  s    
zDeviceVectorize.__init__c             C   s   | j S )N)rr   )r+   r   r   r   pyfuncu  s    zDeviceVectorize.pyfuncc             C   s  |d k	r:t dt |d ks t|d kr2t|}n|| }~~t|\}}t|f| }| jj	}| 
| j||}| |\}	}| |	}
ttjfdd |D |d d  g  }t||
 |
d|  }| ||}tdd |jD }t|}||f| jt|< d S )Nz'Keyword argument argtypes is deprecatedc             S   s   g | ]}|d d  qS )Nr   )r   r   r   r   r   rD     s    z'DeviceVectorize.add.<locals>.<listcomp>z__vectorized_%sc             s   s   | ]}t |V  qd S )N)rp   )r   tr   r   r   r     s    z&DeviceVectorize.add.<locals>.<genexpr>)r]   r^   DeprecationWarningr   r   r   normalize_signaturer   rw   rj   _get_kernel_source_kernel_template_compile_core_get_globalsr   Zvoidr   _compile_kernelr'   rp   rt   )r+   sigr(   restyper'   return_typeZdevfnsigfuncnameZkernelsourcecorefnZglblZstagerkernelZ	argdtypesZresdtyper   r   r   addy  s.    

(
zDeviceVectorize.addc             C   s   t d S )N)rR   )r+   r   r   r   build_ufunc  s    zDeviceVectorize.build_ufuncc             C   sH   dd t t|jD }t|d|ddd |D d}|jf |S )Nc             S   s   g | ]}d | qS )za%dr   )r   r#   r   r   r   rD     s    z6DeviceVectorize._get_kernel_source.<locals>.<listcomp>z, c             s   s   | ]}d | V  qdS )z%s[__tid__]Nr   )r   r#   r   r   r   r     s    z5DeviceVectorize._get_kernel_source.<locals>.<genexpr>)namer'   argitems)rI   r   r'   dictr_   r   )r+   templater   r   r'   Zfmtsr   r   r   r{     s
    z"DeviceVectorize._get_kernel_sourcec             C   s   t d S )N)rR   )r+   r   r   r   r   r}     s    zDeviceVectorize._compile_corec             C   s   t d S )N)rR   )r+   r   r   r   r   r~     s    zDeviceVectorize._get_globalsc             C   s   t d S )N)rR   )r+   fnobjr   r   r   r   r     s    zDeviceVectorize._compile_kernel)NNN)rj   rk   rl   r-   propertyrw   r   r   r{   r}   r~   r   r   r   r   r   rq   k  s   	
 rq   c               @   sB   e Zd Zddi fddZedd ZdddZd	d
 Zdd ZdS )DeviceGUFuncVectorizeNFc             C   s   |rt d|dds t d|rNddd | D }d}t |||| _t|| _|| _t	| j\| _
| _t| jd	kstd
t | _d S )Nzcaching is not supportedZnopythonTznopython flag must be Truez, c             S   s   g | ]}t |qS r   )repr)r   kr   r   r   rD     s    z2DeviceGUFuncVectorize.__init__.<locals>.<listcomp>z3The following target options are not supported: {0}r   zonly support 1 output)r6   r[   r_   keysr   rr   r
   rs   r   r   inputsig	outputsigr   r   r   rt   )r+   rf   r   rs   ru   rv   Zoptsfmtr   r   r   r-     s    
zDeviceGUFuncVectorize.__init__c             C   s   | j S )N)rr   )r+   r   r   r   rw     s    zDeviceGUFuncVectorize.pyfuncc             C   s  |d k	r:t dt |d ks t|d kr2t|}n|| }~~dd | jD }dd | jD }t|\}}| j	j
}t| j||||}	| |}
t|	|
 |
dj|d }tt||| }| j|t|d}tdd	 |D }|d
 |f| jt|d d
 < d S )Nz'Keyword argument argtypes is deprecatedc             S   s   g | ]}t |qS r   )r   )r   xr   r   r   rD     s    z-DeviceGUFuncVectorize.add.<locals>.<listcomp>c             S   s   g | ]}t |qS r   )r   )r   r   r   r   r   rD     s    z__gufunc_{name})r   )r   c             s   s   | ]}t t|jV  qd S )N)r/   r:   ro   )r   rx   r   r   r   r     s    z,DeviceGUFuncVectorize.add.<locals>.<genexpr>)r]   r^   ry   r   r   r   r   r   rz   rr   rj   expand_gufunc_templater|   r~   r   r   rJ   _determine_gufunc_outer_typesr   rt   )r+   r   r(   r   indimsoutdimsr'   r   r   srcZglblsr   Zoutertysr   Zdtypesr   r   r   r     s,    



zDeviceGUFuncVectorize.addc             C   s   t d S )N)rR   )r+   r   r   r   r   r   r     s    z%DeviceGUFuncVectorize._compile_kernelc             C   s   t d S )N)rR   )r+   r   r   r   r   r~     s    z"DeviceGUFuncVectorize._get_globals)NNN)	rj   rk   rl   r-   r   rw   r   r   r~   r   r   r   r   r     s
   
 r   c             c   s^   xXt | |D ]J\}}t|tjr4|j|d dV  q|dkrDtdtj|dddV  qW d S )Nr   )rE   r   z,gufunc signature mismatch: ndim>0 for scalarA)r:   rE   Zlayout)r   r.   r   Arraycopyr   )ZargtysZdimsZatZndr   r   r   r     s    r   c             C   s   || }dd t t|D }dddd |D }dd t|||D }dd t|t|d ||t|d D }	||	 }
| j|d||d|
d	}|S )
z"Expand gufunc source template
    c             S   s   g | ]}d  |qS )zarg{0})r   )r   r#   r   r   r   rD     s    z*expand_gufunc_template.<locals>.<listcomp>zmin({0})z, c             S   s   g | ]}d  |qS )z{0}.shape[0])r   )r   r   r   r   r   rD     s   c             S   s   g | ]\}}}t |||qS r   )_gen_src_for_indexing)r   arefadimsatyper   r   r   rD     s   c             S   s   g | ]\}}}t |||qS r   )r   )r   r   r   r   r   r   r   rD      s   N)r   r'   
checkedargr   )rI   r   r   r_   r   )r   r   r   r   r(   ZargdimsZargnamesr   inputsZoutputsr   r   r   r   r   r     s    r   c             C   s   dj | t||dS )Nz{aref}[{sliced}])r   Zsliced)r   _gen_src_index)r   r   r   r   r   r   r   
  s    r   c             C   sD   | dkrd dgdg|   S t|tjr<|jd | kr<dS dS d S )Nr   ,Z__tid__:r   z__tid__:(__tid__ + 1))r_   r.   r   r   rE   )r   r   r   r   r   r     s
    r   c               @   s,   e Zd ZdZedd Zdd Zdd ZdS )	GUFuncEnginezZDetermine how to broadcast and execute a gufunc
    base on input shape and signature
    c             C   s   | t | S )N)r   )rd   r   r   r   r   from_signature   s    zGUFuncEngine.from_signaturec             C   s(   || _ || _t| j | _t| j| _d S )N)sinsoutr   ninnout)r+   r   r   r   r   r   r-   $  s    zGUFuncEngine.__init__c             C   s  t || jkrtdi }g }g }xtt|| jD ]\}\}}|d7 }t |}t ||k rnd}	t|	|f |r|| d  }
|d |  }nd}
|}xZtt|
|D ]H\}\}}|t |7 }||kr|| |krd}	t|	||f |||< qW || ||
 q4W g }x@| jD ]6}g }x|D ]}|||  q&W |t	| qW dd |D }t
|}|| }dg| j }xTt|D ]H\}}||kr|d	ks|dkrd
||< nd}	t|	|d f qW t| ||||S )Nz invalid number of input argumentr   z%arg #%d: insufficient inner dimensionr   z$arg #%d: shape[%d] mismatch argumentc             S   s   g | ]}t tj|d qS )r   )r   operatormul)r   sr   r   r   rD   V  s    z)GUFuncEngine.schedule.<locals>.<listcomp>F)r   Tz!arg #%d: outer dimension mismatch)r   r   r6   r    r   r   r   r5   r   r   r/   ZargmaxGUFuncSchedule)r+   ishapesZ	symbolmapZouter_shapesZinner_shapesZargnrC   ZsymbolsZ
inner_ndimr   Zinner_shapeZouter_shapeZaxisZdimZsymoshapesZoutsigZoshapeZsizesZ	largest_iloopdimspinnedr#   dr   r   r   schedule,  sT    




zGUFuncEngine.scheduleN)rj   rk   rl   rm   rn   r   r-   r   r   r   r   r   r     s   r   c               @   s   e Zd Zdd Zdd ZdS )r   c                sF   || _ || _|| _ | _ttj d| _|| _ fdd|D | _	d S )Nr   c                s   g | ]} | qS r   r   )r   r   )r   r   r   rD   r  s    z+GUFuncSchedule.__init__.<locals>.<listcomp>)
parentr   r   r   r   r   r   loopnr   output_shapes)r+   r   r   r   r   r   r   )r   r   r-   g  s    zGUFuncSchedule.__init__c                s,   dd l }d} fdd|D }|t|S )Nr   )r   r   r   r   r   c                s   g | ]}|t  |fqS r   )getattr)r   r   )r+   r   r   rD   x  s    z*GUFuncSchedule.__str__.<locals>.<listcomp>)pprintZpformatr   )r+   r   Zattrsvaluesr   )r+   r   __str__t  s    zGUFuncSchedule.__str__N)rj   rk   rl   r-   r   r   r   r   r   r   f  s   r   c               @   sL   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dS )GenerializedUFuncc             C   s*   || _ || _d| _| jjdks&tdd S )Ni   @r   zonly support single output)rt   engineZmax_blocksizer   r   )r+   rt   r   r   r   r   r-   }  s    zGenerializedUFunc.__init__c       
      O   s   |  | jj| jj||}|  | |j|j\}}}}|| |	|| |
  | ||j|j\}}	|||j||	g  | S )N)Z_call_stepsr   r   r   prepare_inputs	_schedulenorm_inputsoutputadjust_input_typesallocate_outputsprepare_kernel_parametersrN   kernel_parameterskernel_returnvaluelaunch_kernelr   post_process_result)
r+   r'   re   Z	callstepsindtypesr   outdtyper   	newparams	newretvalr   r   r   __call__  s    
zGenerializedUFunc.__call__c             C   s   dd |D }| j |}tdd |D }y| j| \}}W n, tk
rj   | |}| j| \}}Y nX |d k	r|jd |jkrtd||||fS )Nc             S   s   g | ]
}|j qS r   )rC   )r   r   r   r   r   rD     s    z/GenerializedUFunc._schedule.<locals>.<listcomp>c             s   s   | ]}|j V  qd S )N)r:   )r   r#   r   r   r   r     s    z.GenerializedUFunc._schedule.<locals>.<genexpr>r   zoutput shape mismatch)	r   r   r   rt   KeyError_search_matching_signaturer   rC   r   )r+   r   rT   Zinput_shapesr   idtypesr   r   r   r   r   r     s    
zGenerializedUFunc._schedulec             C   s<   x6| j  D ] }tdd t||D r|S qW tddS )z
        Given the input types in `idtypes`, return a compatible sequence of
        types that is defined in `kernelmap`.

        Note: Ordering is guaranteed by `kernelmap` being a OrderedDict
        c             s   s   | ]\}}t ||V  qd S )N)r/   Zcan_cast)r   r>   Zdesiredr   r   r   r     s   z?GenerializedUFunc._search_matching_signature.<locals>.<genexpr>zno matching signatureN)rt   r   r@   r   r6   )r+   r   r   r   r   r   r     s
    z,GenerializedUFunc._search_matching_signaturec       
      C   s   |j dkstd|jsdn|j }g }xRt||jD ]B\}}|sb|jdkrb| ||}|| q4|| ||| q4W |j	|f|j
d  }	||	fS )Nr   zzero looping dimensionr   )r   r   r   r   r   size_broadcast_scalar_inputr5   _broadcast_arrayrc   r   )
r+   r   paramsretvalZodimr   pZcsrh   r   r   r   r   rN     s    zGenerializedUFunc._broadcastc             C   sf   |f| }|j |kr|S t|j t|k rX|t|j  d  |j ksLtd| ||S |j| S d S )Nz+cannot add dim and reshape at the same time)rC   r   r   _broadcast_add_axisrc   )r+   r;   ZnewdimZinnerdimnewshaper   r   r   r     s    

z"GenerializedUFunc._broadcast_arrayc             C   s   t dd S )Nzcannot add new axis)rR   )r+   r;   r   r   r   r   r     s    z%GenerializedUFunc._broadcast_add_axisc             C   s   t d S )N)rR   )r+   r;   rC   r   r   r   r     s    z)GenerializedUFunc._broadcast_scalar_inputN)rj   rk   rl   r-   r   r   r   rN   r   r   r   r   r   r   r   r   |  s   r   c               @   sx   e Zd ZddddddddgZd	d
 Zdd Zdd Zdd Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS ) GUFuncCallStepsr'   kwargsr   r   r   r   _is_device_array_need_device_conversionc       
         s  |dkrt d| _| _d} jd _ jd k	rV  j}|rV  j _ fdd jD  _t j o||  _	g }x@t
 j jD ].\}}|r| | q|t| qW |d |  _||d  }	|	r jd k	rt dn|	\ _d S )Nr   z multiple output is not supportedFrT   c                s   g | ]}  |qS r   )r0   )r   r   )r+   r   r   rD     s    z,GUFuncCallSteps.__init__.<locals>.<listcomp>z>cannot specify 'out' as both a positional and keyword argument)r   r'   r   getr   r0   r1   r   anyr   r   r5   r/   r?   r   )
r+   r   r   r'   r   Zuser_output_is_devicer   r   isdevZunused_inputsr   )r+   r   r-     s0    


zGUFuncCallSteps.__init__c             C   s`   xZt t|| jD ]F\}\}}||jkrt|dsHdt|}t|||| j|< qW dS )z
        Attempt to cast the inputs to the required types if necessary
        and if they are not device array.

        Side effect: Only affects the element of `norm_inputs` that requires
        a type cast.
        astypezNcompatible signature is possible by casting but {0} does not support .astype()N)	r    r   r   r:   hasattrr   r7   r6   r   )r+   r   r#   Zityvalmsgr   r   r   r   
  s    


z"GUFuncCallSteps.adjust_input_typesc             C   s6   | j s| jd kr&| j|jd |d}n| j}|| _d S )Nr   )rC   r:   )r   r   r`   r   r   )r+   r   r   r   r   r   r   r     s
    
z GUFuncCallSteps.allocate_outputsc                sd   g }x:t  j jD ](\}}|r,|| q| | qW t fdd|D sZt| _d S )Nc             3   s   | ]}  |V  qd S )N)r0   )r   r   )r+   r   r   r   +  s    z<GUFuncCallSteps.prepare_kernel_parameters.<locals>.<genexpr>)r   r   r   r5   rW   r@   r   r   )r+   r   Zinpr   r   )r+   r   r   $  s    z)GUFuncCallSteps.prepare_kernel_parametersc             C   s4   | j r| | j| j}n| jd kr*| j}n| j}|S )N)r   rV   r   r   )r+   rT   r   r   r   r   .  s    
z#GUFuncCallSteps.post_process_resultc             C   s   d S )Nr   )r+   r   r   r   r   7  s    zGUFuncCallSteps.prepare_inputsc             C   s   t d S )N)rR   )r+   r   Znelemr'   r   r   r   r   :  s    zGUFuncCallSteps.launch_kernelc             C   s   t d S )N)rR   )r+   rQ   r   r   r   r0   =  s    zGUFuncCallSteps.is_device_arrayc             C   s   |S )Nr   )r+   rQ   r   r   r   r1   @  s    zGUFuncCallSteps.as_device_arrayc             C   s   t d S )N)rR   )r+   rX   r   r   r   rW   C  s    zGUFuncCallSteps.to_devicec             C   s   t d S )N)rR   )r+   rC   r:   r   r   r   r`   F  s    zGUFuncCallSteps.device_arrayN)rj   rk   rl   	__slots__r-   r   r   r   r   r   r   r0   r1   rW   r`   r   r   r   r   r     s&   !	
	r   )+rm   Z
__future__r   r   collectionsr   r   r]   	functoolsr   Znumpyr/   Z	numba.sixr   Znumba.utilsr   r   Znumba.npyufunc.ufuncbuilderr	   r
   Znumbar   r   Znumba.typingr   Znumba.npyufunc.sigparser   r   r   r$   objectr%   rp   rq   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   s<     B@
Ka