§
    ƒÛgÈm  ã                   ó˜  — d Z ddlZddlmZ ddlZddlZddlZddlmZ ddl	Z
ddlmZmZ ddlmZmZmZ ddlmZmZmZmZmZmZmZ ddlmZmZmZ dd	lmZ dd
l m!Z! ddlm"Z"m#Z#m$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. ddl/m0Z0m1Z1 ddlm2Z2 ddl3m4Z5 ddl6m7Z8 ddl9m:Z: ddlm;Z; ddl<m=Z=m>Z> ddl?m@Z@mAZA ddlBmCZC  G d„ de¦  «        ZDeDed<    G d„ de+¦  «        ZE e1¦   «         ZF G d„ de&¦  «        ZG G d „ d!eH¦  «        ZI G d"„ d#e!¦  «        ZJ eJd¦  «        ZK G d$„ d%e¦  «        ZLeLeed         <    G d&„ d'e¦  «        ZMeMeed         <   eF N                    ejO        ¦  «        d(„ ¦   «         ZPeF Q                    ejR        ejS        ¦  «        d)„ ¦   «         ZTeF N                    ejS        ¦  «        d*„ ¦   «         ZUeF N                    ejV        ¦  «        d+„ ¦   «         ZW ed¬,¦  «        d-„ ¦   «         ZX eejY        d¬,¦  «        d.„ ¦   «         ZZ G d/„ d0e¦  «        Z[ G d1„ d2e¦  «        Z\e]d3k    r ej^        ¦   «          dS dS )4a�  This tests the target extension API to ensure that rudimentary expected
behaviours are present and correct. It uses a piece of fake hardware as a
target, the Dummy Processing Unit (DPU), to do this. The DPU borrows a lot from
the CPU but is part of the GPU class of target. The DPU target has deliberately
strange implementations of fundamental operations so as to make it identifiable
in testing.é    N)ÚTestCase)Úcached_property)ÚnjitÚtypes)ÚoverloadÚ	intrinsicÚoverload_classmethod)ÚJitDecoratorÚtarget_registryÚdispatcher_registryÚjit_registryÚtarget_overrideÚGPUÚresolve_dispatcher_from_str)ÚutilsÚfastmathpassÚerrors)Ú
Dispatcher)ÚTargetDescriptor)ÚcpuÚtypingÚcgutils)ÚBaseContext)Úglobal_compiler_lock)Úcallconv)Ú
CPUCodegenÚJITCodeLibrary)ÚPyCallWrapper)ÚRegistryLoaderÚRegistry)Ú_dynfunc)Úir)Úrtsys)Úcompiler)ÚCompilerBaseÚDefaultPassBuilder)ÚFunctionPassÚregister_pass)ÚPreLowerStripPhisc                   ó   — e Zd ZdS )ÚDPUN)Ú__name__Ú
__module__Ú__qualname__© ó    úW/granary/edev/quantum/lib/python3.11/site-packages/numba/tests/test_target_extension.pyr+   r+   2   s   € € € € € Ø€Cr0   r+   Údpuc                   ó*   — e Zd ZeZd„ Zd„ Zd„ Zd„ ZdS )ÚJITDPUCodegenc                 ól  — |                       ¦   «         |d<   t          j                             ¦   «         j        }|                     d¦  «        rd}n|                     d¦  «        rd}nd}||d<   d|d	<   | j        |d
<   t          j        t          j        j	        ¦  «        }d|j
        v rd|d<   d S d S )Nr   Úx86ÚstaticÚppcÚpicÚdefaultÚrelocÚ
jitdefaultÚ	codemodelÚfeaturesÚjitT)Ú_get_host_cpu_nameÚllÚTargetÚfrom_default_tripleÚnameÚ
startswithÚ_tm_featuresr   ÚpysignatureÚcreate_target_machineÚ
parameters)ÚselfÚoptionsÚarchÚreloc_modelÚsigs        r1   Ú_customize_tm_optionsz#JITDPUCodegen._customize_tm_optionsB   sÄ   € à×0Ò0Ñ2Ô2ˆ�‰ÝŒy×,Ò,Ñ.Ô.Ô3ˆØ�?Š?˜5Ñ!Ô!ð 	$Ø"ˆKˆKØ�_Š_˜UÑ#Ô#ð 	$ØˆKˆKà#ˆKØ&ˆ�ÑØ+ˆ�Ñð #Ô/ˆ�
Ñõ Ô¥¤	Ô ?Ñ@Ô@ˆØ�C”NÐ"Ð"à!ˆG�E‰NˆNˆNð #Ð"r0   c                 ó*   — |                       ¦   «         S ©N)Ú_get_host_cpu_features©rJ   s    r1   Ú_customize_tm_featuresz$JITDPUCodegen._customize_tm_featuresY   s   € à×*Ò*Ñ,Ô,Ð,r0   c                 ó:   — | j                              |¦  «         d S rQ   )Ú_engineÚ
add_module)rJ   Úmodules     r1   Ú_add_modulezJITDPUCodegen._add_module]   s   € ØŒ×Ò Ñ'Ô'Ð'Ð'Ð'r0   c                 óÆ   — | j                              |¦  «        }t          j        dz                       |¦  «        }t          j        t          |¦  «        ¦  «        |d<   dS )zrSet the environment address.

        Update the GlobalVariable named *env_name* to the address of *env*.
        é   r   N)rV   Úget_global_value_addressÚctypesÚc_void_pÚfrom_addressÚid)rJ   Úenv_nameÚenvÚgvaddrÚenvptrs        r1   Úset_envzJITDPUCodegen.set_env`   sP   € ð
 ”×6Ò6°xÑ@Ô@ˆÝ”/ AÑ%×3Ò3°FÑ;Ô;ˆÝ”O¥B s¡G¤GÑ,Ô,ˆˆq‰	ˆ	ˆ	r0   N)	r,   r-   r.   r   Ú_library_classrO   rT   rY   re   r/   r0   r1   r4   r4   =   sW   € € € € € ð $€Nð"ð "ð "ð.-ð -ð -ð(ð (ð (ð-ð -ð -ð -ð -r0   r4   c                   ó”   — e Zd ZdZd„ Zed„ ¦   «         Zd„ Zed„ ¦   «         Z	d„ Z
ed„ ¦   «         Zd„ Zd	„ Zd
„ Zd„ Z	 dd„Zd„ Zd„ ZdS )Ú
DPUContextTc                 ó6   — | j                              |¦  «        S rQ   )Ú_internal_codegenÚ_create_empty_module)rJ   rD   s     r1   Úcreate_modulezDPUContext.create_modulet   s   € ØÔ%×:Ò:¸4Ñ@Ô@Ð@r0   c                 ó~   — t          d¦  «        | _        t          j        | ¦  «         |                      ¦   «          d S )Nz
numba.exec)r4   rj   r#   Ú
initializeÚrefreshrS   s    r1   ÚinitzDPUContext.initw   s4   € å!.¨|Ñ!<Ô!<ˆÔåÔ˜ÑÔÐØ�Š‰Œˆˆˆr0   c                 óà   — t           }	 | j        |         }n)# t          $ r t          |¦  «        }|| j        |<   Y nw xY w|                      |¦  «         | j                             ¦   «          d S rQ   )Údpu_function_registryÚ_registriesÚKeyErrorr   Úinstall_registryÚtyping_contextro   )rJ   ÚregistryÚloaders      r1   ro   zDPUContext.refresh~   s‰   € Ý(ˆð	0ØÔ% hÔ/ˆFˆFøÝð 	0ð 	0ð 	0Ý# HÑ-Ô-ˆFØ)/ˆDÔ˜XÑ&Ð&Ð&ð	0øøøð 	×Ò˜hÑ'Ô'Ð'ð 	Ô×#Ò#Ñ%Ô%Ð%Ð%Ð%s   ‰ —#=¼=c                 ó   — | j         j        S rQ   )rj   Útarget_datarS   s    r1   rz   zDPUContext.target_dataŠ   s   € àÔ%Ô1Ð1r0   c                 ó   — | j         S rQ   )rj   rS   s    r1   ÚcodegenzDPUContext.codegenŽ   s   € ØÔ%Ð%r0   c                 ó*   — t          j        | ¦  «        S rQ   )r   ÚCPUCallConvrS   s    r1   Ú	call_convzDPUContext.call_conv’   s   € åÔ# DÑ)Ô)Ð)r0   c                 ó~   — t          j        ||t          j        d         ¦  «        }t	          j        | ||d¬¦  «        S )zŸ
        From the given *envptr* (a pointer to a _dynfunc.Environment object),
        get a EnvBody allowing structured access to environment fields.
        Úoffsetof_env_bodyT)ÚrefÚcast_ref)r   Úpointer_addr!   Ú
_impl_infor   ÚEnvBody)rJ   Úbuilderrd   Úbody_ptrs       r1   Úget_env_bodyzDPUContext.get_env_body–   sA   € õ
 Ô&Ø�V�XÔ0Ð1DÔEñ
ô 
ˆõ Œ{˜4 ¨hÀÐFÑFÔFÐFr0   c                 ób  — |                       |j        |                      | j        ¦  «        ¦  «        }|                     |¦  «        }|                      |¦  «        }|                     || j        j        ¬¦  «         |                      ||¦  «        }| 	                    | j
        ||¦  «        S )N)Ú	debug_msg)Údeclare_env_globalrX   Úget_env_nameÚfndescÚloadÚget_python_apiÚemit_environment_sentryra   r‰   Úget_env_managerÚenvironment)rJ   r‡   ÚenvgvÚenvargÚpyapiÚenv_bodys         r1   r’   zDPUContext.get_env_manager    s­   € Ø×'Ò'ØŒN˜D×-Ò-¨d¬kÑ:Ô:ñ
ô 
ˆð —’˜eÑ$Ô$ˆØ×#Ò# GÑ,Ô,ˆØ×%Ò%Ø˜dœkÔ2ð 	&ñ 	
ô 	
ð 	
ð ×$Ò$ W¨fÑ5Ô5ˆØ×$Ò$ TÔ%5°xÀÑHÔHÐHr0   c                 óR   — t          j        ||t          j        d         |¬¦  «        S )z~
        From the given *genptr* (a pointer to a _dynfunc.Generator object),
        get a pointer to its state area.
        Úoffsetof_generator_state)Úreturn_type)r   r„   r!   r…   )rJ   r‡   Úgenptrrš   s       r1   Úget_generator_statezDPUContext.get_generator_state¬   s3   € õ
 Ô"ØØÝÔÐ :Ô;Ø#ð	
ñ 
ô 
ð 	
r0   c                 ó†   — | j         rt          j        || j         ¦  «         |                     t          j        ¦  «         d S rQ   )Úfastmathr   Úrewrite_moduleÚadd_linking_libraryr#   Úlibrary)rJ   Úmodr¡   s      r1   Úpost_loweringzDPUContext.post_lowering¸   s=   € ØŒ=ð 	<ÝÔ'¨¨T¬]Ñ;Ô;Ð;à×#Ò#¥E¤MÑ2Ô2Ð2Ð2Ð2r0   Fc           	      ó.  — |                       d¦  «        }| j                             |j        |j        ¦  «        }t          j        |||j        ¦  «        }t          | ||||||¬¦  «        }	|	 	                    ¦   «          | 
                    |¦  «         d S )NÚwrapper)Úcall_helperÚrelease_gil)rl   r   Úget_function_typeÚrestypeÚargtypesÚllirÚFunctionÚllvm_func_namer   ÚbuildÚadd_ir_module)
rJ   r¡   rŽ   rb   r¦   r§   Úwrapper_moduleÚfntyÚwrapper_calleer‡   s
             r1   Úcreate_cpython_wrapperz!DPUContext.create_cpython_wrapper¾   s¡   € ð ×+Ò+¨IÑ6Ô6ˆØŒ~×/Ò/°´ÀÄÑPÔPˆÝœØ˜D &Ô"7ñ
ô 
ˆõ  ØØØØØØ#Ø#ð
ñ 
ô 
ˆð 	�Š‰ŒˆØ×Ò˜nÑ-Ô-Ð-Ð-Ð-r0   c                 ó   — d S rQ   r/   )rJ   r¡   rŽ   rb   r¦   s        r1   Úcreate_cfunc_wrapperzDPUContext.create_cfunc_wrapperÒ   s   € àˆr0   c                 ó>  — |                      |j        ¦  «        }d|j        ›�}t          j        |                     ¦   «         |j                             d¦  «        d         ||||f¦  «        }|j                             |  	                    |¦  «        |¦  «         |S )zö
        Returns
        -------
        (cfunc, fnptr)

        - cfunc
            callable function (Can be None)
        - fnptr
            callable function address
        - env
            an execution environment (from _dynfunc)
        zcompiled wrapper for ú.éÿÿÿÿ)
Úget_pointer_to_functionÚllvm_cpython_wrapper_nameÚqualnamer!   Úmake_functionÚlookup_moduleÚsplitr|   re   r�   )rJ   r¡   rŽ   rb   ÚfnptrÚdocÚcfuncs          r1   Úget_executablezDPUContext.get_executableÖ   s£   € ð ×/Ò/ØÔ,ñ
ô 
ˆˆð ,2¬?¨?Ð<ˆÝÔ&Ø× Ò Ñ"Ô"ØŒO×!Ò! #Ñ&Ô& rÔ*ØØØàˆJñ
ô 
ˆð 	Œ×Ò × 1Ò 1°&Ñ 9Ô 9¸3Ñ?Ô?Ð?Øˆr0   N)F)r,   r-   r.   Úallow_dynamic_globalsrl   r   rp   ro   Úpropertyrz   r|   r   r   r‰   r’   rœ   r£   r³   rµ   rÂ   r/   r0   r1   rh   rh   p   s  € € € € € Ø ÐðAð Að Að ðð ñ Ôðð
&ð 
&ð 
&ð ð2ð 2ñ „Xð2ð&ð &ð &ð ð*ð *ñ „_ð*ðGð Gð Gð
Ið 
Ið 
Ið

ð 

ð 

ð3ð 3ð 3ð >Cð.ð .ð .ð .ð(ð ð ðð ð ð ð r0   rh   c                   ó6   — e Zd ZdZdZej        d„ ¦   «         ZdS )Ú_NestedContextNc              #   ó’   K  — | j         | j        f}	 || _         || _        d V — |\  | _         | _        d S # |\  | _         | _        w xY wrQ   )Ú_typing_contextÚ_target_context)rJ   rv   Útarget_contextÚ
old_nesteds       r1   Únestedz_NestedContext.nestedý   sg   è è € àÔ)¨4Ô+?Ð?ˆ
ð	DØ#1ˆDÔ Ø#1ˆDÔ ØˆEˆEˆEà9CÑ6ˆDÔ  $Ô"6Ð"6Ð"6ø¸Ñ6ˆDÔ  $Ô"6ÐCÐCÐCÐCs	   ’5 µA)r,   r-   r.   rÈ   rÉ   Ú
contextlibÚcontextmanagerrÌ   r/   r0   r1   rÆ   rÆ   ù   s@   € € € € € Ø€OØ€OàÔðDð Dñ ÔðDð Dð Dr0   rÆ   c                   óŽ   — e Zd Zej        Z e¦   «         Zed„ ¦   «         Z	ed„ ¦   «         Z
ed„ ¦   «         Zed„ ¦   «         Zd„ ZdS )Ú	DPUTargetc                 ó6   — t          | j        | j        ¦  «        S rQ   )rh   rv   Ú_target_namerS   s    r1   Ú_toplevel_target_contextz"DPUTarget._toplevel_target_context  s   € õ ˜$Ô-¨tÔ/@ÑAÔAÐAr0   c                 ó(   — t          j        ¦   «         S rQ   )r   ÚContextrS   s    r1   Ú_toplevel_typing_contextz"DPUTarget._toplevel_typing_context  s   € õ Œ~ÑÔÐr0   c                 ó0   — | j         j        }|�|S | j        S )z5
        The target context for DPU targets.
        )Ú_nestedrÉ   rÓ   ©rJ   rÌ   s     r1   rÊ   zDPUTarget.target_context  ó"   € ð
 ”Ô-ˆØÐØˆMàÔ0Ð0r0   c                 ó0   — | j         j        }|�|S | j        S )z5
        The typing context for CPU targets.
        )rØ   rÈ   rÖ   rÙ   s     r1   rv   zDPUTarget.typing_context"  rÚ   r0   c                 ó8   — | j                              ||¦  «        S )zˆ
        A context manager temporarily replacing the contexts with the
        given ones, for the current thread of execution.
        )rØ   rÌ   )rJ   rv   rÊ   s      r1   Únested_contextzDPUTarget.nested_context-  s   € ð
 Œ|×"Ò" >°>ÑBÔBÐBr0   N)r,   r-   r.   r   ÚCPUTargetOptionsrK   rÆ   rØ   r   rÓ   rÖ   rÄ   rÊ   rv   rÝ   r/   r0   r1   rÐ   rÐ   	  sª   € € € € € ØÔ"€GØˆnÑÔ€GàðBð Bñ „_ðBð ð ð  ñ „_ð ð ð1ð 1ñ „Xð1ð ð1ð 1ñ „Xð1ðCð Cð Cð Cð Cr0   rÐ   c                   ó   — e Zd ZeZdS )ÚDPUDispatcherN)r,   r-   r.   Ú
dpu_targetÚtargetdescrr/   r0   r1   rà   rà   :  s   € € € € € Ø€K€K€Kr0   rà   c                   ó&   — e Zd Zd„ Zd„ Zd„ Zd„ ZdS )Údjitc                 ó"   — || _         || _        d S rQ   )Ú_argsÚ_kwargs)rJ   ÚargsÚkwargss      r1   Ú__init__zdjit.__init__F  s   € ØˆŒ
ØˆŒˆˆr0   c                 ó’   — t          |¦  «        dk     sJ ‚|r	|d         }n| j        d         }|| _        |                      ¦   «         S )Né   r   )Úlenræ   Úpy_funcÚdispatcher_wrapper)rJ   rè   Úfuncs      r1   Ú__call__zdjit.__call__J  sL   € Ý�4‰yŒy˜1Š}ˆ}ˆ}ˆ}Øð 	!Ø˜”7ˆDˆDà”:˜a”=ˆDØˆŒà×&Ò&Ñ(Ô(Ð(r0   c                 ó2   — t           t          d                  S )z(
        Returns the dispatcher
        r2   )r   r   rS   s    r1   Úget_dispatcherzdjit.get_dispatcherT  s   € õ #¥?°5Ô#9Ô:Ð:r0   c                 ó´   — |                       ¦   «         }i }d| j        v rd|d<   t          j        }d| j        v r| j        d         } || j        ||¬¦  «        S )NÚnopythonTÚpipeline_class)rî   Útargetoptionsrö   )ró   rç   r$   ÚCompilerrî   )rJ   ÚdispÚtoptrö   s       r1   rï   zdjit.dispatcher_wrapperZ  sw   € Ø×"Ò"Ñ$Ô$ˆàˆØ˜œÐ%Ð%Ø#ˆD�Ñõ "Ô*ˆØ˜tœ|Ð+Ð+Ø!œ\Ð*:Ô;ˆNØˆtØ”LØØ)ð
ñ 
ô 
ð 	
r0   N)r,   r-   r.   rê   rñ   ró   rï   r/   r0   r1   rä   rä   E  sP   € € € € € ðð ð ð)ð )ð )ð;ð ;ð ;ð
ð 
ð 
ð 
ð 
r0   rä   c                 ó*   — |                       ¦   «         S rQ   )Úget_dummy_value)Úcontextr‡   ÚtyÚpyvals       r1   Úconstant_dummyr   v  s   € à×"Ò"Ñ$Ô$Ð$r0   c                 ó~   — |                       ||j        |j        ¦  «        }|                      |||j        |¦  «        S rQ   )Úget_constant_genericÚliteral_typeÚliteral_valueÚcast)rý   r‡   ÚfromtyÚtotyÚvalÚlits         r1   Úliteral_int_to_numberr
  |  sA   € à
×
&Ò
&Ø�Ô$ fÔ&:ñô €Cð �<Š<˜  fÔ&9¸4Ñ@Ô@Ð@r0   c                 óB   — |                       |¦  «        } ||¦  «        S rQ   ©Úget_value_type©rý   r‡   rþ   rÿ   Últys        r1   Ú	const_intr  …  ó#   € à
×
 Ò
  Ñ
$Ô
$€CØˆ3ˆu‰:Œ:Ðr0   c                 óB   — |                       |¦  «        } ||¦  «        S rQ   r  r  s        r1   Úconst_floatr  Œ  r  r0   ©Útargetc                 ó(   —  |||¦  «        }d„ }||fS )Nc                 ó   —  |j         |Ž S rQ   ©Úsub©Úcgctxr‡   ÚtyargsÚllargss       r1   r|   zintrin_add.<locals>.codegen—  s   € ØˆwŒ{˜FÐ#Ð#r0   r/   ©ÚtyctxÚxÚyrN   r|   s        r1   Ú
intrin_addr"  “  s,   € à
ˆ!ˆAˆq‰'Œ'€Cð$ð $ð $ð �ˆ<Ðr0   c                 ó|   — t          | t          j        ¦  «        rt          |t          j        ¦  «        rd„ }|S d S d S )Nc                 ó"   — t          | |¦  «        S rQ   )r"  )r   r!  s     r1   Úimplzol_add.<locals>.impl¢  s   € Ý˜a Ñ#Ô#Ð#r0   )Ú
isinstancer   ÚInteger)r   r!  r%  s      r1   Úol_addr(  ž  sS   € å�!•U”]Ñ#Ô#ð ­
°1µe´mÑ(DÔ(Dð ð	$ð 	$ð 	$ð ˆðð ð ð r0   c                   óB   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
S )ÚTestTargetHierarchySelectionzÈThis tests that the target hierarchy is scanned in the right order,
    that appropriate functions are selected based on what's available and that
    the DPU target is distinctly different to the CPUc                 ó6  — |                       t          j        ¦  «         |                       t          j        ¦  «         |                      t          t          j        ¦  «        d¦  «         |                      t          t          j        ¦  «        d¦  «         dS )zËChecks that the DPU registry only contains the things added

        This test must be first to execute among all tests in this file to
        ensure the no lazily loaded entries are added yet.
        r[   é   N)ÚassertFalserr   Ú	functionsÚgetattrsÚassertEqualrí   ÚcastsÚ	constantsrS   s    r1   Útest_0_dpu_registryz0TestTargetHierarchySelection.test_0_dpu_registry­  s~   € ð 	×ÒÕ.Ô8Ñ9Ô9Ð9Ø×ÒÕ.Ô7Ñ8Ô8Ð8à×Ò�Õ2Ô8Ñ9Ô9¸1Ñ=Ô=Ð=à×Ò�Õ2Ô<Ñ=Ô=¸qÑAÔAÐAÐAÐAr0   c                 óR  ‡— d„ Št          ‰d¬¦  «        d„ ¦   «         }t          ‰d¬¦  «        d„ ¦   «         }t          ¦   «         ˆfd„¦   «         }t          ¦   «         ˆfd„¦   «         }|                       |¦   «         d	¦  «         |                       |¦   «         d
¦  «         d S )Nc                 ó   — d S rQ   r/   ©r   s    r1   Úmy_funczATestTargetHierarchySelection.test_specialise_gpu.<locals>.my_func»  ó   € ØˆDr0   Úgenericr  c                 ó   — d„ }|S )Nc                 ó   — d| z   S ©Nr[   r/   r6  s    r1   r%  zSTestTargetHierarchySelection.test_specialise_gpu.<locals>.ol_my_func1.<locals>.implÁ  ó   € Ø˜1‘u�r0   r/   ©r   r%  s     r1   Úol_my_func1zETestTargetHierarchySelection.test_specialise_gpu.<locals>.ol_my_func1¿  ó   € ðð ð ð ˆKr0   Úgpuc                 ó   — d„ }|S )Nc                 ó   — d| z   S ©Né
   r/   r6  s    r1   r%  zSTestTargetHierarchySelection.test_specialise_gpu.<locals>.ol_my_func2.<locals>.implÉ  ó   € Ø˜A‘v�r0   r/   r>  s     r1   Úol_my_func2zETestTargetHierarchySelection.test_specialise_gpu.<locals>.ol_my_func2Ç  ó   € ðð ð ð ˆKr0   c                  ó   •—  ‰ d¦  «        S ©Né   r/   ©r7  s   €r1   Údpu_foozATestTargetHierarchySelection.test_specialise_gpu.<locals>.dpu_fooÎ  ó   ø€ à�7˜1‘:”:Ðr0   c                  ó   •—  ‰ d¦  «        S rJ  r/   rL  s   €r1   Úcpu_foozATestTargetHierarchySelection.test_specialise_gpu.<locals>.cpu_fooÒ  rN  r0   r,  é   ©r   rä   r   ÚassertPreciseEqual)rJ   r?  rG  rM  rP  r7  s        @r1   Útest_specialise_gpuz0TestTargetHierarchySelection.test_specialise_gpuº  sö   ø€ ð	ð 	ð 	õ 
�' )Ð	,Ñ	,Ô	,ð	ð 	ñ 
-Ô	,ð	õ 
�' %Ð	(Ñ	(Ô	(ð	ð 	ñ 
)Ô	(ð	õ 
‰Œð	ð 	ð 	ð 	ñ 
Œð	õ 
‰Œð	ð 	ð 	ð 	ñ 
Œð	ð
 	×Ò  ¡	¤	¨1Ñ-Ô-Ð-à×Ò  ¡	¤	¨1Ñ-Ô-Ð-Ð-Ð-r0   c                 ó†  ‡— d„ Št          ‰d¬¦  «        d„ ¦   «         }t          ‰d¬¦  «        d„ ¦   «         }t          ‰d¬¦  «        d„ ¦   «         }t          ¦   «         ˆfd	„¦   «         }t          ¦   «         ˆfd
„¦   «         }|                       |¦   «         d¦  «         |                       |¦   «         d¦  «         d S )Nc                 ó   — d S rQ   r/   r6  s    r1   r7  zATestTargetHierarchySelection.test_specialise_dpu.<locals>.my_funcÝ  r8  r0   r9  r  c                 ó   — d„ }|S )Nc                 ó   — d| z   S r<  r/   r6  s    r1   r%  zSTestTargetHierarchySelection.test_specialise_dpu.<locals>.ol_my_func1.<locals>.implã  r=  r0   r/   r>  s     r1   r?  zETestTargetHierarchySelection.test_specialise_dpu.<locals>.ol_my_func1á  r@  r0   rA  c                 ó   — d„ }|S )Nc                 ó   — d| z   S rD  r/   r6  s    r1   r%  zSTestTargetHierarchySelection.test_specialise_dpu.<locals>.ol_my_func2.<locals>.implë  rF  r0   r/   r>  s     r1   rG  zETestTargetHierarchySelection.test_specialise_dpu.<locals>.ol_my_func2é  rH  r0   r2   c                 ó   — d„ }|S )Nc                 ó   — d| z   S )Néd   r/   r6  s    r1   r%  zSTestTargetHierarchySelection.test_specialise_dpu.<locals>.ol_my_func3.<locals>.impló  s   € Ø˜Q‘w�r0   r/   r>  s     r1   Úol_my_func3zETestTargetHierarchySelection.test_specialise_dpu.<locals>.ol_my_func3ñ  s   € ðð ð ð ˆKr0   c                  ó   •—  ‰ d¦  «        S rJ  r/   rL  s   €r1   rM  zATestTargetHierarchySelection.test_specialise_dpu.<locals>.dpu_fooø  rN  r0   c                  ó   •—  ‰ d¦  «        S rJ  r/   rL  s   €r1   rP  zATestTargetHierarchySelection.test_specialise_dpu.<locals>.cpu_fooü  rN  r0   é]   rQ  rR  )rJ   r?  rG  r^  rM  rP  r7  s         @r1   Útest_specialise_dpuz0TestTargetHierarchySelection.test_specialise_dpuÜ  s  ø€ ð	ð 	ð 	õ 
�' )Ð	,Ñ	,Ô	,ð	ð 	ñ 
-Ô	,ð	õ 
�' %Ð	(Ñ	(Ô	(ð	ð 	ñ 
)Ô	(ð	õ 
�' %Ð	(Ñ	(Ô	(ð	ð 	ñ 
)Ô	(ð	õ 
‰Œð	ð 	ð 	ð 	ñ 
Œð	õ 
‰Œð	ð 	ð 	ð 	ñ 
Œð	ð
 	×Ò  ¡	¤	¨2Ñ.Ô.Ð.à×Ò  ¡	¤	¨1Ñ-Ô-Ð-Ð-Ð-r0   c                 óx  ‡— d„ Št          ‰d¬¦  «        d„ ¦   «         }t          d¬¦  «        ˆfd„¦   «         }t          j        t          j        f}|                      |¦  «        5 } |¦   «          d d d ¦  «         n# 1 swxY w Y   g d¢}|D ]*}|                      |t          |j        ¦  «        ¦  «         Œ+d S )	Nc                 ó   — d S rQ   r/   r6  s    r1   r7  zJTestTargetHierarchySelection.test_no_specialisation_found.<locals>.my_func  r8  r0   Úcudar  c                 ó   — d„ S )Nc                 ó   — d S rQ   r/   r6  s    r1   ú<lambda>zdTestTargetHierarchySelection.test_no_specialisation_found.<locals>.ol_my_func_cuda.<locals>.<lambda>  s   € ˜T€ r0   r/   r6  s    r1   Úol_my_func_cudazRTestTargetHierarchySelection.test_no_specialisation_found.<locals>.ol_my_func_cuda  s
   € à!�>Ð!r0   T©rõ   c                  ó   •—  ‰ d¦  «         d S r<  r/   rL  s   €r1   rM  zJTestTargetHierarchySelection.test_no_specialisation_found.<locals>.dpu_foo  s   ø€ àˆG�A‰JŒJˆJˆJˆJr0   )ú8Function resolution cannot find any matches for functionz-test_no_specialisation_found.<locals>.my_funczfor the current target:z''numba.tests.test_target_extension.DPU')	r   rä   r   ÚUnsupportedErrorÚTypingErrorÚassertRaisesÚassertInÚstrÚ	exception)rJ   ri  rM  ÚacceptÚraisesÚmsgsÚmsgr7  s          @r1   Útest_no_specialisation_foundz9TestTargetHierarchySelection.test_no_specialisation_found  s=  ø€ ð	ð 	ð 	õ 
�' &Ð	)Ñ	)Ô	)ð	"ð 	"ñ 
*Ô	)ð	"õ 
�tÐ	Ñ	Ô	ð	ð 	ð 	ð 	ñ 
Ô	ð	õ
 Ô)­6Ô+=Ð>ˆØ×Ò˜vÑ&Ô&ð 	¨&ØˆG‰IŒIˆIð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð;ð ;ð ;ˆð
 ð 	6ð 	6ˆCØ�MŠM˜#�s 6Ô#3Ñ4Ô4Ñ5Ô5Ð5Ð5ð	6ð 	6s   Á'A>Á>BÂBc                 ó  — |                       t          j        ¦  «        5 }t          d¬¦  «        d„ ¦   «         } |¦   «          d d d ¦  «         n# 1 swxY w Y   d}|                      |t          |j        ¦  «        ¦  «         d S )NÚinvalid_silicon)Ú_targetc                  ó   — d S rQ   r/   r/   r0   r1   ÚfoozATestTargetHierarchySelection.test_invalid_target_jit.<locals>.foo%  s   € à�r0   ú1No target is registered against 'invalid_silicon')ro  r   ÚNumbaValueErrorr   rp  rq  rr  )rJ   rt  r|  rv  s       r1   Útest_invalid_target_jitz4TestTargetHierarchySelection.test_invalid_target_jit"  sË   € à×Ò�vÔ5Ñ6Ô6ð 	¸&ÝÐ+Ð,Ñ,Ô,ðð ñ -Ô,ðð ˆC‰EŒEˆEð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð BˆØ�Š�c�3˜vÔ/Ñ0Ô0Ñ1Ô1Ð1Ð1Ð1s    $AÁAÁAc                 ó<  ‡— d„ Š|                       t          j        ¦  «        5 }t          ‰d¬¦  «        d„ ¦   «         }t          ˆfd„¦   «         } |¦   «          d d d ¦  «         n# 1 swxY w Y   d}|                      |t          |j        ¦  «        ¦  «         d S )Nc                  ó   — d S rQ   r/   r/   r0   r1   ÚbarzFTestTargetHierarchySelection.test_invalid_target_overload.<locals>.bar0  r8  r0   ry  r  c                  ó   — d„ S )Nc                  ó   — d S rQ   r/   r/   r0   r1   rh  z[TestTargetHierarchySelection.test_invalid_target_overload.<locals>.ol_bar.<locals>.<lambda>8  s   €  € r0   r/   r/   r0   r1   Úol_barzITestTargetHierarchySelection.test_invalid_target_overload.<locals>.ol_bar6  s
   € à$�}Ð$r0   c                  ó   •—  ‰ ¦   «          d S rQ   r/   )r‚  s   €r1   r|  zFTestTargetHierarchySelection.test_invalid_target_overload.<locals>.foo:  s   ø€ à�‘”���r0   r}  )ro  r   rn  r   r   rp  rq  rr  )rJ   rt  r…  r|  rv  r‚  s        @r1   Útest_invalid_target_overloadz9TestTargetHierarchySelection.test_invalid_target_overload.  s  ø€ ð	ð 	ð 	ð
 ×Ò�vÔ1Ñ2Ô2ð 		°fÝ�cÐ"3Ð4Ñ4Ô4ð%ð %ñ 5Ô4ð%õ ðð ð ð ñ ŒTðð ˆC‰EŒEˆEð		ð 		ð 		ñ 		ô 		ð 		ð 		ð 		ð 		ð 		ð 		øøøð 		ð 		ð 		ð 		ð BˆØ�Š�c�3˜vÔ/Ñ0Ô0Ñ1Ô1Ð1Ð1Ð1s   ¤7A'Á'A+Á.A+c                 ó   ‡‡‡— t          d¬¦  «        d„ ¦   «         Št          d¬¦  «        d„ ¦   «         Št          d¬¦  «        d„ ¦   «         Št          ˆfd„¦   «         }|                       |¦   «         d	¦  «         t          ˆfd
„¦   «         }|                       |¦   «         d¦  «         t          ˆfd„¦   «         }t          j        t          j        f}|                      |¦  «        5 } |¦   «          ddd¦  «         n# 1 swxY w Y   g d¢}|D ]*}|                      |t          |j	        ¦  «        ¦  «         Œ+t          d¬¦  «        ˆfd„¦   «         }|                       |¦   «         d¦  «         t          d¬¦  «        ˆfd„¦   «         }	|                       |	¦   «         d¦  «         t          d¬¦  «        ˆfd„¦   «         }
t          j        t          j        f}|                      |¦  «        5 } |
¦   «          ddd¦  «         n# 1 swxY w Y   g d¢}|D ]*}|                      |t          |j	        ¦  «        ¦  «         Œ+dS )z£
        Test to make sure that targets can share generic implementations and
        cannot reach implementations that are not in their target hierarchy.
        r9  r  c                 ó(   —  |||¦  «        }d„ }||fS )Nc                 ó   —  |j         |Ž S rQ   )Úmulr  s       r1   r|   zcTestTargetHierarchySelection.test_intrinsic_selection.<locals>.intrin_math_generic.<locals>.codegenN  ó   € Ø"�w”{ FÐ+Ð+r0   r/   r  s        r1   Úintrin_math_genericzRTestTargetHierarchySelection.test_intrinsic_selection.<locals>.intrin_math_genericJ  ó,   € à�!�A�q‘'”'ˆCð,ð ,ð ,ð ˜�<Ðr0   r2   c                 ó(   —  |||¦  «        }d„ }||fS )Nc                 ó   —  |j         |Ž S rQ   r  r  s       r1   r|   z_TestTargetHierarchySelection.test_intrinsic_selection.<locals>.intrin_math_dpu.<locals>.codegenW  rŒ  r0   r/   r  s        r1   Úintrin_math_dpuzNTestTargetHierarchySelection.test_intrinsic_selection.<locals>.intrin_math_dpuS  rŽ  r0   r   c                 ó(   —  |||¦  «        }d„ }||fS )Nc                 ó   —  |j         |Ž S rQ   )Úaddr  s       r1   r|   z_TestTargetHierarchySelection.test_intrinsic_selection.<locals>.intrin_math_cpu.<locals>.codegen`  rŒ  r0   r/   r  s        r1   Úintrin_math_cpuzNTestTargetHierarchySelection.test_intrinsic_selection.<locals>.intrin_math_cpu\  rŽ  r0   c                  ó   •—  ‰ dd¦  «        S ©Nr,  é   r/   ©r•  s   €r1   Úcpu_foo_specificzOTestTargetHierarchySelection.test_intrinsic_selection.<locals>.cpu_foo_specificf  ó   ø€ à"�? 1 aÑ(Ô(Ð(r0   rK  c                  ó   •—  ‰ dd¦  «        S r—  r/   ©r�  s   €r1   Úcpu_foo_genericzNTestTargetHierarchySelection.test_intrinsic_selection.<locals>.cpu_foo_genericm  ó   ø€ à&Ð& q¨!Ñ,Ô,Ð,r0   é   c                  ó   •—  ‰ dd¦  «        S r—  r/   ©r‘  s   €r1   Úcpu_foo_dpuzJTestTargetHierarchySelection.test_intrinsic_selection.<locals>.cpu_foo_dput  r›  r0   N)rl  zintrinsic intrin_math_dpuúfor the current targetTrj  c                  ó   •—  ‰ dd¦  «        S r—  r/   r¢  s   €r1   Údpu_foo_specificzOTestTargetHierarchySelection.test_intrinsic_selection.<locals>.dpu_foo_specificƒ  r›  r0   r¸   c                  ó   •—  ‰ dd¦  «        S r—  r/   r�  s   €r1   Údpu_foo_genericzNTestTargetHierarchySelection.test_intrinsic_selection.<locals>.dpu_foo_genericŠ  rŸ  r0   c                  ó   •—  ‰ dd¦  «        S r—  r/   r™  s   €r1   Údpu_foo_cpuzJTestTargetHierarchySelection.test_intrinsic_selection.<locals>.dpu_foo_cpu‘  r›  r0   )rl  zintrinsic intrin_math_cpur¤  )r   r   r0  r   rm  rn  ro  rp  rq  rr  rä   )rJ   rš  rž  r£  rs  rt  ru  rv  r¦  r¨  rª  r•  r‘  r�  s              @@@r1   Útest_intrinsic_selectionz5TestTargetHierarchySelection.test_intrinsic_selectionC  s˜  øøø€ õ 
˜)Ð	$Ñ	$Ô	$ð	 ð 	 ñ 
%Ô	$ð	 õ 
˜%Ð	 Ñ	 Ô	 ð	 ð 	 ñ 
!Ô	 ð	 õ 
˜%Ð	 Ñ	 Ô	 ð	 ð 	 ñ 
!Ô	 ð	 õ 
ð	)ð 	)ð 	)ð 	)ñ 
Œð	)ð 	×ÒÐ)Ð)Ñ+Ô+¨QÑ/Ô/Ð/õ 
ð	-ð 	-ð 	-ð 	-ñ 
Œð	-ð 	×Ò˜˜Ñ*Ô*¨BÑ/Ô/Ð/õ 
ð	)ð 	)ð 	)ð 	)ñ 
Œð	)õ Ô)­6Ô+=Ð>ˆØ×Ò˜vÑ&Ô&ð 	¨&ØˆK‰MŒMˆMð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð+ð +ð +ˆð ð 	6ð 	6ˆCØ�MŠM˜#�s 6Ô#3Ñ4Ô4Ñ5Ô5Ð5Ð5õ 
�tÐ	Ñ	Ô	ð	)ð 	)ð 	)ð 	)ñ 
Ô	ð	)ð 	×ÒÐ)Ð)Ñ+Ô+¨RÑ0Ô0Ð0õ 
�tÐ	Ñ	Ô	ð	-ð 	-ð 	-ð 	-ñ 
Ô	ð	-ð 	×Ò˜˜Ñ*Ô*¨BÑ/Ô/Ð/õ 
�tÐ	Ñ	Ô	ð	)ð 	)ð 	)ð 	)ñ 
Ô	ð	)õ Ô)­6Ô+=Ð>ˆØ×Ò˜vÑ&Ô&ð 	¨&ØˆK‰MŒMˆMð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð+ð +ð +ˆð ð 	6ð 	6ˆCØ�MŠM˜#�s 6Ô#3Ñ4Ô4Ñ5Ô5Ð5Ð5ð	6ð 	6s$   Ã.DÄD	ÄD	Ç;HÈHÈHc                 ó  ‡‡	‡
— d„ Š	t          d¬¦  «        ˆ	fd„¦   «         Š
t          t          j        ddddi¬¦  «        ˆ
fd	„¦   «         }t	          t
          j        dddi¬¦  «        d
„ ¦   «         }d„ Št	          ‰dddi¬¦  «        d„ ¦   «         }ddlm}  |d¦  «        5  t          d¬¦  «        ˆfd„¦   «         } |¦   «         }d d d ¦  «         n# 1 swxY w Y   ddl
m} |                      ||j        ¦  «         d S )Nc                 óJ  — |j         |j         k    r|S |j         |j         k     r)|                     ||                      |¦  «        ¦  «        S |j        r)|                     ||                      |¦  «        ¦  «        S |                     ||                      |¦  «        ¦  «        S rQ   )ÚbitwidthÚtruncr  ÚsignedÚsextÚzext)rý   r‡   r  r  r  s        r1   Úcast_integerzKTestTargetHierarchySelection.test_overload_allocation.<locals>.cast_integer   s˜   € àŒ} ¤Ò/Ð/à�
Ø” ¤Ò0Ð0à—}’} S¨'×*@Ò*@ÀÑ*FÔ*FÑGÔGÐGØ”ð Gà—|’| C¨×)?Ò)?ÀÑ)EÔ)EÑFÔFÐFð —|’| C¨×)?Ò)?ÀÑ)EÔ)EÑFÔFÐFr0   r2   r  c                 óx   •— ˆfd„}ddl m} t          j        t          j        ¦  «        } ||||¦  «        }||fS )z;Intrinsic to call into the allocator for Array
            c                 ó’   •— |\  }} ‰| |||j         d         t          j        ¦  «        }| j                             |||¦  «        }|S r<  )rè   r   Úuint32ÚnrtÚmeminfo_alloc_aligned)	rý   r‡   Ú	signaturerè   Ú	allocsizeÚalignÚ	align_u32Úmeminfor³  s	           €r1   r|   z\TestTargetHierarchySelection.test_overload_allocation.<locals>.intrin_alloc.<locals>.codegen³  s[   ø€ Ø%)Ñ"�˜Eð )˜L¨°'¸5Ø)2¬¸Ô):½E¼LñJô J�	à!œ+×;Ò;¸GÀYØ<EñGô G�à�r0   r   )r¹  )Únumba.core.typingr¹  r   ÚMemInfoPointerÚvoidptr)Ú	typingctxrº  r»  r|   r¹  ÚmiprN   r³  s          €r1   Úintrin_alloczKTestTargetHierarchySelection.test_overload_allocation.<locals>.intrin_alloc¯  s_   ø€ ð	ð 	ð 	ð 	ð 	ð 4Ð3Ð3Ð3Ð3Ð3ÝÔ&¥u¤}Ñ5Ô5ˆCØ�)˜C ¨EÑ2Ô2ˆCØ˜�<Ðr0   Ú	_allocaterõ   T)r  Újit_optionsc                 ó   •— ˆfd„}|S )Nc                 ó   •—  ‰||¦  «        S rQ   r/   )Úclsrº  r»  rÃ  s      €r1   r%  zaTestTargetHierarchySelection.test_overload_allocation.<locals>._ol_arr_allocate_dpu.<locals>.implÆ  s   ø€ Ø#�| I¨uÑ5Ô5Ð5r0   r/   )rÈ  rº  r»  r%  rÃ  s       €r1   Ú_ol_arr_allocate_dpuzSTestTargetHierarchySelection.test_overload_allocation.<locals>._ol_arr_allocate_dpuÃ  s!   ø€ ð6ð 6ð 6ð 6ð 6àˆKr0   c                 ó   — d„ }|S )Nc                 óB   — t           j                             | d¦  «        S rJ  )r   ÚArrayrÄ  )Úns    r1   r%  zZTestTargetHierarchySelection.test_overload_allocation.<locals>.ol_empty_impl.<locals>.implÌ  s   € Ý”{×,Ò,¨Q°Ñ2Ô2Ð2r0   r/   )rÍ  r%  s     r1   Úol_empty_implzLTestTargetHierarchySelection.test_overload_allocation.<locals>.ol_empty_implÊ  s   € ð3ð 3ð 3àˆKr0   c                  ó   — d S rQ   r/   r/   r0   r1   Úbuffer_funczJTestTargetHierarchySelection.test_overload_allocation.<locals>.buffer_funcÐ  r8  r0   c                  ó   — d„ } | S )Nc                  ó*   — t          j        d¦  «        S rD  )ÚnpÚemptyr/   r0   r1   r%  z`TestTargetHierarchySelection.test_overload_allocation.<locals>.ol_buffer_func_impl.<locals>.implÕ  s   € Ý”x ‘|”|Ð#r0   r/   )r%  s    r1   Úol_buffer_func_implzRTestTargetHierarchySelection.test_overload_allocation.<locals>.ol_buffer_func_implÓ  s   € ð$ð $ð $àˆKr0   r   )r   rj  c                  ó   •—  ‰ ¦   «         S rQ   r/   )rÐ  s   €r1   r|  zBTestTargetHierarchySelection.test_overload_allocation.<locals>.fooÝ  s   ø€ à"�{‘}”}Ð$r0   )r·  )r   r	   r   rÌ  r   rÓ  rÔ  Únumba.core.target_extensionr   rä   Únumba.core.runtimer·  ÚassertIsInstanceÚMemInfo)rJ   rÉ  rÎ  rÕ  r   r|  Úrr·  rÐ  r³  rÃ  s           @@@r1   Útest_overload_allocationz5TestTargetHierarchySelection.test_overload_allocationŸ  sê  øøø€ ð	Gð 	Gð 	Gõ 
˜%Ð	 Ñ	 Ô	 ð	 ð 	 ð 	 ð 	 ñ 
!Ô	 ð	 õ& 
�eœk¨;¸uØ+5°dÐ*;ð
=ñ 
=ô 
=ð	ð 	ð 	ð 	ñ
=ô 
=ð	õ
 
•"”( 5°zÀ$Ð6GÐ	HÑ	HÔ	Hð	ð 	ñ 
IÔ	Hð	ð
	ð 	ð 	õ 
�+ e¸*ÀTÐ9JÐ	KÑ	KÔ	Kð	ð 	ñ 
LÔ	Kð	ð
 	@Ð?Ð?Ð?Ð?Ð?ð ˆ_˜UÑ#Ô#ð 	ð 	Ý˜4Ð Ñ Ô ð%ð %ð %ð %ñ !Ô ð%à�‘”ˆAð		ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð
 	+Ð*Ð*Ð*Ð*Ð*Ø×Ò˜a ¤Ñ-Ô-Ð-Ð-Ð-s   Â$&CÃCÃCN)r,   r-   r.   Ú__doc__r3  rT  rb  rw  r  r‡  r«  rÜ  r/   r0   r1   r*  r*  ¨  s¤   € € € € € ð9ð 9ðBð Bð Bð .ð  .ð  .ðD(.ð (.ð (.ðT6ð 6ð 6ð8
2ð 
2ð 
2ð2ð 2ð 2ð*Z6ð Z6ð Z6ðxC.ð C.ð C.ð C.ð C.r0   r*  c                   ó   — e Zd ZdZd„ ZdS )ÚTestTargetOffloada   In this use case the CPU compilation pipeline is extended with a new
     compilation pass that runs just prior to lowering. The pass looks for
     function calls and when it finds one it sees if there's a DPU function
     available that is a valid overload for the function call. If there is one
     then it swaps the CPU implementation out for a DPU implementation. This
     producing an "offload" effect.
    c                 ób  ‡‡— dŠt          t          j        d¬¦  «        d„ ¦   «         }t          d¬¦  «        d„ ¦   «         }|                       |d¦  «        d	¦  «         t
          d
„ ¦   «         }|                       |d¦  «        t          j        d¦  «        ¦  «         t          dd¬¦  «         G ˆfd„dt          ¦  «        ¦   «         Š G ˆfd„dt          ¦  «        }t          |¬¦  «        d„ ¦   «         }|                       |d¦  «        d	t          j	        d¦  «        f¦  «         d S )NFr2   r  c                 ó   — d„ }|S )Nc                 ó   — dS )Nç    ¼,Ar/   r6  s    r1   Údpu_sin_implzQTestTargetOffload.test_basic_offload.<locals>.ol_np_sin_DPU.<locals>.dpu_sin_implõ  s   € Ø�xr0   r/   )r   rä  s     r1   Úol_np_sin_DPUz;TestTargetOffload.test_basic_offload.<locals>.ol_np_sin_DPUó  s   € ð ð  ð  ð  Ðr0   Trj  c                 ó*   — t          j        | ¦  «        S rQ   ©rÓ  Úsinr6  s    r1   r|  z1TestTargetOffload.test_basic_offload.<locals>.fooû  ó   € å”6˜!‘9”9Ðr0   é   rã  c                 ó*   — t          j        | ¦  «        S rQ   rç  r6  s    r1   r|  z1TestTargetOffload.test_basic_offload.<locals>.foo  ré  r0   )Úmutates_CFGÚanalysis_onlyc                   ó$   •— e Zd ZdZd„ Zˆ fd„ZdS )ú@TestTargetOffload.test_basic_offload.<locals>.DispatcherSwitcherÚDispatcherSwitcherc                 ó.   — t          j        | ¦  «         d S rQ   )r'   rê   rS   s    r1   rê   zITestTargetOffload.test_basic_offload.<locals>.DispatcherSwitcher.__init__  s   € ÝÔ% dÑ+Ô+Ð+Ð+Ð+r0   c           
      ót  •— |j         }d}|j                             ¦   «         D �]}|                     d¦  «        D ]ù}|j        |j        j                 }d}t          |¦  «        5  	 |                     |j	        |j
        |         j        i ¦  «        }t          |¦  «        }	|	j        j        }
|
                     ||¦  «         n># t           $ r1}‰rd|› d|› d|› �}t#          |¦  «         Y d }~d d d ¦  «         ŒÀd }~ww xY w|j        j        |
_        ||_        d}d d d ¦  «         n# 1 swxY w Y   Œú�Œ|S )NFÚcallr2   z+Failed to find and compile an overload for z for z due to T)Úfunc_irÚblocksÚvaluesÚ
find_exprsÚtypemaprð   rD   r   Úget_call_typerÁ  Ú	calltypesrè   r   râ   rÊ   Úget_functionÚ	ExceptionÚprintÚ	targetctxÚ_codelib_stackr  )rJ   Ústaterô  ÚmutatedÚblkró  ÚfunctionÚtnamerN   rù   Úhw_ctxÚerv  Ú_DEBUGs                €r1   Úrun_passzITestTargetOffload.test_basic_offload.<locals>.DispatcherSwitcher.run_pass  sæ  ø€ Øœ-�Ø�Ø"œ>×0Ò0Ñ2Ô2ð ++ñ ++�Cð !$§¢¨vÑ 6Ô 6ð (+ð (+˜Ø#(¤=°´´Ô#@˜Ø %˜õ -¨UÑ3Ô3ð "+ð "+ð)Ø&.×&<Ò&<Ø$)¤OØ$)¤O°DÔ$9Ô$>Ø$&ñ'"ô '" õ
 (CÀ5Ñ'IÔ'I à)-Ô)9Ô)H Ø &× 3Ò 3°H¸cÑ BÔ BÐ BÐ BøÝ#,ð )ð )ð )Ø#)ð !/ð)6Ø8@ð)6ð )6ØGLð)6ð )6à23ð)6ð )6ð %(õ
 %*¨#¡J¤J JØ (   ð'"+ð "+ð "+ñ "+ô "+ð "+ð "+øøøøð)øøøð !&¤Ô >ð #Ô1ð +0˜DœKØ&*˜GðE"+ð "+ð "+ñ "+ô "+ð "+ð "+ð "+ð "+ð "+ð "+øøøð "+ð "+ð "+ð "+øñ(+ðT �s=   Á&D*Á(ACÃD*Ã
D	ÃC<	Ã,D*Ã<D	ÄD*Ä*D.Ä1D.N)r,   r-   r.   Ú_namerê   r  )r  s   €r1   rð  rï  	  sB   ø€ € € € € à(ˆEð,ð ,ð ,ð0ð 0ð 0ð 0ð 0ð 0ð 0r0   rð  c                   ó   •— e Zd Zˆ fd„ZdS )ú@TestTargetOffload.test_basic_offload.<locals>.DPUOffloadCompilerc                 óš   •— t          j        | j        ¦  «        }|                     ‰t          ¦  «         |                     ¦   «          |gS rQ   )r&   Údefine_nopython_pipeliner   Úadd_pass_afterr)   Úfinalize)rJ   Úpmrð  s     €r1   Údefine_pipelineszQTestTargetOffload.test_basic_offload.<locals>.DPUOffloadCompiler.define_pipelinesD  sA   ø€ Ý'Ô@ÀÄÑLÔL�Ø×!Ò!Ð"4Õ6GÑHÔHÐHØ—’‘”�Ø�t�r0   N)r,   r-   r.   r  )rð  s   €r1   ÚDPUOffloadCompilerr  C  s.   ø€ € € € € ðð ð ð ð ð ð r0   r  )rö   c                 óR   — t          j        | ¦  «        t          j        | ¦  «        fS rQ   )rÓ  rè  Úcosr6  s    r1   r|  z1TestTargetOffload.test_basic_offload.<locals>.fooL  s   € å”6˜!‘9”9�bœf Q™iœiÐ'Ð'r0   )
r   rÓ  rè  rä   rS  r   r(   r'   r%   r  )rJ   rå  r|  r  rð  r  s       @@r1   Útest_basic_offloadz$TestTargetOffload.test_basic_offloadî  sš  øø€ àˆõ 
•"”& Ð	'Ñ	'Ô	'ð	 ð 	 ñ 
(Ô	'ð	 õ 
�tÐ	Ñ	Ô	ð	ð 	ñ 
Ô	ð	ð 	×Ò   A¡¤¨Ñ1Ô1Ð1õ 
ð	ð 	ñ 
Œð	ð 	×Ò   A¡¤­¬¨q©	¬	Ñ2Ô2Ð2å	 5¸Ð	>Ñ	>Ô	>ð6	ð 6	ð 6	ð 6	ð 6	ð 6	ð 6	¥ñ 6	ô 6	ñ 
?Ô	>ð6	ðr	ð 	ð 	ð 	ð 	ð 	ð 	¥ñ 	ô 	ð 	õ 
Ð/Ð	0Ñ	0Ô	0ð	(ð 	(ñ 
1Ô	0ð	(ð 	×Ò   A¡¤¨µ2´6¸!±9´9Ð(=Ñ>Ô>Ð>Ð>Ð>r0   N)r,   r-   r.   rÝ  r  r/   r0   r1   rß  rß  å  s2   € € € € € ðð ðb?ð b?ð b?ð b?ð b?r0   rß  Ú__main__)_rÝ  ÚunittestÚnumba.tests.supportr   rÍ   r]   ÚoperatorÚ	functoolsr   ÚnumpyrÓ  Únumbar   r   Únumba.extendingr   r   r	   r×  r
   r   r   r   r   r   r   Ú
numba.corer   r   r   Únumba.core.dispatcherr   Únumba.core.descriptorsr   r   r   r   Únumba.core.baser   Únumba.core.compiler_lockr   r   Únumba.core.codegenr   r   Únumba.core.callwrapperr   Únumba.core.imputilsr   r    r!   Úllvmlite.bindingÚbindingrA   Úllvmliter"   r«   rØ  r#   r$   Únumba.core.compilerr%   r&   Únumba.core.compiler_machineryr'   r(   Únumba.core.typed_passesr)   r+   r4   rr   rh   ÚobjectrÆ   rÐ   rá   rà   rä   Úlower_constantÚDummyr   Ú
lower_castÚIntegerLiteralr'  r
  r  ÚFloatr  r"  r”  r(  r*  rß  r,   Úmainr/   r0   r1   ú<module>r3     sš  ððð ð €€€Ø (Ð (Ð (Ð (Ð (Ð (Ø Ð Ð Ð Ø €€€Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð Ð Ð Ø EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ Eðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 3Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø Ð Ð Ð Ð Ð Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $à Ð Ð Ð Ð Ð Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø EÐ EÐ EÐ EÐ EÐ EÐ EÐ EØ 5Ð 5Ð 5Ð 5Ð 5Ð 5ðð ð ð ð ˆ#ñ ô ð ð €�Ñ ð
*-ð *-ð *-ð *-ð *-�Jñ *-ô *-ð *-ð\ !˜™
œ
Ð ð
Eð Eð Eð Eð E�ñ Eô Eð EðRDð Dð Dð Dð D�Vñ Dô Dð Dð )Cð )Cð )Cð )Cð )CÐ ñ )Cô )Cð )CðZ ˆY�uÑÔ€
ðð ð ð ð �Jñ ô ð ð /<Ð �O EÔ*Ñ +ð
%
ð %
ð %
ð %
ð %
ˆ<ñ %
ô %
ð %
ðT (,€ˆ_˜UÔ#Ñ $ð ×%Ò% e¤kÑ2Ô2ð%ð %ñ 3Ô2ð%ð
 ×!Ò! %Ô"6¸¼ÑFÔFðAð Añ GÔFðAð ×%Ò% e¤mÑ4Ô4ðð ñ 5Ô4ðð ×%Ò% e¤kÑ2Ô2ðð ñ 3Ô2ðð €�%ÐÑÔðð ñ Ôðð 
€ˆ(Œ,˜uÐ%Ñ%Ô%ðð ñ &Ô%ððz.ð z.ð z.ð z.ð z. 8ñ z.ô z.ð z.ðz	k?ð k?ð k?ð k?ð k?˜ñ k?ô k?ð k?ð\ ˆzÒÐØ€H„M�O„O€O€O€Oð Ðr0   