+
    :ip                     
   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ^ RIHtHtHt ^ RIHt ^ RIt^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIt^ RIHtHtHtH t HtH!t!H"t"H#t#H$t$H%t%H&t& ^ R	IH't'H(t( ^ R
I)H*t*H+t+ ^ RI,H-t-H.t. ^ RI/H0t0H1t1 ^ RI2H3t3 ^ RI4H5t5H6t6 ^ RI7H8t8H9t9H:t:H;t;H<t<H=t=H>t>H?t?H@t@HAtAHBtBHCtCHDtDHEtEHFtFHGtGHHtHHItIHJtJHKtKHLtLHMtMHNtNHOtOHPtPHQtQHRtRHStSHTtTHUtUHVtVHWtWHXtXHYtYHZtZH[t[H\t\H]t]H^t^H_t_H`t`HataHbtb ^ RIcHdtdHeteHftfHgtg ^ RIhHiti ^ RIjHktkHltl ^ RImHntn ^ RIoHptpHqtqHrtrHstsHtttHutu ^ RI4Hvtv ^ RIt^ RIwtw^ RIwtx^ RIyHztz ^ RI{t^ RI|H}t} ^Pt~]P                  ! ]~RR7      tR tRtR t]v! ]4      R 4       t ! R R]4      tR tR  tR! tR" tR# tR$ tR% tR& tR' tR( tR) tR* tR+ tR,R/R- ltR. tRR/ RR0 R]R]R]R]R]R]R]R]R]R]R]R]/tR1 tR2]/t]5R3 4       t]5R4 4       t]5R5 4       t]5R6 4       t]! R7R8R9.4      tR]! R:]4      R]! R;]4      R]! R<]4      R]! R=]4      R]! R<]4      R]! R=]4      /t ! R> R?]4      t ! R@ RA]EP@                  ]EPB                  4      tRB t]]zEPH                  ]&    ! RC RD]4      t ! RE RF]4      tRG t ! RH RI4      t ! RJ RK4      tRL t ! RM RN4      tRRO ltRP t ! RQ RR4      t ! RS RT4      t ! RU RV4      tRW t ! RX RY]4      t ! RZ R[]4      t ! R\ R]]4      tR^ tR_ tR` tRa tRb tRc tRd tRe tRf tRg tRh tRi tRj tRk tRl tRm tRn t]! Ro. RORpRq7      tRRr ltRs tRt tRu tRv tRw tRx tRy t]]&EP                  ]&   RRz lt]]!EP                  ]&   R{ t]]!EP                  ]&   R| t]]"EP                  ]&   RR} ltRR~ ltR tR tR tR t]! R. RO4      tR tR tR tRR ltR tR tR tR t]]&EP                  ]&   R tR tR t]]&EP                  ]&   R tRR ltRR ltR t]]&EP                  ]&   R t]]&EP                  ]&   RR ltR tR tR tRR lt]]&EP                  ]&   RR lt]]&EP                  ]&   RR lt]]&EP                  ]&   R t]]&EP                  ]&   R t]]&EP                  ]&   R t]]$EP                   ]&   RR lEtE]]&EP                  ]&   ]R 4       Et]0! ]4       ! R R]14      4       EtR EtR# )a  
This module transforms data-parallel operations such as Numpy calls into
'Parfor' nodes, which are nested loops that can be parallelized.
It also implements optimizations such as loop fusion, and extends the rest of
compiler analysis and optimizations to support Parfors.
This is similar to ParallelAccelerator package in Julia:
https://github.com/IntelLabs/ParallelAccelerator.jl
'Parallelizing Julia with a Non-invasive DSL', T. Anderson et al., ECOOP'17.
N)reduce)defaultdictOrderedDict
namedtuple)contextmanager)make_dataclass)ir)impl_ret_untracked)typestypingutilserrorsr   analysispostprocrewrites	typeinferconfigir_utils)prangepndindex)datetime_minimumdatetime_maximum)as_dtypenumpy_version)infer_globalAbstractTemplate)StencilPass)register_jitablelower_builtin)+mk_unique_var
next_labelmk_allocget_np_ufunc_typmk_range_blockmk_loop_headerget_name_var_tablereplace_varsreplace_vars_inner
visit_varsvisit_vars_innerremove_deadcopy_propagateget_block_copiesapply_copy_propagatedprint_func_irfind_topo_orderget_stmt_writesrename_labelsget_call_tablesimplifysimplify_CFGhas_no_side_effectcanonicalize_array_mathadd_offset_to_labelsfind_callnamefind_build_sequenceguardrequireGuardExceptioncompile_to_numba_irget_definitionbuild_definitionsreplace_arg_nodesreplace_returns
is_getitem
is_setitemis_get_setitemindex_var_of_get_setitemset_index_var_of_get_setitemfind_potential_aliasesreplace_var_namestransfer_scope)compute_use_defscompute_live_mapcompute_dead_mapscompute_cfg_from_blocks)CFGraph)npydecl	signature)Function)random_int_argsrandom_1arg_sizerandom_2arg_sizelastrandom_3arg_sizelastrandom_callsassert_equiv)overload)array_analysis)stencilparforF)widthdrop_whitespacec                     V P                  4        F0  p\        P                  V4       Uu. uF  p\        V4      NK  	   pK2  	  R # u upi N)
splitlines_txtwrapperwrapprint)xlys   &  R/var/www/html/photoedit/myenv/lib/python3.14/site-packages/numba/parfors/parfor.pyprint_wrappedrg   j   s8    \\^&++A./.aq./ /s   Ac                      R # r^    ri       rf   init_prangerk   s   s    
rj   c                      R  p V # )c                      R # r^   ri   ri   rj   rf   no_op#init_prange_overload.<locals>.no_opx   s    rj   ri   )rn   s    rf   init_prange_overloadrp   v   s    Lrj   c                   &   a  ] tR t^|t o R tRtV tR# )internal_prangec                    \        V!  # r^   )range)clsargss   &*rf   __new__internal_prange.__new__~   s    d|rj   ri   N)__name__
__module____qualname____firstlineno__rw   __static_attributes____classdictcell____classdict__s   @rf   rr   rr   |   s      rj   rr   c                     VP                   ^ 8X  d   R pV# VP                   ^8X  dF   \        VP                  \        P                  \        P
                  34      '       d   R pV# R p V# R pV# )    c                     V R,          # Nri   ri   in_arrs   &rf   min_1 min_parallel_impl.<locals>.min_1       ":rj   c                 z   \         P                  P                  P                  4        \	        \        V 4      4       \         P                  P                  P                  V P                  4      p\         P                  P                  P                  \        V 4      4       F  p\        WV,          4      pK  	  V# r^   )numbaparforsparforrk   min_checkerlencpythonbuiltinsget_type_max_valuedtyperr   r   r   valis   &  rf   r   r      y    $$002CK(mm,,??M--==c&kJA*3q	:C K
rj   c                 z   \         P                  P                  P                  4        \	        \        V 4      4       \         P                  P                  P                  V P                  4      p\         P                  P                  P                  \        V 4      4       F  p\        WV,          4      pK  	  V# r^   )r   r   r   rk   r   r   r   r   r   r   rr   minr   s   &  rf   r   r      y    $$002CK(mm,,??M--==c&kJAc!9-C K
rj   c                 V   \         P                  P                  P                  4        \	        \        V 4      4       \         P                  P                  P                  V P                  4      p\         P                  ! V P                  4       F  p\        WV,          4      pK  	  V# r^   )r   r   r   rk   r   r   r   r   r   r   r   shaper   r   s   &  rf   r   r      l    MM  ,,.F$--((;;FLLIC^^FLL1#ay) 2Jrj   ndim
isinstancer   r
   
NPDatetimeNPTimedelta)return_typeargr   s   && rf   min_parallel_implr      sn     xx1}	8 L5 
Qcii%"2"2E4E4E!FGG. L L	 Lrj   c                     VP                   ^ 8X  d   R pV# VP                   ^8X  dF   \        VP                  \        P                  \        P
                  34      '       d   R pV# R p V# R pV# )r   c                     V R,          # r   ri   r   s   &rf   max_1 max_parallel_impl.<locals>.max_1   r   rj   c                 z   \         P                  P                  P                  4        \	        \        V 4      4       \         P                  P                  P                  V P                  4      p\         P                  P                  P                  \        V 4      4       F  p\        WV,          4      pK  	  V# r^   )r   r   r   rk   max_checkerr   r   r   get_type_min_valuer   rr   r   r   s   &  rf   r   r      r   rj   c                 z   \         P                  P                  P                  4        \	        \        V 4      4       \         P                  P                  P                  V P                  4      p\         P                  P                  P                  \        V 4      4       F  p\        WV,          4      pK  	  V# r^   )r   r   r   rk   r   r   r   r   r   r   rr   maxr   s   &  rf   r   r      r   rj   c                 V   \         P                  P                  P                  4        \	        \        V 4      4       \         P                  P                  P                  V P                  4      p\         P                  ! V P                  4       F  p\        WV,          4      pK  	  V# r^   )r   r   r   rk   r   r   r   r   r   r   r   r   r   r   s   &  rf   r   r      r   rj   r   )r   r   r   s   && rf   max_parallel_implr      sl    
xx1}	8 L5 
Qcii%"2"2E4E4E!FGG. L L	 Lrj   c                 ,   \         P                  P                  P                  4        \	        \        V 4      4       V P                  4       p\         P                  P                  P                  VP                  4      p\        P                  P                  ^ V4      p\         P                  P                  P                  \        V4      4       F4  p\        P                  P                  WAV,          4      p\        W54      pK6  	  VP                  # r   )r   r   r   rk   argmin_checkerr   ravelr   r   r   r   r   
IndexValuerr   r   indexr   Ainit_valivalr   	curr_ivals   &     rf   argmin_parallel_implr          	MM$$&3v;A}}%%88AH??%%a2D]]!!11#a&9OO..qA$7	4# : ::rj   c                 ,   \         P                  P                  P                  4        \	        \        V 4      4       V P                  4       p\         P                  P                  P                  VP                  4      p\        P                  P                  ^ V4      p\         P                  P                  P                  \        V4      4       F4  p\        P                  P                  WAV,          4      p\        W54      pK6  	  VP                  # r   )r   r   r   rk   argmax_checkerr   r   r   r   r   r   r   r   rr   r   r   r   s   &     rf   argmax_parallel_implr      r   rj   c                 >   \         P                  P                  P                  4        V P                  ^ ,          pVP                  ^ ,          p^ p\         P                  P                  P                  V4       F  pW@V,          W,          ,          ,          pK!  	  V# r   )r   r   r   rk   r   rr   )abrd   msr   s   &&    rf   dotvv_parallel_implr      so    	MM$$&	
A	
A 	
A]]!!11!4	qTAD[ 5Hrj   c                 f   \         P                  P                  P                  4        V P                  pVP                  w  r4\
        P                  ! W@P                  4      p\         P                  P                  P                  V4       F!  pWPV,          WR 3,          ,          ,          pK#  	  V# ):NNN)	r   r   r   rk   r   npzerosr   rr   )r   r   rd   r   ncr   s   &&     rf   dotvm_parallel_implr      s|    	MM$$&	A77DA 	GGA ]]!!11!4	qTAdG^ 5Hrj   c                    \         P                  P                  P                  4        V P                  w  r#VP                  p\
        P                  ! W P                  4      p\         P                  P                  P                  V4       F8  p^ p\        V4       F   pWpWh3,          W,          ,          ,          pK"  	  WuV&   K:  	  V# r   )
r   r   r   rk   r   r   emptyr   rr   rt   )	r   r   r   r   rd   r   r   r   js	   &&       rf   dotmv_parallel_implr      s    	MM$$&77DA	A 	GGA]]!!11!4qA1414A !	 5
 Hrj   c                 `   \        V\        P                  P                  4      '       d   \        V\        P                  P                  4      '       dX   VP                  VP                  u;8X  d   ^8X  d	    \
        #  VP                  ^8X  d   VP                  ^8X  d   \        # R# R# R# R#    N)r   r
   npytypesArrayr   r   r   )r   atypbtyps   &&&rf   dot_parallel_implr     s~    4--..4--..99		&Q&&& '
 YY!^		Q&& !/^ 	/ 	/rj   c                    a V ! ^ 4      oVP                   ^ 8X  d   R pV# VP                   ^8X  d	   V3R lpV# V3R lpV# )r   c                     V R,          # r   ri   r   s   &rf   sum_1 sum_parallel_impl.<locals>.sum_1  r   rj   c                    < \         P                  P                  P                  4        Sp\         P                  P                  P	                  \        V 4      4       F  pWV,          ,          pK  	  V# r^   r   r   r   rk   rr   r   r   r   r   zeros   &  rf   r   r     sS    MM  ,,.C]]))99#f+Fay  GJrj   c                    < \         P                  P                  P                  4        Sp\         P                  ! V P
                  4       F  pWV,          ,          pK  	  V# r^   r   r   r   rk   r   r   r   s   &  rf   r   r     sF    MM  ,,.C^^FLL1ay  2Jrj   r   )r   r   r   r   s   && @rf   sum_parallel_implr     sH    q>D
xx1}	  L 
Q	 L	 Lrj   c                    a V ! ^4      oVP                   ^ 8X  d   R pV# VP                   ^8X  d	   V3R lpV# V3R lpV# )r   c                     V R,          # r   ri   r   s   &rf   prod_1"prod_parallel_impl.<locals>.prod_1*  r   rj   c                    < \         P                  P                  P                  4        Sp\         P                  P                  P	                  \        V 4      4       F  pWV,          ,          pK  	  V# r^   r   r   r   r   ones   &  rf   r   r   -  sS    MM  ,,.C]]))99#f+Fay  GJrj   c                    < \         P                  P                  P                  4        Sp\         P                  ! V P
                  4       F  pWV,          ,          pK  	  V# r^   r   r   s   &  rf   r   r   4  sF    MM  ,,.C^^FLL1ay  2Jrj   r   )r   r   r   r   s   && @rf   prod_parallel_implr   &  sH    
a.C
xx1}	  M 
Q	 M	 Mrj   c                    a V ! ^ 4      oVP                   ^ 8X  d   R pV# VP                   ^8X  d	   V3R lpV# V3R lpV# )r   c                     V R,          # r   ri   r   s   &rf   mean_1"mean_parallel_impl.<locals>.mean_1B  r   rj   c                   < \         P                  P                  P                  4        Sp\         P                  P                  P	                  \        V 4      4       F  pWV,          ,          pK  	  V\        V 4      ,          # r^   r   r   s   &  rf   r   r   E  s\    MM  ,,.C]]))99#f+Fay  Gs6{?"rj   c                    < \         P                  P                  P                  4        Sp\         P                  ! V P
                  4       F  pWV,          ,          pK  	  WP                  ,          # r^   )r   r   r   rk   r   r   sizer   s   &  rf   r   r   L  sM    MM  ,,.C^^FLL1ay  2{{?"rj   r   )r   r   r   r   s   && @rf   mean_parallel_implr   =  sH    q>D
xx1}	  M 
Q	# M	# Mrj   c                 d    VP                   ^ 8X  d   R pV# VP                   ^8X  d   R pV# R pV# )r   c                     ^ # r   ri   r   s   &rf   var_1 var_parallel_impl.<locals>.var_1V  s    rj   c                    V P                  4       p\        P                  P                  P	                  4        ^ p\        P                  P                  P                  \        V 4      4       FJ  pW,          V,
          pV\        P                  ! V\        P                  ! V4      ,          4      ,          pKL  	  V\        V 4      ,          # r   )
meanr   r   r   rk   rr   r   r   realconjr   r   ssdr   r   s   &    rf   r   r   Y  s    AMM  ,,.C]]))99#f+Fi!mrwwsRWWS\122 G V$$rj   c                 v   V P                  4       p\        P                  P                  P	                  4        ^ p\        P
                  ! V P                  4       FJ  pW,          V,
          pV\        P                  ! V\        P                  ! V4      ,          4      ,          pKL  	  W P                  ,          # r   )r   r   r   r   rk   r   r   r   r   r   r   r   s   &    rf   r   r   d  sy    AMM  ,,.C^^FLL1i!mrwwsRWWS\122 2 $$rj   r   )r   r   r   s   && rf   var_parallel_implr  T  s>    
xx1}	0 L- 
Q		%* L		% Lrj   c                     R  pV# )c                 0    V P                  4       R ,          # )g      ?)varr   s   &rf   std_1 std_parallel_impl.<locals>.std_1q  s    zz|s""rj   ri   )r   r   r  s   && rf   std_parallel_implr  p  s    #Lrj   r   c                  a
 \        V P                  4      o
V
3R  lpR pV
3R lpR pV
3R lpR p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   R	 p	MR
 p	\        V4      ^8X  d	   Vf   V# T# \        V4      ^8X  d	   Vf   V# T# \        V4      ^8X  d	   Vf   V# T# \        V4      ^8X  d   V	# \	        RP                  V4      4      h)c                 6   < \         P                  ! ^ V ^S4      # r   r   arange)stopinferred_dtypes   &rf   arange_1&arange_parallel_impl.<locals>.arange_1x  s    yyD!^44rj   c                 4    \         P                  ! ^ V ^V4      # r   r
  )r  r   s   &&rf   arange_1_dtype,arange_parallel_impl.<locals>.arange_1_dtype{  s    yyD!U++rj   c                 4   < \         P                  ! W^S4      # r   r
  )startr  r  s   &&rf   arange_2&arange_parallel_impl.<locals>.arange_2~  s    yya88rj   c                 2    \         P                  ! W^V4      # r  r
  )r  r  r   s   &&&rf   arange_2_dtype,arange_parallel_impl.<locals>.arange_2_dtype  s    yya//rj   c                 4   < \         P                  ! WVS4      # r^   r
  )r  r  stepr  s   &&&rf   arange_3&arange_parallel_impl.<locals>.arange_3  s    yydN;;rj   c                 0    \         P                  ! WW#4      # r^   r
  )r  r  r  r   s   &&&&rf   arange_3_dtype,arange_parallel_impl.<locals>.arange_3_dtype  s    yyd22rj   c              3   V   "   T F  p\        V\        P                  4      x  K!  	  R # 5ir^   )r   r
   Complex).0r   s   & rf   	<genexpr>'arange_parallel_impl.<locals>.<genexpr>  s     
6A:a''s   ')TFc                    \         P                  P                  P                  4        W,
          V,          p\        P
                  ! VP                  4      p\        P
                  ! VP                  4      p\        \        \        We4      ^ 4      4      p\        P                  ! Ws4      p\         P                  P                  P                  V4       F  p	W	V,          ,           W&   K  	  V# r   )r   r   r   rk   mathceilr   imagintr   r   r   r   rr   )
r  r  r  r   nitems_cnitems_rnitems_initemsarrr   s
   &&&&      rf   arange_4&arange_parallel_impl.<locals>.arange_4  s    MM  ,,.,Hyy/Hyy/HS4a89F((6)C]]))99&AT) BJrj   c                 x   \         P                  P                  P                  4        \        P
                  ! W,
          V,          4      p\        \        V^ 4      4      p\        P                  ! WS4      pT p\         P                  P                  P                  V4       F  pWV,          ,           Wh&   K  	  V# r   )r   r   r   rk   r(  r)  r+  r   r   r   rr   )	r  r  r  r   r-  r/  r0  r   r   s	   &&&&     rf   r1  r2    s    MM  ,,.yy$,$!67HXq)*F((6)CC]]))99&AT) BJrj   zparallel arange with types {})r   r   anyr   
ValueErrorformat)r   r   rv   r  r  r  r  r  r   r1  r  s   &$*       @rf   arange_parallel_implr7  u  s    k//0N5,90<3 s
6
6sss
6
666			 4yA~ =x<n<	Ta!Mx=~=	Ta!Mx=~=	Ta8??EFFrj   c                    a \        V P                  4      oR  pV3R lp\        V4      ^8X  d   V# \        V4      ^8X  d   V# \        RP	                  V4      4      h)c                 0    \         P                  ! W^24      # )2   )r   linspace)r  r  s   &&rf   
linspace_2*linspace_parallel_impl.<locals>.linspace_2  s    {{5++rj   c                 >  < \         P                  P                  P                  4        \        P
                  ! VS4      pV^,
          pW,
          pW^ &   \         P                  P                  P                  V4       F  pWWd,          ,          ,           W6&   K  	  V# r  )r   r   r   rk   r   r   rr   )r  r  numr0  divdeltar   r   s   &&&    rf   
linspace_3*linspace_parallel_impl.<locals>.linspace_3  su    ((*hhsE"AgA%%55c:Aag..CF ;
rj   zparallel linspace with types {})r   r   r   r5  r6  )r   rv   r<  rB  r   s   &*  @rf   linspace_parallel_implrD    sX    [&&'E, 4yA~	Ta:AA$GHHrj   c                     \         # r^   )r   rr   s   &&rf   <lambda>rH        %9rj   c                     \         # r^   )r   rF  s   &&rf   rH  rH    rI  rj   c                8    VP                   ^8X  d   R pV# R pV# )zParallel implementation of ndarray.fill.  The array on
which to operate is retrieved from get_call_name and
is passed along with the value to fill.
c                     \         P                  P                  P                  4        \         P                  P                  P	                  \        V 4      4       F  pWV&   K	  	  R # r^   r   r   s   && rf   fill_1"fill_parallel_impl.<locals>.fill_1  sF    MM  ,,.]]))99#f+Fq	 Grj   c                     \         P                  P                  P                  4        \         P                  ! V P
                  4       F  pWV&   K	  	  R # r^   r   r   s   && rf   rM  rN    s9    MM  ,,.^^FLL1q	 2rj   r   )r   r0  r   rM  s   &&& rf   fill_parallel_implrP    s'    
 xx1}	 M	
 Mrj   fillc                 *    V ^ 8X  d   \        R4      hR# )r   zDzero-size array to reduction operation maximum which has no identityNr5  arr_sizes   &rf   r   r          1} < > 	> rj   c                 *    V ^ 8X  d   \        R4      hR# )r   zDzero-size array to reduction operation minimum which has no identityNrS  rT  s   &rf   r   r     rV  rj   c                 *    V ^ 8X  d   \        R4      hR# )r   z*attempt to get argmin of an empty sequenceNrS  rT  s   &rf   r   r         1}EFF rj   c                 *    V ^ 8X  d   \        R4      hR# )r   z*attempt to get argmax of an empty sequenceNrS  rT  s   &rf   r   r     rY  rj   checker_implnamefuncr   r   r   r   c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )LoopNesti  zThe LoopNest class holds information of a single loop including
the index variable (of a non-negative integer value), and the
range variable, e.g. range(r) is 0 to r-1 with step size 1.
c                6    Wn         W n        W0n        W@n        R # r^   )index_variabler  r  r  )selfra  r  r  r  s   &&&&&rf   __init__LoopNest.__init__  s    ,
		rj   c                z    R P                  V P                  V P                  V P                  V P                  4      # )z3LoopNest(index_variable = {}, range = ({}, {}, {})))r6  ra  r  r  r  rb  s   &rf   __repr__LoopNest.__repr__  s-    Et**DJJ		499M	Orj   c                   . pVP                  V P                  4       \        V P                  \        P
                  4      '       d   VP                  V P                  4       \        V P                  \        P
                  4      '       d   VP                  V P                  4       \        V P                  \        P
                  4      '       d   VP                  V P                  4       V# r^   )appendra  r   r  r   Varr  r  )rb  all_usess   & rf   	list_varsLoopNest.list_vars  s    xt**+
TZZ
(
(??4::&
TYY
'
'??499%
TYY
'
'??499%rj   )ra  r  r  r  N)
ry   rz   r{   r|   __doc__rc  rg  rm  r}   r~   r   s   @rf   r_  r_    s     
O	 	rj   r_  c                   n   a a ] tR tRt o^ tRRRR/V 3R lltR tR tR	 tRR
 lt	RR lt
R tRtVtV ;t# )Parfori)  no_sequential_loweringFracesNc	                 < V
f   \        4       p
\        \        V `  RVR7       \	        V 4      P
                  V n        \	        V 4      ;P
                  ^,          un        Wn        W n        W0n	        WPn
        R V n        W`n        \        V4      ^8  g   Q hV.V n        Wn        Wn        Wn        . V n        / V n        R V n        \*        P,                  '       d*   Rp\/        VP1                  V P                  Wt4      4       R # R # )Nr   )oplocz9Parallel for-loop #{} is produced from pattern '{}' at {})setsuperrq  rc  type
id_counterid
loop_nests
init_block	loop_body	index_varparams	equiv_setr   patternsflagsrr  rs  redvarsreddictlowererr   DEBUG_ARRAY_OPT_STATSrb   r6  )rb  r|  r}  r~  rv  r  r  patternr  rr  rs  fmt	__class__s   &&&&&&&&&$$ rf   rc  Parfor.__init__-  s     =EEfd$ 	% 	

 t*''T
" %$""" 7|a 	
 '=#

 '''OC#**''7) * (rj   c                    R \        V P                  4      ,           \        V P                  4      ,           \        V P                  4      ,           \        V P
                  4      ,           # )zid=)strr{  reprr|  r~  r  rf  s   &rf   rg  Parfor.__repr__a  sG    s477|#d4??&;; !#'#78 	8rj   c                V    V P                    Uu. uF  qP                  NK  	  up# u upi r^   )r|  ra  )rb  rc   s   & rf   get_loop_nest_varsParfor.get_loop_nest_varse  s"    *.//:/Q  /:::s   &c                Z   . pV P                   P                  4        F.  w  r#VP                   F  pWP                  4       ,          pK  	  K0  	  V P                   F  pWP                  4       ,          pK  	  V P
                  P                   F  pWP                  4       ,          pK  	  V# )zclist variables used (read/written) in this parfor by
traversing the body and combining block uses.
)r~  itemsbodyrm  r|  r}  )rb  rl  rd   r   stmtloops   &     rf   rm  Parfor.list_varsh  s     NN((*DANN,,  + OOD((H $ OO((D((H ) rj   c                    Ve'   V P                   P                  pW P                   n        V P                   P                  V4      pVe   XV P                   n        V# )zfget the shape classes for a given variable.
If a typemap is specified then use it for type resolution
)r  typemapget_shape_classes)rb  r  r  save_typemapress   &&&  rf   r  Parfor.get_shape_classesy  sN     >>11L%,NN"nn..s3%1DNN"
rj   c                   T;'       g    \         P                  p\        R P                  V P                  4      P                  ^R4      VR7       \        RV P                  VR7       \        RV P                  VR7       \        RV P                  VR7       V P                   F  p\        W!R7       K  	  \        RVR7       V P                  P                  V4       \        V P                  P                  4       4       F(  w  r4\        RV: R2VR7       VP                  V4       K*  	  \        R	P                  V P                  4      P                  ^R4      VR7       R
# )zbegin parfor {}-)filezindex_var = z	params = zraces = zinit block:zlabel :zend parfor {}N)sysstdoutrb   r6  r{  centerr  r  rs  r|  r}  dumpsortedr~  r  )rb  r  loopnestoffsetblocks   &&   rf   r  Parfor.dump  s    !!szz ''088SAMndnn48k4;;T2j$**40H(& (m$'T"#DNN$8$8$:;MF)5JJt < 	%%dgg.66r3?dKrj   c                   V P                   f   Rp\        V4      hV P                    F  pVP                  V4      pVf   Rp\        V4      h\        V\        P
                  4      '       g   KG  VP                  \        P                  8  g   Kh  Rp\        P                  ! VW4P                  \        P                  3,          V P                  4      h	  R# )z/
Check that Parfors params are of valid types.
Nz?Cannot run parameter validation on a Parfor with params not setzDCannot validate parameter %s, there is no type information availablea  Use of a tuple (%s) of length %d in a parallel region exceeds the maximum supported tuple size.  Since Generalized Universal Functions back parallel regions and those do not support tuples, tuples passed to parallel regions are unpacked if their size is below a certain threshold, currently configured to be %d. This threshold can be modified using the Numba environment variable NUMBA_PARFOR_MAX_TUPLE_SIZE.)r  r5  getr   r
   	BaseTuplecountr   PARFOR_MAX_TUPLE_SIZEr   UnsupportedParforsErrorrv  )rb  r  msgptys   &&   rf   validate_paramsParfor.validate_params  s     ;;CS/!AQBz/ o%"eoo..88f:::OC !88 ((F,H,HI:J"hh( (! rj   )r  r  r{  r  r}  r~  r|  r  rr  r  r  rs  r  r  r^   )ry   rz   r{   r|   rz  rc  rg  r  rm  r  r  r  r}   r~   __classcell__)r  r   s   @@rf   rq  rq  )  sH     J2* $)2* 2*h8;"$L( (rj   rq  c                   VP                   p\        V 4      pVP                  P                  ^ R4      pVP                  ! WQ4       \        W4       VP                  ^ ,          V n        V'       d   WcP                  ^ &   . . 3# )z/Recursive array analysis for parfor nodes.
    N)func_irwrap_parfor_blocks
equiv_setsr  rununwrap_parfor_blocksr  )r   r  r  rY   r  parfor_blocksbackup_equivsets   &&&&   rf   _analyze_parforr    sv     $$G&v.M %//33At<O}0/%003F'6!!!$r6Mrj   c                      a  ] tR tRt o RtR tR t]R 4       t]P                  R 4       tRR lt
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tRR ltR tR tRtV tR# )ParforDiagnosticsi  z}Holds parfor diagnostic info, this is accumulated throughout the
PreParforPass and ParforPass, also in the closure inlining!
c                    R V n         \        4       V n        RV n        \	        \
        4      V n        \	        \
        4      V n        . V n        / V n	        RV n
        R # )N__numba_parfor_gufuncF)r]  dictreplaced_fnsinternal_namer   listfusion_infonested_fusion_infofusion_reports
hoist_info	has_setuprf  s   &rf   rc  ParforDiagnostics.__init__  sK    	 F4&t,"-d"3 rj   c                b   Wn         V P                   P                  P                  V n        V P                   P                  V n        W n        V P                  V P                  9   d	   R V n        M#RV P                  : RV P
                  : 2V n        V P                  4       V n
        RV n        R# )zInternal parallel functionz	Function , TN)r  func_idfunc_qualnamer\  rv  linefusion_enabledr  purposeget_parforsinitial_parforsr  )rb  r  r  s   &&&rf   setupParforDiagnostics.setup  s    LL((66	LL$$	,*7DL + 15		499EDL  $//1rj   c                    V P                   # r^   
_has_setuprf  s   &rf   r  ParforDiagnostics.has_setup  s    rj   c                    Wn         R # r^   r  )rb  states   &&rf   r  r    s    rj   Nc                4    \        V P                  4       4      # r^   )r   r  rb  blockss   &&rf   count_parforsParforDiagnostics.count_parfors  s    4##%&&rj   c                T    \        V4      pV P                  W24       \        V4       R # r^   )r  _get_parforsr  )rb  r   parfors_listr  s   &&& rf   _get_nested_parfors%ParforDiagnostics._get_nested_parfors  s"    #F+&/V$rj   c                    VP                  4        FR  w  r4VP                   F=  p\        V\        4      '       g   K  VP	                  V4       V P                  WR4       K?  	  KT  	  R # r^   )r  r  r   rq  rj  r  )rb  r  r  labelblkr  s   &&&   rf   r  ParforDiagnostics._get_parfors  sK     ,,.JEdF++ ''-,,T@ ! )rj   c                V    . pV P                  V P                  P                  V4       V# r^   )r  r  r  )rb  r  s   & rf   r  ParforDiagnostics.get_parfors   s'    $,,--|<rj   c                   . pV P                   P                  4        F  w  r#VP                  R . 4      pV F  p\        VP                  \
        P                  4      '       g   K/  VP                  P                  R8X  g   KL  \        \        V P                  VP                  4      pVf   Kw  VR8X  g   K  VP                  V4       K  	  K  	  V# )hoistedcall)r   numpy)r  r  r  r   valuer   Exprru  r:   r8   r  rj  )rb  allocspf_iddatar  instr  s   &      rf   hoisted_allocations%ParforDiagnostics.hoisted_allocations  s    ??002KE88Ir*Ddjj"''22zz}}.$]DLL$**M+8J0J"MM$/  3 rj   c                   \         P                  ! V4      pV/ 8X  d   . \        4       3# \        4       pVP                  4        F  pV F  pVP	                  V4       K  	  K  	  \        VP                  4       4      pWc,
          pVf   \        4       p\        4       p\        \        \        VP                  4       4      P                  V4      4      ^,           4       F<  pVP                  V4      p	V	e   WV&   K  V	. 8X  d   VP	                  V4       K8  . W%&   K>  	  . p
\        VP                  4       4       F  pV
P                  W%,          4       K  	  W3# )zN
compute adjacency list of the fused loops
and find the roots in of the lists
)copydeepcopyrw  valuesaddkeysrt   r   unionr  r  rj  )rb  _ar   vtxvrc   potential_rootsroots	not_rootsr   rd   s   &&         rf   compute_graph_info$ParforDiagnostics.compute_graph_info  s   
 MM"7su9eA
  
 affh-%=EE E	s3qvvx=..s34q89A%%(C!a  : !AHHQTN " xrj   c                0   a V3R loS! WV^ ^ 4      w  rEWE3# )z
Computes the number of fused and serialized loops
based on a fusion adjacency list `fadj` and a nested
parfors adjacency list `nadj` for the root, `root`
c                    < W,           FI  pV^,          pW,          . 8X  d   V\        W,          4      ,          pK3  S! WWSV4      w  rgW6,          pTpKK  	  W43# r  )r   )	fadjnadjrootnfusednserialknfns
count_roots	   &&&&&   rf   r  /ParforDiagnostics.get_stats.<locals>.count_root?  sY    ZZ17b=c$'l*F'AwGFBLF G   ?"rj   ri   )rb  r  r  r  r  r  r  s   &&&&  @rf   	get_statsParforDiagnostics.get_stats9  s$    		# %Tq!<rj   c                    . pVP                  W,          4       W,           F2  pW,          . 8w  g   K  VP                  V P                  W4      4       K4  	  V# )zN
returns a list of nodes reachable in an adjacency list from a
specified root
)extendreachable_nodes)rb  adjr  fusersr  s   &&&  rf   r  !ParforDiagnostics.reachable_nodesL  sL    
 ci Av|d223:;  rj   c                p   W!,          ^ ,          pVP                   ^ ,          p\        ^ VP                  P                  ^,
          4      pV P                  P                  P
                  pV P                  V P                  4      w  rxV P                  V P                  4      w  rWy.p\        V\        4      '       Ed   V^,          R8X  Ed   V^,          ^,          pVP
                  V8X  d   \        ^ VP                  ^,
          4      # . pV Fb  pV'       g   K  W,           F#  pVP                  V P                  W4      4       K%  	  V'       g   KF  \        ^ \        V4      ^,
          4      u # 	  VP                  P                  4        F\  pVP                    FI  pVP                  P
                  V8X  g   K   \        ^ VP                  P                  ^,
          4      u u # 	  K^  	  V P                  P"                  P                  4        F  p VP                   P%                  V4      p\'        V^,
          ^ R4       FV  pVP                   V,          p\        V\(        4      '       d   K.  \        ^ VP                  P                  ^,
          4      p K  	  K  	  V#   \*         d     K  i ; i)z@
pd_id - the parfors id
parfors_simple - the simple parfors map
internal)r  r   rv  r  r  filenamer	  r  r  r   tuplerj  sort_pf_by_liner   r~  r  r  r  r   rt   rq  r5  )rb  r  parfors_simplepfr  r  r"  r  nrootsr  frootsgraphsreported_loctmpr  r  r  r  idxr   s   &&&                 rf   r$  !ParforDiagnostics.sort_pf_by_lineX  s    "1%++a.1bffkkAo&<<##,,..t/F/FG..t/?/?@ gu%%qzZ'&qz!}((H4q,"3"3a"788 C%3%(ZZ #

4+?+?+R S &0"s'*1c#hl'; ;  &  "||224$'HHD#xx00H<'*1dhhmma.?'@ @ %-  5  $||2299;!"%((.."4C%*37Ar%:'*xx{'1$'?'?+.q$((--!2C+DD$)	 &;  <   * ! !s   AJ&4(J&J&&J54J5c           	     p   \        4       p\        V P                  R  R7       EF  pVP                  ^ ,          pVP                  ^ ,          pVP                  p\        V\        4      '       d   V^ ,          R8X  d~   V^,          R8X  dL   RP                  \        \        V^,          ^ ,          4      4      4      pV^,          ^,          pV: RR: 2pM$V^,          R8X  d   RpMV^,          R	8X  d   R
pMQ hRpV'       d   \        WP                  Wd3,          4       W6V3W#P                  &   EK  	  V# )c                 .    V P                   P                  # r^   )rv  r  rc   s   &rf   rH  6ParforDiagnostics.get_parfors_simple.<locals>.<lambda>  s    QUUZZrj   keyr   r   . z(internal parallel version)userzuser defined pranger   zinternal pndindexz5Parallel for-loop #%s: is produced from %s:
    %s
 
)r  r  r  r  rv  r   r#  joinreversedr  rg   r{  )	rb  print_loop_searchr%  r&  	r_patternr  rv  replfnr  s	   &&       rf   get_parfors_simple$ParforDiagnostics.get_parfors_simple  s    --3GHHB AIkk!nG&&C'5))1:)qzZ/!$(4
13F*G!H%ajm/57T$U	 v-$9	 z1$7	 qLC cUUC$;;<%'i$8N55!- I. rj   c                   V P                  V P                  4      w  r#V P                  V P                  4      w  rE\        V4      \        V4      8  d   \        V4      pTpM\        V4      pTp\	        \        V4      V4       F  pVP                  . 4       K  	  \        4       p	V'       d*   V F#  p
WJ,          . 8w  g   K  V	P                  V
4       K%  	  W9,          p/ pV F  pV P                  W4      pR W3W&   K  	  / pV	 F  pV P                  W4      pRW3W&   K  	  VP                  4       pVP                  V4       V# )fusenest)r	  r  r  r   rt   rj  rw  r   r$  r  update)rb  r%  r  r(  r  _nrootslimr+  rc   r'  rG  	all_rootsfroots_linesr  nroots_lines	all_liness   &&              rf   get_all_linesParforDiagnostics.get_all_lines  s1    ..t/?/?@//0G0GHt9s4y d)CCd)CCs3x%AJJrN &
 7b=JJqM  O	 A'':D!'L  A'':D!'L  !%%'	&rj   c           	        V P                   P                  P                  pV P                  4       pV P                   P                  P
                  p \        P                  ! V4      P                  4       pV'       Ede   V'       Ed\   \        V Uu. uF  p\        V4      NK  	  up4      p\        \        4      p	VP                  4        FV  w  rW,          ^,          P                  V8X  g   K%  V P                  W4      pW,          P!                  \#        V
4      4       KX  	  \        ^.V	P%                  4        Uu. uF  p\        V4      NK  	  up,           4      pV^V\        \#        V4      4      ^,           ,          ,           ,           p. pVP!                  R4       VP!                  RV,          4       VP!                  VR,          R,           4       Rp\        ^ V P                   P                  P&                  ^,
          4      p\)        VV4       F  w  ppV	P+                  VR 4      pVe   RRP-                  V4      ,           pMRpVP/                  R4      p\        V4      pV'       d   VP1                  VR,          VV4      pMVP1                  VR	,          VV4      pVP!                  VVVR  ,           4       K  	  \3        RP-                  V4      4       R # \3        R
4       R #   \         d    R p ELi ; iu upi u upi )N
zParallel loop listing for %sr  z	|loop #IDz{0:{1}}| {2}#r   r5  zNo source available)r  rv  r"  r  r  r]  inspect	getsourcer_   OSErrorr   r   r   r  r  r$  rj  r  r  r  	enumerater  r7  stripr6  rb   )rb  r%  purpose_strr"  r  	func_namelinesrc   	src_widthmap_line_to_pfr  r  
match_linemax_pf_per_liner[   newlinesr  lstartnor  pf_idspfstrstrippedsrclenrd   s   &&&                      rf   source_listing ParforDiagnostics.source_listing  sk   <<##,,""$LL((--		%%i0;;=E 5^^U3USVU34I(.N&,,. "$Q'00H<!%!5!5a!HJ".55c!f= / "1#9N9N9P(Q9PAQ9P(Q"QRO_CJ!8K%L!LMEHOOD!OO:[HIOOECK+56 CDLL,,11A56F%eV4D'++B5%$))F"33EE::d+X

53;u=A

53;u=A1VW: 56 5 $))H%&'(I  	E	 4 )Rs   $K0 L>L	
0L Lc                6  a aa R o\        S4      oS P                  S P                  4      w  r#S P                  S P                  4      w  rE\        V4      \        V4      8  d   \        V4      pTpM\        V4      pTp\	        \        V4      V4       F  pVP                  . 4       K  	  VV V3R lp	VV V3R lp
^ p. p\        VP                  4       4       F<  w  rVw  pppVR8X  d   VV9  d   V
! RVV^ V4      pK'  K)  VR8X  d   V	! W$VW4      pK<  Q h	  R# )+--c                    <aa VVVVV3R  loW,          . 8w  d1   \        RV,          4       S! WV^ 4       \        R4       V^,           pV# )c           	      J  < \        SV,          R ,          S: V: R R: 2,           4       W,           F  pW,          . 8X  d   . pVP                  SV^,           ,          R ,          S: V: R R: 2,           4       W,          . 8w  dY   VS
9  dR   SP                  W4      pV F:  pVP                  SV^,           ,          R ,          S: V: R R: 2,           4       K<  	  S
P                  V4       \        RP                  V4      4       K  S	! WWC^,           4       K  	  R# )r5  
(parallel)rK  N)rg   rj  r  r7  )fadj_nadj_nrootdepthr  r  fusedr   facprint_greportedrb  swords   &&&&    rf   rn  HParforDiagnostics.print_unoptimised.<locals>.print_nest.<locals>.print_g  s    cEkC/ue\2ZZ[Ax2~ 

3%!)#4s#:%QRT`=a#ab 8r>ax.?$($8$8$BE%* #

3%!)+<s+BRWYZ\hEi+i j &+ *%diin5a; &rj   Parallel region %s:rK  rg   rb   )	rh  ri  therootro  	region_idrn  rm  rb  rp  s	   &&&f&@rf   
print_nest7ParforDiagnostics.print_unoptimised.<locals>.print_nest  sI    < < ~#3i?@gq1d%M	rj   c                   < . p\        R V,          4       VP                  SV,          R,          S
: V: RR: 2,           4       W!,          . 8w  dT   \        S	P                  W!4      4      pV F3  pVP                  SV,          R,          S
: V: RR: 2,           4       K5  	  V^,           p\        RP	                  V4      4       \        R4       V# )rr  r5  rg  rK  )rg   rj  r  r  r7  rb   )r  r  r  rk  ru  r  rl  r  rm  rb  rp  s   &&&&&   rf   
print_fuse7ParforDiagnostics.print_unoptimised.<locals>.print_fuse.  s    C/);<JJsU{S(ul+SSTzRt33C?@AJJsU{S0q,3WWX !AI$))C.)$Krj   r?  fr@  N)r   r	  r  r  rt   rj  r  r  )rb  rU  r  r(  r  rB  rC  r+  rc   rv  ry  ru  ro  r  infoopt_tyr  r  rm  rp  s   f&                @@rf   print_unoptimised#ParforDiagnostics.print_unoptimised  s   %j..t/?/?@//0G0GHt9s4y d)CCd)CCs3x%AJJrN &	.	 	 /JD!%FE3( *3sAy II )6!&t5(N	q 0rj   c           	       a aaa R o\        S4      oS P                  S P                  4      w  r#S P                  S P                  4      w  rE\        V4      \        V4      8  d   \        V4      pTpM\        V4      pTp\	        \        V4      V4       F  pVP                  . 4       K  	  \        4       oVV VV3R lp	VV VV3R lp
^ p. p\        VP                  4       4       F<  w  rVw  pppVR8X  d   VV9  d   V
! RVV^ V4      pK'  K)  VR8X  d   V	! W$VW4      pK<  Q h	  S'       d   \        SP                  4       4       Fj  w  ppRpVR,          pVR,          pVR	,          pV^ 8w  d#   VR
,          p\        VVVVVV3,          4       KL  VR,          p\        VVVV3,          4       Kl  	  R# \        R4       R# )rd  c                    <aaa VVVVVVV	3R  loW,          . 8w  dQ   \        RS,          4       \        S	: V: RR: 24       RVR^ R^ /SS&   S! WV^4       \        R4       S^,           oS# )c           
      v  < W,           EF%  pSV,          R ,          S: V: R R: 2,           pW,          . 8X  d   . pW,          . 8w  d\   VS9  dU   \        SP                  W4      4      pVR,          pTRP                  V Uu. uF  p\        V4      NK  	  up4      ,          pVR,          pSP	                  V4       \        V4       SS
,          R;;,          \        V4      ,          uu&   M"\        VR,           4       S	! WWC^,           4       SS
,          R;;,          ^,          uu&   EK(  	  R# u upi )r5  z(serial, fused with loop(s): r  )rl  
serializedN)r  r  r7  r  rj  rg   r   )rh  ri  rj  rk  r  r  rl  rc   rm  rn  ru  ro  rb  summaryrp  s   &&&&    rf   rn  FParforDiagnostics.print_optimised.<locals>.print_nest.<locals>.print_g]  s    A++5!Y.OOCx2~ " 8r>ax.?$*4+?+?+I$JE#;;C499e-Dec!fe-D#EECs
 *%c*	*73s5zA3%cCi0a;I&|494 & .Es   D6rr  r5  rg  r  rl  r  rK  rs  )
rh  ri  rt  ro  ru  rn  rm  rb  r  rp  s
   &&&ff@rf   rv  5ParforDiagnostics.print_optimised.<locals>.print_nest\  sp    : :$ ~#3i?@5'<HI&,gw<QR%S	"gq1d%M	rj   c           	        < \        R V,          4       SV,          R,          S: V: RR: 2,           p. pW!,          . 8w  dU   \        S	P                  W!4      4      pVR,          pTRP                  V Uu. uF  p\	        V4      NK  	  up4      ,          pRVR\        V4      R^ /S
V&   VR,          p\        V4       \        R	4       V^,           pV# u upi )
rr  r5  z	(parallelr  r  r  rl  r  r  rK  )rg   r  r  r7  r  r   rb   )r  r  r  rk  ru  r  rl  rc   rm  rb  r  rp  s   &&&&&   rf   ry  5ParforDiagnostics.print_optimised.<locals>.print_fusex  s    /);<+#5%&MMCEzRt33C?@//tyy%!8%Q#a&%!899"(%#e*lTU!VGI3JC#$K!AI "9s   7C
r?  r{  r@  z5
 
Parallel region %s (loop #%s) had %s loop(s) fusedr  rl  r  zE and %s loop(s) serialized as part of the larger parallel loop (#%s).r4  z&Parallel structure is already optimal.N)
r   r	  r  r  rt   rj  r  r  r  rg   )rb  rU  r  r(  r  rB  rC  r+  rc   rv  ry  ru  ro  r  r|  r}  r  r  r  r  r  r  rl  r  rm  r  rp  s   f&                      @@@rf   print_optimised!ParforDiagnostics.print_optimisedH  s    %j..t/?/?@//0G0GHt9s4y d)CCd)CCs3x%AJJrN & &	 	8	 	" 	 /JD!%FE3( *3sAy II )6!&t5(N	q 0 w}}/1$y'
|_
? + ,C "#D%T(J"JK3JC!#D%(8"89 0 BCrj   c                   R p\        R4       V P                  P                  4        EFB  w  r#VP                  R. 4      pV EF#  p\	        VP
                  \        P                  4      '       g   K0   VP
                  P                  pVR8X  d   RpVP                  p\        WxV3,          4        \        P                  P                  VP                  4      p	\"        P$                  ! V	4      p
V
'       d]   VP&                  '       dK   \        RYP&                  ^8  d   ^ MVP&                  ^,
          ,          P)                  4       ,           4       \        R4       RpEK#  EK&  	  EKE  	  V'       g   \        R4       R	# R	#   \         d-    \        P                  P!                  TP                  4      p	 Li ; i  \*        \,        3 d     EK  i ; i)
FzAllocation hoisting:r  r   zThe memory allocation derived from the instruction at %s is hoisted out of the parallel loop labelled #%s (it will be performed before the loop is executed and reused inside the loop):z   Allocation:: z0    - numpy.empty() is used for the allocation.
TzNo allocation hoisting foundN)rb   r  r  r  r   r  r   r  attrrv  rg   ospathrelpathr"  r5  abspath	linecachegetlinesr  rR  KeyErrorAttributeError)rb  foundr  r  r  r  r  r  rv  r  rU  s   &          rf   allocation_hoist"ParforDiagnostics.allocation_hoist  sf   $%??002KE88Ir*Ddjj"''22#zz7?$;C
 #'((C)#e*<=E')wws||'D %.$6$6t$<E$ -.@5hhYZl`c`h`hkl`lCmCsCsCu.u v)*]^$(E! +	  32 89  $. E')wws||'DE %n5 sC   3>G 2)FG 9G AG 4F=:G <F==G  GGc                   \        R 4       \        R4       RpV P                  '       d   V P                  P                  4        F  w  r#VP                  RR4      pVP                  RR4      pV'       g   V'       g   \        RV,          4       KM  \        RV,          4       V'       d/   \        R4       V Uu. uF  p\        R	V,          4      NK  	   pR
pV'       g   K  \        R4       V UUu. uF  w  rv\        RV: RV: 24      NK  	   ppR
pK  	  V'       g   \	        R4       \	        R4       R# u upi u uppi )rM  zInstruction hoisting:Fr  Nnot_hoistedzloop #%s has nothing to hoist.z	loop #%s:z  Has the following hoisted:    %sTz   Failed to hoist the following:z    z: zNo instruction hoisting foundzP--------------------------------------------------------------------------------)rb   r  r  r  rg   )rb  hoist_info_printedr  r  r  r  re   rc   s   &       rf   instruction_hoist#ParforDiagnostics.instruction_hoist  s    b	%&"???#446((9d3"hh}d;{:UBCkE)*8929:'QU8a<(':)-&;<=>IJkdaU1a01kJ)-&  7  "9:h ; Ks   ;D;4E c                  a a! S P                   '       g   \        R 4      hS P                  P                  P                  pS P                  P
                  pS P                  V9   d   RpRpMRV: RV: R2pRpRpRpRpRp	Rp
RpRpRpRpRpVR*9   d   RpRpM\        R	4      hVR+9   d   RpVR,9   d   RpV^8X  d   Rp	Rp
V^8X  d   RpRpRpVR8X  d   V'       g   R
# \        R4       \        \        R,          4       \        RV,          P                  \        R4      4       \        \        R,          4       \        R4       V'       d    \        RP                  \        R4      4       S P                  V4      pS P                  4       pV'       d)   \        RV,          4       \        R\        ,          4       S P                  P
                  P                  p \        P                  P!                  V4      pV'       d   S P%                  VV4       Ro!S P'                  4       pV Uu. uF  pVP(                  NK  	  pp\+        V4      pV'       g	   V	'       d]   \,        '       g.   \        RP                  \        R4      4       Rp\        V4       M#Rp\        V4       \        \        R,          4       VR-8  Ed   V V!3R lpV'       d@   S P.                   F/  pVw  ppp\        RV: RV: R24       \        RV,          4       K1  	  S P0                  / 8w  d(   V	'       d    \        R4       V! S P0                  RR4       V	'       d{   S P2                  '       d   RpMRp\        R P5                  TTRP7                  V Uu. uF  pR!V,          NK  	  up4      4      4       \        \        R,          4       \        R4       V
'       du   S P8                  / 8w  dd   \        R"P                  \        R4      4       \        R#4       R$pR%pV! S P8                  VV4       \        \        R,          4       \        R4       S P;                  V4      p V'       dG   \=        R&P                  \        R4      4       S P?                  V 4       \=        \        R,          4       V'       dG   \=        R'P                  \        R4      4       S PA                  V 4       \=        \        R,          4       \        R4       \        \        R,          4       \        R4       V'       g	   V'       d   \        R(P                  ^PR4      4       V'       d   S PC                  4        V'       d   S PE                  4        R
# R
# \        R)P5                  W#4      4       R
#   \         d$    \        P                  P#                  T4      p ELi ; iu upi u upi ).zself.setup has not been calledzInternal parallel functions r   z
 Function r  r5  r6  FTz1Report level unknown, should be one of 1, 2, 3, 4Nz
 =z% Parallel Accelerator Optimizing: %s rM  zLooking for parallel loopsr  z
Found %s parallel loops.rd  z Fusing loops zPAttempting fusion of parallel loops (combines loops with similar properties)...
z+Performing sequential lowering of loops...
c                 t   <aaaa \        S4      oVVVVV3R  lpSP                  V 4      w  opV! SV4       R# )c                    <a VVVV3R  loV F-  p\        S: V: RS: 24       S! SV^4       \        R4       K/  	  R# )c                    < W,           FL  p\        SV,          R ,          S: V: R S: 2,           4       W,          . 8w  g   K<  S! WV^,           4       KN  	  R# )r5  Nrg   )r  r  rk  r  rm  node_msgrn  rp  s   &&& rf   rn  YParforDiagnostics.dump.<locals>.dump_graph_indented.<locals>.print_graph.<locals>.print_gE  sG    !$A)#+*;5RSU]>^*^_"v| '	 : "+rj   r5  rM  Nr  )	r  r  rG  rn  rm  rd   r  root_msgrp  s	   && @rf   print_graphHParforDiagnostics.dump.<locals>.dump_graph_indented.<locals>.print_graphD  s<    ; ;
 #%5!X&FG1a(%b) #rj   N)r   r	  )	r   r  r  r  r  rm  rd   rb  rp  s	   &ff  @@rf   dump_graph_indented3ParforDiagnostics.dump.<locals>.dump_graph_indentedB  s6    %j	* 	*  22155Au%rj   z  Trying to fuse loops #z and #r  r  z
 
Fused loop summary:
z&has the following loops fused into it:z(fused)z4Following the attempted fusion of parallel for-loopsWith fusion disabledzL
{} there are {} parallel for-loop(s) (originating from loops labelled: {}).z#%sz Optimising loop nests zNAttempting loop nest rewrites (optimising for the largest parallel loops)...
 zis a parallel loopz--> rewritten as a serial loopz Before Optimisation z After Optimisation zLoop invariant code motionz+Function %s, %s, has no parallel for-loops.)r            )r  r  r  )r  r  r!  )#r  RuntimeErrorr  r  r  rv  r  r5  rg   
_termwidthr  r<  r  r"  r  r  r  r  ra  r  r{  r   sequential_parfor_loweringr  r  r  r6  r7  r  rH  rb   r~  r  r  r  )"rb  levelr\  r  rS  r  r9  print_source_listingprint_fusion_searchprint_fusion_summaryprint_loopnest_rewriteprint_pre_optimisedprint_post_optimisedprint_allocation_hoistprint_instruction_hoistprint_internalr%  r  r"  r  r   rc   
parfor_ids	n_parforsr  r  reportl1l2after_fusionr  r  rG  rp  s"   f&                               @rf   r  ParforDiagnostics.dump  s   ~~~?@@||##11||%8K G & 26t<KG!$#$!&#$!&"' L #' #' PQQI"&F?%)"A:#' %)"A:"&&*#!Nj ej3&'>LTTU_adefj3&'b 6==j#NO001BC""$6>?#
*+ <<##,,	- 77??8,D  < ""$$+,GqaddG
,
O	 "6--.55j#FG8c"Dc"j3./r>& #"11F"(KBC!2r"RS!(S.1 2
 2%'!">?'(8(8:bdmn#&&&#YL#9Lnvv$iz;Zz!EAIIz;Z1[] ^j3./b! &**b0!#<"D"DZQT"UV!"st3H?H'(?(?8T!*s"23!"% **>:I"-44ZDE&&y1j3&'#,33JsCD$$Y/j3&'"*s*+%  &)@:AA"cJK%%%'&&&( ' GNNtZ[Q  	- 77??8,D		- -d <[s    V /WW*W
Wc                B    R pV\        V P                  4      ,          pV# )zParforDiagnostics:
)r  r  rb  rG  s   & rf   __str__ParforDiagnostics.__str__  s!    #	T$##$$rj   c                
    R pV# )r  ri   r  s   & rf   rg  ParforDiagnostics.__repr__  s     rj   )r  r]  r  r  r  r  r  r  r  r  r  r\  r  r  r  r^   r  )ry   rz   r{   r|   ro  rc  r  propertyr  setterr  r  r  r  r  r	  r  r  r$  r<  rH  ra  r~  r  r  r  r  r  rg  r}   r~   r   s   @rf   r  r    s           '%
A

&P&
8t:*X*)X?B^D@:> 2n\`
 rj   r  c                   :   a  ] tR tRt o RtRR ltR tR tRtV t	R# )	PreParforPassi  zoPreprocessing for the Parfor pass. It mostly inlines parallel
implementations of numpy functions if available.
Nc	                    Vf   / pWn         W n        W0n        W@n        WPn        W`n        Wpn        Vf   \        pWn        R^ R^ /V n	        R # )Nreplaced_funcreplaced_dtype)
r  r  	calltypes	typingctx	targetctxoptionsswappedswap_functions_mapreplace_functions_mapstats)	rb  r  r  r  r  r  r  r  r  s	   &&&&&&&&&rf   rc  PreParforPass.__init__  sT    ?G""" ($6!%:"Qa

rj   c                P   \        V P                  V P                  V P                  V P                  4       V P
                  P                  '       d&   V P                  V P                  P                  4       \        V P                  P                  4      V P                  n        R# )z(Run pre-parfor processing pass.
        N)
r6   r  r  r  r  r  r  _replace_parallel_functionsr  r4   rf  s   &rf   r  PreParforPass.run  si     	 dll $	@<<,,T\\-@-@A*4<<+>+>?rj   c           	     B  a aaaaaaa S P                   o^ RIHo \        VP	                  4       4      oS'       Edc   SP                  4       w  po\        SP                  4       EF2  w  op\        V\        P                  4      '       g   K)  VP                  pS P                  VP                  ,          oVP                  o\        S\        P                  4      '       dU   SP                   R8X  dD   VVVVVV VV3R lp\#        V4      '       d$   S P$                  R;;,          ^,          uu&    EK  K  \        S\        P                  4      '       g   K  SP                   R8X  g   EK  SP&                  R8X  g   EK  S P                  SP                  P                  ,          p\        V\(        P*                  P,                  4      '       g   EKp  VP.                  pSP0                  pVP2                  p	\        P4                  ! V\7        R4      V	4      p
\(        P8                  P;                  \<        4      S P                  V
P                  &   \        P>                  ! R\<        V	4      p\        P                  ! WV	4      p\A        V4      pVR	8X  d   R
p\        P4                  ! V\7        R4      V	4      p\(        PB                  ! V4      S P                  VP                  &   \        P                  ! \        PD                  ! W4      W4      p\        P4                  ! V\7        R4      V	4      p\G        \<        P.                  4      p\H        PJ                  P(                  PM                  V4      pVPO                  S PP                  S P                  VP                  ,          3/ 4       \(        PR                  PM                  V4      S P                  VP                  &   \        P                  PU                  V
RV	4      p\        P                  ! VVV	4      p\        P4                  ! V\7        R4      V	4      p\(        P*                  PW                  V4      S P                  VP                  &   \        P                  PY                  VV.RV	4      p\        P                  ! VVV	4      p\[        S P                  VP                  ,          S P                  VP                  ,          4      S P\                  V&   VVn        SP                  P_                  ^ V4       SP                  P_                  ^ V4       SP                  P_                  ^ V4       SP                  P_                  ^ V4       S P$                  R;;,          ^,          uu&    EKf  	  EKk  R# )z
Replace functions with their parallel implementation in
replace_functions_map if available.
The implementation code is inlined to enable more optimization.
)inline_closure_callr  c                    < \        SP                  SP                  4      p \        SP                  S4      pSP                  P                  VR 4      pVf   \        V4      ^8X  d   \        V^,          \        P                  4      '       d   \        SP                  V^,          P                  ,          \        P                  P                  4      '       dE   \        P                  V^ ,          R 4      pVe$   SP                   P#                  ^ V^,          4       \%        VR J4       \&        ;QJ d!    . V3R lSP                    4       F  NK  	  5M! V3R lSP                    4       4      pSP(                   UUu/ uF#  w  rEVSP                  VP                  ,          bK%  	  ppp V! S.VO5/ VB p\%        VR J4       \,        P.                  ! V4      P0                  ! V/ VB P                   p\2        P2                  ! SP                  P4                  P                  P6                  4      p\8        VR&   \:        VR&   \<        VR&   \>        P                  VR 4      p	V	e   V	P                  WP                  &   S! SP                  VSSVSP@                  SPB                  VSP                  SPD                  S4      w  r\G        V
RR7      pV FZ  pVPI                  4        FC  w  rNV^ ,          R8X  g   K  WPJ                  V SPL                  S,          PN                  .SV&    KX  	  K\  	  R# u uppi   \*         d    R p ELi ; i)	Nc              3   ^   <"   T F"  pSP                   VP                  ,          x  K$  	  R # 5ir^   )r  r\  )r$  rc   rb  s   & rf   r%  RPreParforPass._replace_parallel_functions.<locals>.replace_func.<locals>.<genexpr>  s!     (Qy!aff)=)=ys   *-r   r   r(  F)topological_orderingrr   T)(r>   r  r]  r8   r  r  r   r   r   rk  r  r\  r
   r   r   replace_functions_ndarrayrv   insertr;   r#  kws	Exceptionr   pysignaturebindr  r  __globals__r   r  r(  replace_functions_checkers_mapr  r  r  r2   r  ry   r  rv  )func_defcallname	repl_functypsr  rc   kws_typsnew_funcgcheck
new_blocks_
call_tabler  r  r  exprr   r  lhs_typrb  r  	work_lists                  rf   replace_func?PreParforPass._replace_parallel_functions.<locals>.replace_func  s   '5dllDII'NH'4T\\4'HH(,(B(B(F(FxQU(VI ) 1 #H 2 *8A; ? ? *4<<8H8H+I+0>>+?+?!A !A,E,I,I(ST+W[,\	#,#8$(II$4$4Q$D#IT$9:#(5(Qtyy(Q55(Qtyy(Q#QDLPHH'UHDA4<<+?(?HH'U0,5g,Q,Q,Q $HD$89#(#4#4X#>#C#CT#VX#V#[#[D $		$,,*>*>*C*C*O*O PA).AgJ&+AdG(,AfI %C$F$FxGK%ME$005

**,?a,11hPTP^P^,0$,,PY-[MJ *8
Y^)_J )3,0JJLDA'(t/@'@6>@R@RT\^c^h^hij^k^o^o5p
(- -9 )3
 $(? (V $- 0+/0s   )L7.L= =MMr  getattrr   	$np_g_varr   boolbool_z$np_typ_varz$dtype_attr_varz
$dtype_varr  Nri   )0r  numba.core.inline_closurecallr  r  r  poprQ  r  r   r   Assigntargetr  r\  r  r  ru  r:   r  r  r
   r   r   r   scoperv  rk  r   miscModuler  Globalr  StringLiteralConstfind_templater   corerQ   get_call_typer  	functionsr  DTyper  rP   r  r  )rb  r  r  instrlhsr  typr   r  rv  g_np_varg_npg_np_assign	dtype_strtyp_vartyp_var_assigndtype_attr_vartemptfuncdtype_attr_getattrdtype_attr_assign	dtype_vardtype_getattrdtype_assignr  r  r   r  r  r  r  s   f&                      @@@@@@@rf   r  )PreParforPass._replace_parallel_functions  s    ,,E(	i$==?LE5%ejj15eRYY//,,C"ll3884G ;;D!$00TWW5F0( 0(b !.. JJ71<7! / %T2773398L))w. #ll4::??;%c5>>+?+?@@ %(IIE$)KKE"'))C')vve];5OQT'UH:?**:K:KE:RDLL7#%99T5##>D*,))DC*HK ),E
I(F2,3	&(ff %}]'CS'JG9>9L9L ):+DLL6-/YY " 8'.HN .0VVE=IZ;[]`-aN#0#=D$)JJ$4$4$=$=d$CE!//gllA[@]_ab@E@X@XY]@^DLL)<)<=137TW1X.02		:Ln^a0b- )+umL6QSV(WI;@>>;O;OPU;VDLL8,.GGLL'TVX[,\M+-99]Is+SL<E $Y^^ <dll7<<>X=ZDNN=9 +4EK!JJ--a>!JJ--a1BC!JJ--a@!JJ--a= JJ'78A=8!m 2 rj   )	r  r  r  r  r  r  r  r  r  NN)
ry   rz   r{   r|   ro  rc  r  r  r}   r~   r   s   @rf   r  r    s!     
(@A" A"rj   r  c                     \         P                  P                  P                  P                  P
                   F  pVP                  V 8X  g   K  Vu # 	  R # r^   )r   r  r   	templatesbuiltin_registryr  r3  )ru  fts   & rf   r
  r
  ?  s9    jj))::DD66R<I Erj   c                   :   a  ] tR tRt o Rt]! 4       3R ltRtV tR# )ParforPassStatesiE  zCThis class encapsulates all internal states of the ParforPass.
    c                   Wn         W n        W0n        WPn        W`n        W@n        Wpn        Wn        V
P                  V n	        V
P                  V n
        V
P                  V n        \        P                  ! V P                  V P                   V P                  V P                  4      V n        \        P                  P!                  \#        VP$                  P'                  4       4      4       Wn        Wn        R V	9  d   / V	R &   R# R# )r   N)r  r  r  r  r  r   r  diagnosticsr  swapped_fnsr  r  rY   ArrayAnalysisr   _the_max_labelrA  r   r  r  r  metadata)rb  r  r  r  r   r  r  r  r  r-  r)  s   &&&&&&&&&&&rf   rc  ParforPassStates.__init__I  s     """&&&33&22"-"@"@,::NNDLL$,,
 	&&s7>>+>+>+@'AB
 H$"$HY %rj   )rY   r  r)  r  r  r  r-  r  r  r   r*  r  r  r  N)	ry   rz   r{   r|   ro  r  rc  r}   r~   r   s   @rf   r'  r'  E  s     
 /0% %rj   r'  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	ConvertInplaceBinopic  0Parfor subpass to convert setitem on Arrays
    c                     Wn         . V n        R# z6
Parameters
----------
pass_states : ParforPassStates
Npass_states	rewrittenrb  r5  s   &&rf   rc  ConvertInplaceBinop.__init__f       'rj   c           
     6   V P                   p\        V4      pV EF  pW,          p. pVP                  P                  V4      pVP                   EF  p\        V\        P                  4      '       Ed[   VP                  p	VP                  p
\        V
\        P                  4      '       Ed"   V
P                  R 8X  Ed   V
P                  pV
P                  pV
P                  pVP                  VP                   ,          pVP                  VP                   ,          p\        V\"        P$                  P&                  4      '       d   \        V\"        P$                  P&                  4      '       d^   V P)                  VWP*                  W4      pV P,                  P/                  \1        VVR R7      4       V\        P                  ! WV4      .p\        V\2        4      '       d   VP5                  V4       EK  VP/                  V4       EK  	  Wen        EK  	  R# )inplace_binopoldnewreasonN)r5  r/   rY   get_equiv_setr  r   r   r  r  r  r  ru  rv  r  rhsr  r\  r
   r   r   _inplace_binop_to_parforimmutable_fnr6  rj  r  r  r  )rb  r  r5  
topo_orderr  r  new_bodyr  r  r  r  rv  r  r  
target_typ	value_typ	new_instrs   &&               rf   r  ConvertInplaceBinop.runo  s   &&$V,
  EMEH#22@@GIeRYY//,,C ;;D!$00TWW5O"hh!% $%0%8%8%E
$/$7$7

$C	%j%..2F2FGG))U^^5I5IJJ,0,I,I)(+->->-O	 $ 5 5$(U	0?%A!" *3BIIf34O(PeT**OOE*OOE*1 $2 "J;  rj   c           
     ~   V P                   pVP                  pVP                  VP                  ,          pVP                  p	\
        P                  ! Wr4      p
VP                  VP                  ,          pVP                  V4      p\        VP                  WV4      w  r\        4       p\
        P                  ! Wr4      p\        VP                  W}V4      w  pp\
        P                  ! V\        R4      V4      pVP                  VP                  VP                  &   \
        P                  P                  VVV4      p\        VP                  VV4      VP                   V&   VP"                  P%                  \
        P&                  ! VVV4      4       \
        P                  ! V\        R4      V4      pWP                  VP                  &   \
        P                  P                  VVV4      p\        WV4      VP                   V&   VP"                  P%                  \
        P&                  ! VVV4      4       \
        P                  ! V\        R4      V4      pWP                  VP                  &   \
        P                  P)                  VVVV4      pVP"                  P%                  \
        P&                  ! VVV4      4       V P                   P*                  P-                  WP                  4      p\        VVV4      VP                   V&   \
        P.                  ! VVVV4      p\        \0        P2                  VVV	4      VP                   V&   VP"                  P%                  V4       \5        W/ VVVRVP6                  4      pVV/Vn        \:        P<                  ^8  d   \?        R4       VPA                  4        V# )generate parfor from setitem node with a boolean or slice array indices.
The value can be either a scalar or an array variable, and if a boolean index
is used for the latter case, the same index must be used for the value too.

$value_varz$target_var$expr_out_varzparfor from inplace_binop)r;  rM  )!r5  r  r  r\  r   r   Block	get_shape_mk_parfor_loopsr    _make_index_varrk  r   r  getitemrP   r  r  rj  r  binopr  unify_pairsSetItemr
   nonerq  r  r~  r   DEBUG_ARRAY_OPTrb   r  )rb  r  rv  ru  r  r  r5  r  arr_typel_typr}  rG  	size_vars
index_vars	loopnests
body_label
body_blockr  index_var_typ	value_vargetitem_call
target_varexpr_out_var
binop_exprunified_typesetitem_noder   s   &&&&&&                     rf   rB  ,ConvertInplaceBinop._inplace_binop_to_parfor  s   
 &&%%fkk2XXe)
''

3	''/	 !11D1DiX[ \
  \
XXe)
#2##U
$D 	= FF5-"=sC	.7ooINN+wwui=.7OOY/7l+ryyy#FG VVE=#?E
/5JOO,wwvy#>.7]/,l+ryyz3GH vve]?%CSI17L--. WW]]2z9cB
ryy\3GH''11==fooV,5,-6j) zz&)\3G.7JJ/8l+|,	r3	9-{/@/@B&
3!!Q&-.KKMrj   c                    \         P                  pV P                  P                  P	                  V\        V4      / 4      # r^   operatorrR  r5  r  resolve_function_typer#  rb  rv   fntys   && rf   _type_getitem!ConvertInplaceBinop._type_getitem  3    ))??eDkSUVVrj   r4  N)ry   rz   r{   r|   ro  rc  r  rB  rn  r}   r~   r   s   @rf   r0  r0  c  s'     #"J>@W Wrj   r0  c                 r    \        V \        P                  4      '       d   V P                  # V P                  # r^   )r   r   rU  r   r  r0  s   &rf   get_index_varrr    s%     BJJ//177@Q[[@rj   c                   @   a  ] tR tRt o RtR tR tR	R ltR tRt	V t
R# )
ConvertSetItemPassi  r1  c                     Wn         . V n        R# r3  r4  r7  s   &&rf   rc  ConvertSetItemPass.__init__  r9  rj   c                :   V P                   p\        V4      pV EF  pW,          p. pVP                  P                  V4      pVP                   EF  p\        V\        P                  \        P                  34      '       Edw   VP                  p	VP                  p
\        V4      pVP                  pVP                  V
P                  ,          pVP                  VP                  ,          pVP                  VP                  ,          p\        V\        P                   P"                  4      '       Ed   \        V\        P                   P"                  4      '       Ed   \        VP$                  \        P&                  4      '       Edi   VP(                  VP(                  8X  EdM   \        V\        P*                  4      '       d?   V P-                  VWW4      pV P.                  P1                  \3        VVR R7      4       TpEM\        V\        P                   P"                  4      '       d   \5        \6        VP8                  VP                  4      p\        V\        P:                  4      '       d~   VP<                  R8X  dm   VP>                  P                  VP                  8X  dH   V P-                  VWVVP                  4      pV P.                  P1                  \3        VVRR7      4       TpEMVPA                  V4      p\        V\        PB                  4      '       d+   \E        \G        \I        R VP                  4      4      4      pM/\        V\        PJ                  PL                  4      '       d   ^pM^ pVez   \        V\        P                   P"                  4      '       d   VVP(                  8X  d?   V P-                  VWWVR7      pV P.                  P1                  \3        VVRR7      4       TpVP1                  V4       EK  	  Wen        EK  	  R# )masked_assign_broadcast_scalarr<  rR  masked_assign_arrayc                 J    \        V \        P                  P                  4      # r^   )r   r
   r  	SliceTyper0  s   &rf   rH  (ConvertSetItemPass.run.<locals>.<lambda>"  s    jEJJ<P<P.Qrj   N)r   slice)'r5  r/   rY   r@  r  r   r   StaticSetItemrU  rv  r  rr  r  r  r\  r
   r   r   r   Booleanr   Number_setitem_to_parforr6  rj  r  r:   r>   r  r  ru  r   rO  r  r   r  filterr  r{  )rb  r  r5  rD  r  r  rE  r  r  rv  r  r   r  rF  	index_typrG  rH  val_defr   sliced_dimss   &&                  rf   r  ConvertSetItemPass.run  s   && %V,
  EMEH#22@@GIeb&6&6

%CDD))C"\\F)%0E!KKE!,!4!4V[[!AJ + 3 3EJJ ?I + 3 3EJJ ?I!*enn.B.BCC&y%..2F2FGG&yFF&OOy~~=))U\\BB,0,C,CI(+U-C	 $ 5 5$(U	/O%Q!" )2!+Iu~~7K7K!L!L*/@S@S05

+<$.w$@$@$+JJ)$;$+MM$6$6%**$D040G0G	,/1OI$(NN$9$9(,I4I)K%& -6E %.$7$7$>E))U__EE /2$v$Q$-OO85 36 /7 ",Iuzz7K7K!L!L /0./
 !& 1%/	5>>;O;O%P%P!,	!>,0,C,CI(+U -D -P	 $ 5 5(,I4;)=!" )2&I $J "JS  rj   Nc           
     (   V P                   pVP                  pVP                  VP                  ,          p	V	P                  p
VP                  VP                  ,          p\
        P                  ! W4      pV'       Ed   \        V\        P                  4      '       g#   \        V\        P                  4      '       g   Q hTp\
        P                  ! V\        R4      V4      p\
        P                  P                  W4V4      p\        P                   P#                  W4      P$                  pVVP                  VP                  &   V P'                  W34      VP(                  V&   VP+                  \
        P,                  ! WV4      4       TpM?\        V\        P.                  4      '       g   Q hVP1                  V4      pVP                  p. p. pV Fy  p\
        P                  ! V\        R4      V4      pVP+                  V4       \        P2                  VP                  VP                  &   VP+                  \5        V^ V^4      4       K{  	  \7        4       p\
        P                  ! W4      p\9        VP                  VVV4      w  pp\;        VV/ VVVRVP<                  4      pV'       d   VV/Vn        TpRpM\7        4       p\
        P                  ! W4      p\7        4       p\
        P                  ! W4      pVVVVVV/Vn        \
        P                  ! V\        R4      V4      pXVP                  VP                  &   \
        P                  P                  VVV4      pVP@                  PC                  \
        P,                  ! VVV4      \
        PD                  ! VVVV4      .4       VP                  VP                  ,          p \        V \        PF                  PH                  4      '       d   \
        P                  ! V\        R4      V4      p!V P                  VP                  V!P                  &   \
        P                  P                  VVV4      p\K        V P                  V V4      VP(                  V&   VP@                  P+                  \
        P,                  ! VV!V4      4       MTp!\
        PL                  ! VVV!V4      p"\K        \        PN                  VP                  VP                  ,          VV
4      VP(                  V"&   VP@                  P+                  V"4       V'       d1   VP@                  P+                  \
        PP                  ! VV4      4       \R        PT                  ^8  d   \W        R4       VPY                  4        V# )rK  z$subarrparfor_indexNz	$mask_varrL  zparfor from setitem)setitemrM  )-r5  r  r  r\  r   r   rN  r   r
   r  r{  rk  r   r  rR  r   	arraydeclget_array_index_typeresultrn  r  rj  r  ArrayCompatiblerO  uintpr_  r    rQ  rq  r  r~  r  r  Branchr   r   rP   rU  rV  Jumpr   rW  rb   r  )#rb  r  rv  r  r   r  r   r5  r  rX  rY  r  r}  rZ  
subarr_varra  
subarr_typbool_typr\  r[  size_varr  r]  r^  r_  r   
true_block	end_label
true_label	end_blockmask_varmask_valrG  r`  rf  s#   &&&&&&&                            rf   r  %ConvertSetItemPass._setitem_to_parfor;  sM   
 &&%%fkk2''

3	XXe)
5 i99i99; : I}Y'?EJ77??6#>L))>>SZZJ3=K
0262D2DgEY2ZK!!,/bii#FGF i)>)>??@?!++F3I H 	
!HumN&CSIIi(27++K	/XiHa@A	 "  \
XXe)
#2##UJ
$D 	=	:r3	9'):):< *J7F#JI $J%-J"I,I *J *J )I "F vve];%?EH19K.wwui=HOO""yy8S1yy:y#>$ 
  ''

3	i!5!566umL&A3GI2;//K	/77??5)SAL2;M3;K!!,/OO""299\9c#JKIzz&)YD.7JJ++FKK8-/Ql+|,OO""2779c#:;!!Q&'(KKMrj   c                    \         P                  pV P                  P                  P	                  V\        V4      / 4      # r^   ri  rl  s   && rf   rn   ConvertSetItemPass._type_getitem  rp  rj   r4  r^   )ry   rz   r{   r|   ro  rc  r  r  rn  r}   r~   r   s   @rf   rt  rt    s)     P"d\|W Wrj   rt  c                   \        V4      pVP                  pV^8  g	   V'       d   \        P                  ! V\	        R4      V4      p\
        P                  P                  \
        P                  V4      WP                  &   \        P                  P                  \        V4      V4      p\        P                  ! WV4      p	VP                  P                  V	4       V\
        P                  P                  \
        P                  V4      3# V^8X  d   V^ ,          \
        P                  3# \         P"                  ! RVR7      h)a  When generating a SetItem call to an array in a parfor, the general
strategy is to generate a tuple if the array is more than 1 dimension.
If it is 1 dimensional then you can use a simple variable.  This routine
is also used when converting pndindex to parfor but pndindex requires a
tuple even if the iteration space is 1 dimensional.  The pndindex use of
this function will use force_tuple to make the output index a tuple even
if it is one dimensional.
z$parfor_index_tuple_varz,Parfor does not handle arrays of dimension 0rv  )r   rv  r   rk  r   r
   
containersUniTupler  r\  r  build_tupler  r  r  rj  r   UnsupportedRewriteError)
r  r  r[  r^  force_tuplendimsrv  	tuple_var
tuple_calltuple_assigns
   &&&&&     rf   rQ  rQ    s     
OE
..CqyKFF5-%#'(+-	"'"2"2";";KK# WW((j)93?
yy<|,%**33EKKGGG	!!}ekk)),,:
 	
rj   c           	         . p. pV Fn  p\         P                  ! V\        R4      V4      pVP                  V4       \        P
                  WP                  &   VP                  \        V^ V^4      4       Kp  	  WT3# )F
Create loop index variables and build LoopNest objects for a parfor.
r  )r   rk  r   rj  r
   r  r\  r_  )r  rZ  r  rv  r\  r[  r  r  s   &&&&    rf   rP  rP    sq     IJFF5-"?E	)$"'++)Q!<=	 
   rj   c                   T   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tRtV tR# )ConvertNumpyPassi  zQ
Convert supported Numpy functions, as well as arrayexpr nodes, to
parfor nodes.
c                     Wn         . V n        R # r^   r4  r7  s   &&rf   rc  ConvertNumpyPass.__init__      &rj   c           
        V P                   p\        V4      p. pV EF  pW,          p. pVP                  P                  V4      pVP                   EFo  p	\        V	\        P                  4      '       Ed:   V	P                  p
V	P                  pV P                   P                  VP                  ,          pV P                  V4      '       d   \        V P                  V
4      '       dA   V P                  WV
4      pVe*   V P                   P#                  \%        V	VRR7      4       Tp	Ml\        V
\        P&                  4      '       dM   V
P(                  R8X  d<   V P+                  WW4      pV P                   P#                  \%        V	VRR7      4       Tp	VP#                  VP                  4       VP#                  V	4       EKr  	  Wvn        EK  	  R # )Nnumpy_allocatorr<  	arrayexpr)r5  r/   rY   r@  r  r   r   r  r  r  r  r\  _is_C_or_F_orderr:   _is_supported_npycall_numpy_to_parforr6  rj  r  r  ru  _arrayexpr_to_parfor)rb  r  r5  rD  
avail_varsr  r  rE  r  r  r  r  r  rH  s   &&            rf   r  ConvertNumpyPass.run  s{   &&$V,
 
EMEH#22@@GIeRYY// ;;D,,C"..66sxx@G,,W55 !;!;TBB(,(=(=id(SI(4 $ 5 5d(-(1+<7" !#
 )2'bgg66477k;Q(,(A(A ))BI NN11$$)$-'23 
 %.E%%chh/&3 $4 "J=  rj   c                   \        V\        P                  P                  4      '       d'   VP                  R 8H  ;'       d    VP
                  ^ 8  # V\        J dp   V P                  P                  V,          p\        V\        P                  P                  4      ;'       d'    VP                  R 8H  ;'       d    VP
                  ^ 8  # R# )CF	r   r
   r   r   layoutr   r  r5  r  rb  arr_namer  s   && rf   _is_C_orderConvertNumpyPass._is_C_order  s    h 4 455??c)??hmma.??_""**84CsENN$8$89 ! !JJ#%! !HHqL" rj   c                   \        V\        P                  P                  4      '       d>   VP                  R 8H  ;'       g    VP                  R8H  ;'       d    VP
                  ^ 8  # V\        J d   V P                  P                  V,          p\        V\        P                  P                  4      ;'       d>    VP                  R 8H  ;'       g    VP                  R8H  ;'       d    VP
                  ^ 8  # R# )r  FFr  r  s   && rf   r  !ConvertNumpyPass._is_C_or_F_order  s    h 4 455OOs*DDhoo.D[[(--Z[J[[_""**84CsENN$8$89 ! !ZZ3&;;#***;! !HHqL" rj   c                l   V P                   pVP                  pVP                  pVP                  pVP                  VP
                  ,          p	V	P                  p
VP                  V4      p\        VP                  WV4      w  r\        P                  ! Wg4      p\        VP                  VP                  VP                  V\        V4      WVVP                  VP
                  ,          4	      Vn        \!        4       p\        P                  ! Wg4      p\        P"                  ! V\%        R4      V4      pWP                  VP
                  &   \'        VP                  WlV4      w  ppVP                  P)                  \+        VP,                  VP                  VP                  VP                  VVVVVVV4      4       RP/                  \1        VP                  4      4      3p\3        W/ VVVV^ ,          VP4                  4      p\        P6                  ! VVVV4      p\9        \:        P<                  VP                  VP
                  ,          VV
4      VP                  V&   VP                  P?                  V4       VV/Vn         \B        PD                  ^8  d   \G        R4       VPI                  4        V# )zUgenerate parfor from arrayexpr node, which is essentially a
map with recursive tree.
rM  zarray expression {}zparfor from arrayexpr)%r5  r  rv  r  r  r\  r   rO  rP  r   rN  r!   r  r  r#  r  r    rk  r   rQ  r  _arrayexpr_tree_to_irr  r6  repr_arrayexprrq  r  rU  rP   r
   rV  rj  r~  r   rW  rb   r  )rb  r  r  r  r  r5  r  rv  r  rX  rY  rZ  r[  r\  r}  r]  r^  rc  r  r_  patr   rf  s   &&&&&                  rf   r  %ConvertNumpyPass._arrayexpr_to_parfor  sE    &&		gg~~%%chh/ '',	 01D1DiX[ \
 XXe)
"!!!6!6)fS)	+

  \
XXe)
vve]?%CSI17L--.#2J$@ 	= 	!##%%##%%	 %++N9>>,JKM	r3	9cRSfVaVgVghzz#y,D.7JJ++CHH5}f/Nl+|,&
3!!Q&)*KKMrj   c                    \        V P                  P                  V4      w  r#\        V\        4      '       d   VP                  R4      '       g   R# VR9   d   R# VR8X  d   V\        9   d   R# R# )z<check if we support parfor translation for
this Numpy call.
r  FTnumpy.randomr   ones)r8   r5  r  r   r  
startswithrV   )rb  r  	call_namemod_names   &&  rf   r  &ConvertNumpyPass._is_supported_npycallG  s`     ,D,<,<,D,DdK	8S))h.A.A'.J.J))~%)|*Crj   c                   \        V P                  P                  V4      w  rEVP                  p\	        VP
                  4      pVR9   g   VR8X  d   V P                  WW&Ws4      # \        P                  ! RV 2VP                  R7      h)r   r  zparfor translation failed for r  r  )
r8   r5  r  rv   r  r  _numpy_map_to_parforr   r  rv  )rb  r  r  r  r  r  rv   r  s   &&&&    rf   r  !ConvertNumpyPass._numpy_to_parforU  s{    +D,<,<,D,DdK	yy488n))X-G,,Y3cXX,,,TF3
 	
rj   c                4   V P                   pVP                  pVP                  p	VP                  VP                  ,          p
V
P
                  pVP                  V4      pVf#   \        P                  ^8  d   \        R4       R# \        VP                  WV	4      w  r\        P                  ! W4      p\        VP                  VP                  VP                  V\!        V4      WV	VP                  VP                  ,          4	      Vn        \%        4       p\        P                  ! W4      p\        P&                  ! V\)        R4      V	4      pWP                  VP                  &   \+        VP                  WV4      w  ppVR8X  d   \        P,                  ! V! ^ 4      V	4      pMVR8X  d   \        P,                  ! V! ^4      V	4      pMV\.        9   d   \1        W&4       \3        WgP                  4      w  ppVP                  P5                  V4       VP                  VP6                  P                  ,          P9                  \:        P<                  ! 4       VV4      VP                  V&   TpM\?        RPA                  V4      4      h\        PB                  ! VVV	4      pVP"                  PE                  V4       \        PF                  ! VVVV	4      p\I        \J        PL                  VP                  VP                  ,          VV4      VP                  V&   VP"                  PE                  V4       \O        W/ V	VVRPA                  V4      R3VPP                  4      pVV/Vn)        \        P                  ^8  d   \        R	4       VPU                  4        V# )
z8generate parfor from Numpy calls that are maps.
        Nz3Could not convert numpy map to parfor, unknown sizerM  r   r  z,Map of numpy.{} to parfor is not implemented{} functionzNumPy mappingzgenerated parfor for numpy map:)+r5  r  rv  r  r\  r   rO  r   rW  rb   rP  r   rN  r!   r  r  r#  r  r    rk  r   rQ  r	  rV   _remove_size_arg_get_call_arg_typesr  r]  r  r   ContextNotImplementedErrorr6  r  rj  rU  rP   r
   rV  rq  r  r~  r  )rb  r  r  r  rv   r  r  r5  r  rv  rX  rY  rZ  r[  r\  r}  r]  r^  rc  r  r_  r  new_arg_typsnew_kw_typesvalue_assignrf  r   s   &&&&&&&                    rf   r  %ConvertNumpyPass._numpy_map_to_parfor`  s    &&		gg%%chh/ '',	%%*KL 01D1DiX[ \
 XXe)
"!!!6!6)fS)	+

  \
XXe)
vve]?%CSI17L--.#2J$@ 	= HHVAY,E& HHVAY,E,&Y-)<))*+&L,!!%%d+*5*=*=diinn*M*[*[ ,+>K!!$'E%>EEiPR R yyc:|,zz#y,D.7JJ++CHH5}f/Nl+|,	r3	9&--i9?K#))+ '
3!!Q&34KKMrj   r4  N)ry   rz   r{   r|   ro  rc  r  r  r  r  r  r  r  r}   r~   r   s   @rf   r  r    s;     $"L		8t	
B Brj   r  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	ConvertReducePassi  z2
Find reduce() calls and convert them to parfors.
c                     Wn         . V n        R # r^   r4  r7  s   &&rf   rc  ConvertReducePass.__init__  r  rj   c           
     l   V P                   p\        V4      pV EF  pW,          p. pVP                  P                  V4      pVP                   F  pR p	\        V\        P                  4      '       d   VP                  p
VP                  pVP                  p\        \        VP                  V4      pVR8X  g   VR8X  d#   \        V P                  W{VP                  V
4      p	V	'       d*   V P                   P#                  \%        V	VRR7      4       T	pVP#                  V4       K  	  Wen        EK  	  R # )Nr   )r>  r=  r?  )r   r   )r   
_functools)r5  r/   rY   r@  r  r   r   r  rv  r  r  r:   r8   r  _reduce_to_parforrv   r6  rj  r  )rb  r  r5  rD  r  r  rE  r  r  r   rv  r  r  r  s   &&            rf   r  ConvertReducePass.run  s	   &&$V,
EMEH#22@@GIeRYY//))C,,C ;;D$]K4G4GNH $::#'??!&t'='=y'+yy#"7--d & %#+/ 
 !'&' $( "J1  2 	rj   c                V  a V P                   pVP                  pV^ ,          pV^,          p\        VP                  VP                  4      p	Rp
Rp\        \        VP                  VP                  V	4      pV'       d   Vw  rrV^,          pTP                  Vf   TMT
4      pVf   R# \        VP                  WV4      w  opSpV'       d   \        R4      hTp\        P                  ! Wd4      pVP                  P                  \        P                   ! VVV4      4       \#        4       pV P%                  VWdSVV4      w  ppV'       d   \        R4      hV
e   \'        VP)                  4       4      p\+        VP)                  4       4      p\        P                  ! Wd4      pVVV&   \        P,                  ! V\/        R4      V4      pXVP                  VP                  &   \        P0                  P3                  V
VV4      pVP                  P5                  \        P                   ! VVV4      \        P6                  ! VVVV4      .4       \9        VVVVVVRP;                  V4      R3VP<                  4      p\>        P@                  ^8  d   \C        R4       VPE                  4        V# )za
Convert a reduce call to a parfor.
The call arguments should be (call_name, array, init_value).
Nunreachablez	$mask_valr  	reductionzparfor from reduction)#r5  r  r>   r  r\  r:   
_find_maskr  rO  rP  AssertionErrorr#  r   rN  r  rj  r  r    _mk_reduction_bodyr   r  r   rk  r   r  rR  r  r  rq  r6  r  r   rW  rb   r  )rb  r  r  rv   rv  r5  r  r  r   arr_defr  mask_indicesmask_query_resultmask_typr   rZ  r\  
mask_indexacc_varr}  r]  r  r~  r  false_labelr^  maskr  r   r[  s   &&&&&                        @rf   r  #ConvertReducePass._reduce_to_parfor  sU   
 &&		G	a !4!4fkkB "*k.A.A;CVCVX_`7H4Fh7'',2FHU	 01D1DiX[ \
I
 // XXe)
ryy7C@A  \
#66y %J I	9 // Y^^-.Jinn./K%-J$.Ij!66%{!;SAD-5K		*wwxC@HOO""yy4-yyz;<$ 
 	:y#y!M$8$8$C$/$12=2C2CE !!Q&)*KKMrj   c           	        ^ RI Hp V P                  p\        VP                  V4      p	V! VP                  V	4      p
VP
                  VP                  ,          pVP                  p\        P                  ! W#4      p\        VP
                  W$V4      w  r\        P                  ! V\        R4      V4      pWP
                  VP                  &   \        P                  P                  W^V4      p\        WV4      VP                   V&   VP#                  \        P$                  ! VVV4      4       \'        V
VP                  P(                  P*                  P,                  VP.                  VP0                  W3VP
                  VP                   4      pVP2                  p\5        4       p\        P                  ! W#4      pVVV&   \7        VP2                  P9                  4       4      pVP2                  V,          pVP:                  P=                  VP:                  4       VP:                  Vn        \?        VVV.4       \A        VVV4       VV3# )zJ
Produce the body blocks for a reduction function indicated by call_name.
)check_reduce_funcz$val)!r   r  r5  r>   r  r  r\  r   r   rN  rQ  rk  r   r  rR  rP   r  rj  r  r=   r  r]  r  r  r  r  r    r   r  r  r  r@   rA   )rb  r  r  rv  r[  r   r  r  r5  reduce_funcfcoderX  in_typr^  r  index_var_typetmp_varra  reduce_f_irr~  r  r  first_reduce_labelfirst_reduce_blocks   &&&&&&&                 rf   r  $ConvertReducePass._mk_reduction_body	  s   
 	D&&$[%8%8)D!+"5"5{C%%fkk2XXe)
$3J%@!	 &&f 5s;,2GLL)wwv#>.7^/-l+"))L'3?@)%(3(;(;(C(C(H(H(T(T(3(=(=(3(=(=)/(8(3(;(;(3(=(=?  &&	L	HHU(	(	) !3!3!8!8!:;(//0BC1667",//,w.@A	7I6)##rj   r4  N)ry   rz   r{   r|   ro  rc  r  r  r  r}   r~   r   s   @rf   r  r    s%     >AF)$ )$rj   r  c                   T   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tRtV tR# )ConvertLoopPassi;	  z*Build Parfor nodes from prange loops.
    c                     Wn         . V n        R # r^   r4  r7  s   &&rf   rc  ConvertLoopPass.__init__>	  r  rj   c                  a@aAaBaCaDaEaFaG V P                   oG\        V4      w  r#\        V4      p\        V4      p\	        WAVP
                  VP                  4      oBVP                  4       pVP                  4        Uu. uF&  qvV,          \        Wg,          P                  4      3NK(  	  pp. p	\        VR  R7       EFZ  w  oCp
\        SCP                  4      ^8w  g   \        SCP                  4      ^8w  Ed    \        P                  '       Eg   SCP                   F  pW,          P                   F  p\!        V\"        P$                  4      '       g   K%  \!        VP&                  \"        P(                  4      '       g   KQ  VP&                  P*                  R8X  g   Kn  V P-                  VP&                  P.                  P0                  V4      '       g   K  Rp\2        P4                  ! \6        P8                  ! WP:                  4      4       K  	  K  	  EK[  \=        SCP                  4      ^ ,          pW,          P                   E	F  p\!        V\"        P$                  4      '       g   K&  \!        VP&                  \"        P(                  4      '       g   KR  VP&                  P*                  R8X  g   Ko  V P-                  VP&                  P.                  P0                  V4      '       g   K  SCP                   Uu. uF   pW9   g   K  VSCP>                  8w  g   K  VNK"  	  ppVP&                  P@                  pV PC                  VP&                  P.                  P0                  V4      w  ppVSCP>                  ,          P                  RR pRoE\E        V4       F  w  pp\!        V\"        P$                  4      '       g   K(  \!        VP&                  \"        P(                  4      '       g   KT  VP&                  P*                  R8X  g   Kq  VPF                  P0                  oETp M	  SEf   Q hVRX VV^,           R ,           p\I        ^ VSCP>                  ,          /SGPJ                  4      w  ppV^ ,          p\M        VE3R lV 4       4      oFSFPO                  SE4       W,          PP                  pVP:                  pSGPR                  PU                  SCP>                  4      p\"        PV                  ! VV4      pV PY                  W,          VV4      Vn
        V Uu/ uF  qW,          bK  	  upoD\[        4       p\"        PV                  ! VV4      SDV&   \M        4       pV F%  pVP]                  VP                  V,          4      pK'  	  \M        4       pSCP                   F  pVP]                  SBV,          4      pK  	  VP_                  V4      p T P_                  V  U!u0 uFB  p!\!        SGPJ                  V!,          \`        Pb                  Pd                  4      '       d   K@  V!kKD  	  up!4      p V Fc  pSDV,          P                  R,          p"\!        V"\"        Pf                  4      '       g   K?  V"PF                  SCP>                  8X  g   K\  VV"n#        Ke  	  VDVF3R lo@Rp#Rp$V@VBVCVG3R lp%R	p&VR
8X  Ed$   VPi                  V^ ,          4      '       g   Q h\k        V%V^ ,          4      p'V''       d	   V'w  p(p#p)p$M	V^ ,          p(\!        V(\"        Pl                  4      '       g   Q hSGPJ                  V(P0                  ,          p*\!        V*\`        Pn                  4      '       d\   \"        Pl                  ! V\q        R4      V4      p+\`        Pr                  SGPJ                  V+P0                  &   \u        V+^ V(^4      .pV+.oAM2TPw                  V$f   T(MT#4      p,\y        SGPJ                  V,VV4      w  oAp\        V4      ^ 8  g   Q hSAp-V$'       d3   \z        ;QJ d    . VA3R lV$ 4       F  NK  	  5M! VA3R lV$ 4       4      oASD\}        SDP                  4       4      ,          p.\"        PV                  ! VV4      p/\        SGPJ                  VSAV/R	R7      w  p+p0V/P                  V.P                  ,           p1V1V.n
        V$'       d   V-^ ,          p2MT+p2V#e   \        R4      hEM^ p9^p:V^ ,          p;\        V4      ^8X  d   V^ ,          p9V^,          p;\        V4      ^8X  d   V^ ,          p9V^,          p; SGP                  P                  V^,          4      p:\!        T:\"        P                  4      '       g#   \6        P                  ! RTP:                  R7      hT:P&                  p:T:^8w  d#   \6        P                  ! RTP:                  R7      h\"        Pl                  ! V\q        R4      V4      p+\!        V9\        4      '       d   V9^ 8  d   \`        Pr                  p0M\`        P                  p0Rp&\u        V+V9V;V:4      .pV0SGPJ                  V+P0                  &   \}        SDP                  4       4      p<VSDV<,          P                  ,           SDV<,          n
        SF U=u/ uF  p=V=V+bK  	  p>p=\        SDV>4       V&'       d   V P                  SDSFV+4       \        TTSDTV$'       d   X2MT+VRVV3SGP                  V R7	      p?V?.VSCP>                  ,          n
        VSCP>                  ,          P                  P                  V4       VSCP>                  ,          P                  P                  \"        Pf                  ! \=        SCP                  4      ^ ,          V4      4       V P                  P                  \        SCV?RR7      4       V F'  pVSCP>                  8w  g   K  VP                  V4       K)  	  \        P                  ^8  g   E	K  \        R4       V?P                  4        E	K  	  EK]  	  R# u upi u upi u upi u up!i   \         d$    \6        P                  ! RTP:                  R7      hi ; iu up=i )c                     V ^,          # r  ri   )tups   &rf   rH  %ConvertLoopPass.run.<locals>.<lambda>M	  s    3q6rj   r2  r  z
prange or pndindex loop will not be executed in parallel due to there being more than one entry to or exit from the loop (e.g., an assertion).N
pair_firstc              3   >   <"   T F  w  rVS8X  g   K  Vx  K  	  R # 5ir^   ri   )r$  tr  
loop_indexs   &  rf   r%  &ConvertLoopPass.run.<locals>.<genexpr>	  s     )OqJ!!s   
c                   < \         P                   ! S4      p SP                  4        F  pVP                  \        P                  4       Fq  p\        VP                  \        P                  4      '       g   K/  VP                  P                  V 9   g   KL  V P                  VP                  P                  4       Ks  	  K  	  . p. pSP                  4        F  pVP                   F  p\        R VP                  4        4       4      pWP,          '       g   K3  VP                  V 4      '       d   KL  \        \        V\        P                  4      4       VP                  p\        \        V\        P                   4      ;'       d    VP"                  R9   4       VP%                  VP                  P                  4       VP%                  V4       K  	  EK  	  W43# )zhfind expressions that involve getitem using the
index variable. Return both the arrays and expressions.
c              3   8   "   T F  qP                   x  K  	  R # 5ir^   r\  r$  rc   s   & rf   r%  CConvertLoopPass.run.<locals>.find_indexed_arrays.<locals>.<genexpr>	  s     (J9IA9I   rR  static_getitem)r  r  
find_instsr   r  r   r  rk  r\  r   r  r  rw  rm  issubsetr;   r  ru  rj  )	indicesr  r  arrsexprslvr  r~  loop_index_varss	          rf   find_indexed_arrays0ConvertLoopPass.run.<locals>.find_indexed_arrays	  sM    #'))O"<%.%5%5%7E(-(8(8(C$.tzz266$B$B$(JJOOw$>$+KK0@0@$A )D &8
  " "%.%5%5%7E(-

%((J9I(J%J#%<<'){{7';';(0$+JtRYY,G$H+/::D$+JtRWW,E -P -P'+ww2O'O%Q$(KK

$@$)LL$6 )3 &8  ${*rj   c                  < \        SP                  V 4      p\        T;'       dI    \        V\        P
                  4      ;'       d'    VP                  R8H  ;'       d    VP                  R8H  4       VP                  p\        P                  ! SP                   Uu. uF  pSV,          NK  	  up!  pS
! 4       w  rV\        VP                  .\        V4      8H  4       \        VP                  V9  4       \        SP                  VP                  4      p\        SP                  SP                  V4      p\!        R4      hu upi )zSFind the case where size_var is defined by A[M].shape,
where M is a boolean array.
r  r   r  )r>   r  r;   r   r   r  ru  r  r  rw  r  exitsr\  r  r  r  r  )r  size_defarr_varrd   	live_vars
index_arrsindex_exprsr  r  r  r  live_mapr  r5  s   &         rf   find_mask_from_size0ConvertLoopPass.run.<locals>.find_mask_from_size	  s    $2+2E2Ex#P !V !VZ"''-J !V !V (y 8!V !V=E]]g=UW"*..$'IITZZ/PZZ/P$Q	2E2G/
$z2B BCI =>"01D1Dhnn"U!+K,?,?ATATV]!^ -];; 0Qs   ETr   r  c              3   J   <"   T F  pV'       d   TMS^ ,          x  K  	  R# 5ir   Nri   )r$  rc   r[  s   & rf   r%  r  

  s$      /F8D1 56q:a=/H8Ds   ##)r  r  z,Only known step size is supported for pranger  z/Only constant step size is supported for prangez4Only constant step size of 1 is supported for prangeFr   )rs  r  )old_loopr>  r?  zparfor from loopr!  )Xr5  r2   rM   rJ   rK   usemapdefmaploopsr  r   r  r  entriesr  r   DISABLE_PERFORMANCE_WARNINGSr   r   r  r  r  ru  _is_parallel_loopr]  r\  warningswarnr   NumbaPerformanceWarningrv  r  headerrv   _get_loop_kindrQ  r  r,   r  rw  r   r  rY   r@  rN  _get_prange_init_blockr    r  intersectionr
   r  r  r  	has_shaper:   rk  Integerr   r  r_  rO  rP  r#  r   rQ  r  r7   r   rR  r  r  r  r>   r  r  r	  r+  intpr&   _replace_loop_access_indicesrq  r  rj  r6  r  r  rW  rb   r  )Hrb  r  r  r  cfgusedefsr-  r  sized_loopsmoved_blocksr   entryr  r  rd   body_labelsrv   	loop_kindloop_replacingheader_bodyhbir  li_indexcpsr  rv  r  r}  r  bodydefsbl
exit_livesrs  rc   	last_instr  r  r&  unsigned_indexr  r   r  
in_arr_typr  rZ  
orig_indexfirst_body_blockr^  r_  r  orig_index_varr]  labelsr  r  r  r  r  r  r  first_body_labelr  index_var_mapr   r  r[  r%  r  r~  r  r  r5  sH   &&                                                              @@@@@@@@rf   r  ConvertLoopPass.runB	  s 
   &&&v.
%f-"6*#CP		?Dzz|L|!a#ehmm"45|Lk/ABBGD!4<< A%TZZA)=:::!%$*M$6$6D !+4 ; ;$.tzz277$C$C$(JJMMV$;$($:$:$(JJOO$8$8*%F %F'4
 !)$*$B$B(+XX%7!8 %7 ".$ &q)E**tRYY//&tzz277;; JJMMV3 224::??3G3GTT 04yy #Gy!$%K %&454D %&AyK #G::??D040C0CDJJOODXDXDN1P-I~ #)"5":":3B"?K!%J%.{%;	T&tRYY77$.tzz277$C$C$(JJMM\$A)-)9)9J'*H! &< &121 #.ix"8;xPQz{;S"SK .q&2E.F.9.A.ACFCa&C&))O)O&OO#''
3"M//E((C + : : H H UI!#%!5J&*&A&A&-<F'NJO7B C{!FI{ CI *I+-88E3+?Ii(  #uH)#+>>'..2D#E *!$J"jj%/%5%5hrl%C
 )$11*=E "..5 0\5a%/0C0CA0F

HYHY%Z 125 0\ ]E )$-aL$5$5b$9	&y"''::%,,;/8I,	 )+4  $H#'L& &6 &*N !J.(2247;;<; "'':DG!D!GMDFHh%)!WF)&"&&99:9%0%8%8%E
%j%--@@(*umN6SUX(YIBG++K//	?%-iFA%F$GE*3J(1(;(;-9-A =CGO)QI0@ + 3 3Ys1-J  #5zA~.~%/
' */ /F8D/F /F8D/F *FJ+4S9I5J+K(%'XXeS%9
3B'//
J(,40	=  *1A1F1FF04(-'-7]N-6N $/"0"?? 0( !" #'7t9>$(GE'+AwHt9>$(GE'+AwH"'2':':'I'I$q''R $.dBHH#=#=&,&D&D$U(,'" !" $(::D#qy&,&D&D$Z(,'" !" %'FF5-2OQT$U	 &eS11eqj,1KKM,1JJM-2N!))UHd!K L>K++INN; ,/y~~/?+@(;FScIdIiIi;i	"238;J$K?aQ	\?M$K M:% 99%	C#E:y#6BN	$-%-y.$I$/$5$5U	DF 17xF4;;',
 4;;',,33K@4;;',,33BGGD<LQ<OQT4UVNN))$!%"%+  )+"JJqM ) --201m +1 C ML#GN !D&0\` $, "&,&D&D$R(,'" !""D %Ls<   ;,p7pppp$=p)p)""p.q..qc                F   W9  d   R # W!,          p\        V4      ^ 8  ;'       d}    V^ ,          R8H  ;'       gi    V^ ,          \        8H  ;'       gQ    V^ ,          R8H  ;'       g=    V^ ,          \        8H  ;'       g%    V^ ,          R8H  ;'       g    V^ ,          \        8H  # )Fr   rr   r   )r   r   rr   r   rb  func_varr  r  s   &&& rf   r0  !ConvertLoopPass._is_parallel_loop}
  s    %#4y1} A A$q'X"5 #@ #@aF9J #@ #@7//#@ #@377o3M#@ #@7j(#@ #@,0Gx,?	Arj   c                   V P                   pW9   g   Q hW!,          p\        V4      ^ 8  g   Q hRpV^ ,          R8X  g   V^ ,          \        8X  d:    RVP                  V,          ^ ,          VP                  V,          R,          33pV# V^ ,          R8X  g   V^ ,          \
        8X  d   RpV#   \         d    Rp T# i ; i)z(see if prange is user prange or internalrr   r   r   )r6  rM  r!  )r   )rM  rM  )r   rM  )r5  r   rr   r*  r  r   )rb  rW  r  r5  r  kinds   &&&   rf   r5  ConvertLoopPass._get_loop_kind
  s    &&%%%#4y1}}7''47o+E,!K$;$;H$Ea$H+JaJabjJklnJo#pp  !W
"d1g&9!D  , , ,s   6B. .B?>B?c                "   RpRp. p\        VP                  4       EFJ  w  rx\        V\        P                  4      '       d~   \        VP
                  \        P                  4      '       dT   VP
                  P                  R8X  d9   V P                  VP
                  P                  P                  V4      '       d   Tp\        V\        P                  4      '       g   K  \        VP
                  \        P                  4      '       g   K  VP
                  P                  R8X  g   EK  V P                  VP
                  P                  P                  V4      '       g   EKH  TpEKM  	  VR8w  Ed   VR8w  Ed   V U	u0 uF  qP                  kK  	  p
p	. p\        \        V^,           V4      4       Fx  pVP                  V,          pVP                  4        U	u0 uF  qP                  kK  	  pp	W,          '       d   W,          p
VP                  V4       Kg  VP                  V4       Kz  	  VP!                  4        VP!                  4        VP                  RV V,           VP                  V^,           R ,           Vn        V# u up	i u up	i )z~
If there is init_prange, find the code between init_prange and prange
calls. Remove the code from entry_block and return it.
r  Nr!  )rQ  r  r   r   r  r  r  ru  _is_prange_initr]  r\  r0  r8  rt   rm  rj  reverse)rb  entry_blockr  prange_argsinit_call_indprange_call_ind	init_bodyr   r  r  arg_related_varssaved_nodes	inst_varss   &&&&         rf   r6  &ConvertLoopPass._get_prange_init_block
  s   
 	 !1!12GA4++
4::rww0O0O

/,,TZZ__-A-A:NN !4++
4::rww0O0O

/..tzz/C/CZPP"# 3 B?b#8 1<<1<KeM!O_EF"''*-1^^-=>-=VV-=	>#//$1$&&t,$$T* G ! + 0 0- @%!&(3(8(89J9K(L!MK !  = ?s   ?JJc                    W9  d   R # W!,          p\        V4      ^ 8  ;'       d%    V^ ,          R8H  ;'       g    V^ ,          \        8H  # )Frk   )r   rk   rV  s   &&& rf   r]  ConvertLoopPass._is_prange_init
  sC    %#4y1}UU$q']":"T"Td1g>TUrj   c           	       a VP                  VP                  4       \        V4      ;_uu_ 4        \        V4      pRRR4       X^ ,          p\	        4       pV EF^  pW,          pVP
                   EFA  p	\        V	\        P                  4      '       EdV   \        V	P                  \        P                  4      '       Ed+   Wu8X  d   V	P                  P                  V9   dg   V	P                  P                  V9  dL   VP                  V	P                  P                  4       VP                  V	P                  P                  4       MVP                  oV3R lp
V
! V	P                  P                  4      \        W4      9   dh   V
! V	P                  P                  4      V
! V	P                  P                  4      8w  d-   \        P                  ! RV	P                  P                   R7      h\#        V	4      '       d   \%        V	4      pVf   EK  \'        \(        V P*                  P,                  VRR7      pVP                  V9   g   Ve   VP                  V9   d   \/        W4       \'        V P0                  WV4       \        V	\2        4      '       g   EK%  V P5                  V	P6                  W#4       EKD  	  EKa  	  W&,          pR#   + '       g   i     EL; i)z
Replace array access indices in a loop body with a new index.
index_set has all the variables that are equivalent to loop index.
Nc                 z   < ^ RI Hp  SP                  V 4      P                  #   TP                   d    T u # i ; i)r   )r   )
numba.corer   	get_exactunversioned_nameNotDefinedError)r\  r   r  s   & rf   unver;ConvertLoopPass._replace_loop_access_indices.<locals>.unver
  s:    9,',t'<'M'M M#)#9#9 ,'+,s   $ ::z Overwrite of parallel loop indexr  T)lhs_only)r   r\  dummy_return_in_loop_bodyr/   rw  r  r   r   r  r  rk  r  r  mapr   r  rv  rD   rE   r:   r>   r5  r  rF   _replace_multi_dim_indrq  r;  r~  )rb  r~  	index_set	new_indexrQ  first_labeladded_indicesrd   r  r  rp  r   ind_defr  s   &&&&         @rf   r;  ,ConvertLoopPass._replace_loop_access_indices
  s&    	inn%&y11$Y/F 2 Qi
 ALE

tRYY//&tzz266:: (TZZ__	-I $ 0 0	 A!dkk&6&67%))$++*:*:; !&, !!1!12c%6KKPUVZVaVaVfVfPgkpquq{q{  rA  rA  lB  QB"("@"@ B$(KKOO#  "$''4T:E} #ND4D4D4L4L$)D:G

i/ ' 3$+LLI$=4TE $55wENP dF++55dnni[[ # d 	"	y 211s   KK	c                   V P                   p\        VRJ4       \        \        VP                  VP                  ,          \
        P                  \
        P                  34      4       \        VP                  V4      p\        \        V\        P                  4      ;'       d    VP                  R8H  4       VP                   Uu. uF  pVP                  V9   d   TMTNK  	  upVn        R# u upi )zY
replace individual indices in multi-dimensional access variable, which
is a build_tuple
Nr  )r5  r;   r   r  r\  r
   Tupler  r>   r  r   r  ru  r  )rb  ind_varrv  rw  r5  ind_def_noder  s   &&&&   rf   ru  &ConvertLoopPass._replace_multi_dim_ind  s    
 &&t#$
;..w||<enn-/ 	0%k&9&97C
<1 5 5 OO}4	6 (4'9'9;'9! ,-66Y+>iAE'9; ;s   C.r4  N)ry   rz   r{   r|   ro  rc  r  r0  r5  r6  r]  r;  ru  r}   r~   r   s   @rf   r  r  ;	  s>     y&v	A(%NVDL; ;rj   r  c                   \        \        V\        P                  4      ;'       d    VP                  R8H  4       VP
                  pVP                  pWP                  ,          pWP                  ,          pVP                  p\        \        V\        P                  P                  4      4       \        V\        P                  P                  4      '       dJ   \        VP                  \        P                  4      '       d    WvP                  8X  d   W4VP                  R3# \        V\        P                  4      '       Ed   \        W4      w  r\        V	R8H  ;'       d    \!        V4      V8H  4       ^ p
. pRpV EF>  pWP                  ,          p\        V\        P                  P                  4      '       dL   \        VP                  \        P                  4      '       d"   TpVP                  pVP#                  R4       K  \        V\        P                  P                  4      '       dM   \        VP                  \        P$                  4      '       d#   TpVP                  pVP#                  R4       EK  \        V\        P$                  4      '       g   EK$  V
^,          p
VP#                  V4       EKA  	  \        T;'       d    W^,
          8H  4       W<XV3# \&        h)check if an array is of B[...M...], where M is a
boolean array, and other indices (if available) are ints.
If found, return B, M, M's type, and a tuple representing mask indices.
Otherwise, raise GuardException.
rR  Nr  )r;   r   r   r  ru  r  r   r\  r   r
   r   r   r   r  r  r9   r   rj  r9  r<   )r  r  r  r  r   rG  r  r   seqru  count_constsr  r  indr  s   &&&            rf   r  r    s    Jw(DDWZZ9-DEMMEMME

#I

#I>>DJy%.."6"6789enn22339??EMM22Y__d22	Iu	/	/ &g5m#88CD(89C)I9enn&:&:;;9??EMM::$??##D)Y(<(<==9??EMM::$??##D)Iu}}55!##C(# & 	55\AX56,66
rj   c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	
ParforPassiO  zParforPass class is responsible for converting NumPy
calls in Numba intermediate representation to Parfors, which
will lower into either sequential or parallel loops during lowering
stage.
c                    V P                   P                  V P                  P                  4       \        P
                  P                  \        P                  ! V P                  P                  4      4       R # r^   )rY   r  r  r  r   r,  rA  find_max_labelrf  s   &rf   _pre_runParforPass._pre_runW  sL     3 34&&##DLL$7$78	:rj   c           	        V P                  4        V P                  P                  '       dh   \        V P                  V P
                  V P                  V P                  V P                  V P                  V P                  4      pVP                  4        V P                  P                  '       d/   \        V 4      P                  V P                  P                  4       V P                  P                  '       d/   \!        V 4      P                  V P                  P                  4       V P                  P"                  '       d/   \%        V 4      P                  V P                  P                  4       V P                  P&                  '       d/   \)        V 4      P                  V P                  P                  4       V P                  P*                  '       d/   \-        V 4      P                  V P                  P                  4       V P.                  P1                  V P                  V P                  P2                  4       \5        V P                  R4       R# )z_run parfor conversion pass: replace Numpy calls
with Parfors when possible and optimize the IR.zafter parfor passN)r  r  stencilr   r  r  r  rY   r  r  r  r  r  rt  r  r  r  r  r  r   r  r;  r0  r)  r  fusionr.   )rb  stencil_passs   & rf   r  ParforPass.run^  sz    	<<&t||T\\'+~~t7J7J'+~~t~~'+zz3L <<t$(()<)<=<<T"&&t||':':;<<!!!d#''(;(;<<<D!%%dll&9&9:<<%%%%))$,,*=*=> 	t||T\\-@-@At||%89rj   c                D    \        V P                  V P                  V4      # )r  )r  r  r  )rb  r  s   &&rf   r  ParforPass._find_masky  s     $,,g>>rj   c                0    \        V P                  WV4      # )r  )rP  r  )rb  rZ  r  rv  s   &&&&rf   rP  ParforPass._mk_parfor_loops  s      iDDrj   ri   N)ry   rz   r{   r|   ro  r  r  r  rP  r}   r~   r   s   @rf   r  r  O  s%     ::6?E Erj   r  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )ParforFusionPassi  z=ParforFusionPass class is responsible for fusing parfors
    c                   \        V P                  P                  4      p\        V P                  V P                  V P
                  V P                  R,          4       \        V P                  V P                  V P
                  V P                  R,          4       V P                  P                  '       Ed   V^8  Ed   \        V P                  P                  4      V P                  n
        \        4       V P                  n        V P                  P                  V P                  P                  4       \        V P                  P                  V P                  P                  V P                   4      w  r#V F<  p\#        V P                  VVP$                  V P
                  4      w  Vn        Vn        K>  	  \+        V P                  V P                  P                  V P                  RR7       \-        V P                  R4       V P/                  V P                  V P                  P                  V P                  V P                  4       \-        V P                  R4       \+        V P                  V P                  P                  V P                  4       \-        V P                  R4       V P/                  V P                  V P                  P                  V P                  V P                  4       \-        V P                  R4       \        V P                  V P                  V P
                  V P                  R,          4       R# R# R# )	zrun parfor fusion passr   F)up_directionzafter maximize fusion downzafter first fusezafter maximize fusion upzafter fusionN)simplify_parfor_body_CFGr  r  r3   r  r  r-  r  r  r?   _definitionsr  rY   r  r  get_parfor_paramsr  get_parfor_reductionsr  r  r  maximize_fusionr.   fuse_parfors)rb  r  r  r   r  s   &    rf   r  ParforFusionPass.run  s8   
 -T\\-@-@A	t||T^^T]]9=UV 	t||T^^T]]9=UV<<9>(9$,,:M:M(NDLL%-1VD*##DLL$7$78 +4<<+>+>+/<<+>+>+/+B+BDJA '<T\\=>=>XX=A^^(M$	19  DLL$,,*=*=t||INP4<<)EFd11"ll11"ll"ll, 4<<);<DLL$,,*=*=t||L4<<)CDd11"ll11"ll"ll, 4<<8T\\4<<yAYZM $2rj   c           	        VP                  4        EF  w  rVVP                  ! V4      pR pV'       g   K$  Rp. p	^ p
V
\        VP                  4      ^,
          8  Edy   VP                  V
,          pVP                  V
^,           ,          p\	        V\
        4      '       d   \	        V\
        4      '       d   VP                  ! V4      pW{n        W|n        \        W{VV P                  R,          W44      w  rV P                  P                  P                  V4       Ves   R pV P                  P                  VP                  ,          P                  VP                  .4       V	P                  V4       V P                  WW44       V
^,          p
EKU  V	P                  V4       \	        V\
        4      '       d   V P                  WW44       V
^,          p
EK  V	P                  VP                  R,          4       Wn        EK  	  R# )TFr   Nr!  )r  r@  r   r  r   rq  r  try_fuser-  r)  r  rj  r  r{  r  fuse_recursive_parfor)rb  rY   r  r  r  r  r  r  fusion_happenedrE  r   r  	next_stmt
fused_nodefuse_reports   &&&&&          rf   r  ParforFusionPass.fuse_parfors  s   "LLNLE&44U;I"O!/"'#ejj/A-- ::a=D %

1q5 1I!$//Jy&4Q4Q %3$@$@$G	)2.7+2:9I MM)4g3H/
 ((77>>{K%1.2O ,,88AHH),,X$OOJ7 66zg_FA$OOD)!$//224GUFA

2/%
A +B 	rj   c                h   \        V4      p\        V P                  WPP                  4       \	        V P                  R V4       \
        P                  ! V P                  V P                  V P                  V P                  4      pVP                  WR4       V P                  WeW44       \        V4       R# )z$after recursive maximize fusion downN)r  r  r  r  r.   rY   r+  r  r  r  r  r  )rb  r   r  r  r  r  arr_analysiss   &&&&&  rf   r  &ParforFusionPass.fuse_recursive_parfor  s    #F+fll;t||%KVT%33DNNDLL04dnnN+,AV$rj   ri   N)
ry   rz   r{   r|   ro  r  r  r  r}   r~   r   s   @rf   r  r    s!     3[j"H% %rj   r  c                   *   a  ] tR tRt o RtR tRtV tR# )ParforPreLoweringPassi  zSParforPreLoweringPass class is responsible for preparing parfors for lowering.
    c           
     
   \        V P                  P                  / / V P                  4       \	        V P                  R4       \        V P                  V P                  V P                  V P                  R,          4       \	        V P                  R4       \        P                  ^8  dD   \        R\        V P                  P                  4       4      4       \        RV P                  4       \        P                  ^8  Ed   V P                  P                  P                  4        EFY  w  r. pVP                  pVP                   EF.  pVP                  V4       \!        V\"        P$                  4      '       g   K7  VP&                  pVP(                  pVP*                  pV P                  VP,                  ,          p	\        RVP,                  V	\/        V	4      4       V	\0        P2                  9   g#   \!        V	\0        P4                  4      '       g   K  \"        P6                  ! V\9        R4      V4      p
\0        P:                  ! VP,                  4      V P                  V
P,                  &   \"        P<                  ! VP,                  V4      p\"        P$                  ! WV4      pVP                  V4       \"        P>                  ! V
.RV4      p\A        \0        PB                  V P                  V
P,                  ,          4      V P                  V&   VP                  V4       \"        P>                  ! V.RV4      p\A        \0        PB                  V	4      V P                  V&   VP                  V4       EK1  	  W2n        EK\  	  V P                  PD                  '       d6   \G        V P                  PH                  V PJ                  V P                  4       \L        '       dD   \O        V PP                  V P                  V P                  V P                  V P                  4       R# \S        V P                  P                  V PT                  PV                  V PX                  4      w  ppV F<  p\[        V P                  VVP\                  V P                  4      w  Vn/        Vn0        K>  	  V F  pVPc                  V P                  4       K   	  \        Pd                  '       d   V P                  Pf                  Ph                  p\k        V4      pV^ 8  d@   V PT                  PV                  '       d   R	MR
p\        RPm                  VVVV4      4       R# \        RPm                  V4      4       R# R# )zrun parfor prelowering passzafter push call varsr   zafter optimizationzvariable types: zcall types: zAdding print for assignment to str_varNAfter fusionr  z0{}, function {} has {} parallel for-loop(s) #{}.zFunction {} has no Parfor.)7push_call_varsr  r  r  r.   r3   r  r-  r   rW  rb   r  r  r  r  rj  r   r   r  rv  r  r  r\  ry  r
   number_domainLiteralrk  r   r  r	  PrintrP   rV  is_generatorfix_generator_typesgenerator_infor   r  lower_parfor_sequentialr  r  r  r  r  r  r  r  r  r  r  r  r  r   r6  )rb  block_labelr  	new_blockr  r  rv  r  rA  r  r  	lhs_const
str_assign	str_printir_printr  r   r  r\  r  r  s   &                    rf   r  ParforPreLoweringPass.run  s   
 	t||**BDLLAt||%;<t||T^^T]]9=UVt||%9:!!Q&$fT\\-?-?-A&BC.$..1!!Q&'+||':':'@'@'B#	!JJD$$T*!$		22"hh"kk"jj"&,,sxx"8?7TXY`Tab"e&9&99ZQVQ^Q^=_=_&(ffUM)4Lc&RG9>9L9LSXX9VDLL6(*3(?I)+9s)KJ%,,Z8(*'D#(FI8A%**dll[b[g[gNh8iDNN95%,,Y7')xxtS'AH7@W7UDNN84%,,X6' '( '
/ (C2 <<$$$ ; ;T=M=M $.%%#dllDNNDMM[ #4DLL4G4G48LL4G4G484K4K#MJ
 '<T\\=>=>XX=A^^(M$	19  !!$,,/  +++||++99
O	q=6:ll6I6I6IN)? ! :;A6'y*<FG 6==dCD ,rj   ri   N)ry   rz   r{   r|   ro  r  r}   r~   r   s   @rf   r  r    s     KE KErj   r  c                   \        VP                  4      pVP                  RR4       \        VP	                  4       4      Vn        V \
        \        ,           9   d   . Vn        V \        9   d5   \        VP                  4      ^8X  d   VP                  P                  4        V \        9   d5   \        VP                  4      ^8X  d   VP                  P                  4        V R8X  d   \        VP                  4      ^8X  d   VP                  P                  4        \        VP                  4      ^8X  dP   VP                  P                  4       pVP                  P                  4        VP                  P                  V4       V R8X  d5   \        VP                  4      ^8X  d   VP                  P                  4        R# )z%remove size argument from args or kwsr   rM  randint
triangularN)r  r  r  r#  r  rS   rR   rv   rU   r   rT   rj  )r  r  r  dt_args   &&  rf   r  r  D  s!    txx.CGGFBSYY[!DH $66 	((tyy>QIIMMO((tyy>QIIMMOItyy>QIIMMOtyy>QYY]]_FIIMMOIIV$L tyy>QIIMMO
rj   c                     . pV P                    F$  pVP                  WP                  ,          4       K&  	  / pV P                   F  w  rSWP                  ,          WE&   K  	  \	        V4      V3# r^   )rv   rj  r\  r  r#  )r  r  r  r   r  r\  s   &&    rf   r  r  l  sb    LyyGHH-.  LXX	$XX.  ,,rj   c                  a SVP                   ,          pVP                  pVP                  p. p\        V\        4      '       Ed   Vw  pp. pV F`  p\
        P                  ! V\        R4      V4      pVSVP                   &   V\        V VSVVVVVVV	V
4      ,          pVP                  V4       Kb  	  V\        P                  9   Ed3   SV^ ,          P                   ,          p\        V4      ^8X  d   SV^,          P                   ,          pVP                  VVV3/ 4      p\
        P                  P                  VV^ ,          V^,          V4      pV\         P"                  8X  d!   \%        V^ ,          V^,          VSV4      w  ppM<VP                  VV3/ 4      p\
        P                  P'                  VV^ ,          V4      pVVV&   VP(                  pVP                  \
        P*                  ! VWm4      4       \,        P.                   EFO  p\        VV4      '       g   K  \1        SWVR7      p\
        P                  ! V\        V4      V4      pSV,          SVP                   &   \2        P4                  ! V P7                  V4      4      p\        V\
        P                  4      '       d   VP8                  R8X  d   VP:                  R8X  d   \
        P                  ! V\        R4      V4      p\<        P>                  PA                  \B        4      SVP                   &   \
        PD                  ! R\B        V4      p\
        P*                  ! VVV4      p\
        P                  PG                  VRV4      pVP                  V4       \
        P                  PI                  VVRV4      pSVP                   ,          PK                  T\        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      / 4      pVVV&   VP(                  pVP                  \
        P*                  ! VVV4      4       VP                  \
        P*                  ! VWm4      4       EKR  	  EM\        V\
        P                  4      '       d   SVP                   ,          p \        V \<        PL                  4      '       d"   V PN                  p\Q        VVVV	VVVSVV4
      pMT pTpVP                  \
        P*                  ! VWm4      4       Mt\        V\
        PR                  4      '       dU   \T        PV                  ! 4       PY                  VPZ                  4      pVP                  \
        P*                  ! WvV4      4       \        V4      ^ 8X  d(   \\        P^                  ! RVR	 R
2VP                  R7      hSPa                  VP                   R4       VSVP                   &   V# )zgenerate IR from array_expr's expr tree recursively. Assign output to
expr_out_var and returns the whole IR as a list of Assign nodes.
z$arg_out_varr  r  sqrtz$math_g_varr(  c              3   J   <"   T F  pSVP                   ,          x  K  	  R # 5ir^   r  )r$  r   r  s   & rf   r%  (_arrayexpr_tree_to_ir.<locals>.<genexpr>  s     $GhWQVV__h    #z.Don't know how to translate array expression 'rG  'Nri   )1r\  r  rv  r   r#  r   rk  r   r  rj  rO   supported_array_operatorsr   rk  r  rS  rj  truediv_gen_np_divideunaryr   r  rY   	MAP_TYPES_find_func_varr  r  r>   ru  r  r
   r  r  r(  r  r  r  r  r   r   _gen_arrayexpr_getitemr	  r   r  resolve_value_typer  r   r  r  )!r  r  r  r  r  r}  rc  r  parfor_index_tuple_varall_parfor_indicesr  rY  r  rv  out_irru  arr_expr_argsarg_varsr   arg_out_varel_typ1el_typ2func_typir_exprTfunc_var_namerW  func_var_def
g_math_varg_mathg_math_assigncall_typvar_typs!   &&f&&&&&&&&                      rf   r  r  x  s    \&&'FE


CF$ M C&&n(EsKK(.GK$$%+G,5,3,5,5,6,7,/,B,>,6
8 
8F OOK( ! 222hqk../G8}!!(1+"2"23$::2@G@IJLN''--HQK!cJ)))(6 Xa[&'9)N%Hg %::2z2N''--HQK=!)Ig))FMM"))G\?@))A"a   !/wC P66%})EsK)0)?&#}}W-C-CM-RSlBGG44I9UZfZkZkouZu"$&&m0Lc"RZ05

0A0A$0GWZ__- iic:V%'YYvz3%G]$&GGOOJ$L\]]=1'',,x2sC"8==1??uu$Gh$Guu$Gh$GGM%-	'"!--biihDEbiiCD1 *2 
D"&&	!	!$))$gu{{++]]F,&"
G FGbii;<	D"((	#	#!44TZZ@biiC89
6{a,,<T!HAF
 	
 KK!!4(!'GLMrj   c                   V P                   pV P                  p\        P                  ! V\	        R4      V4      p\
        P                  P                  \        4      W7P                  &   \        P                  ! R\        V4      p\        P                  ! WV4      p	\        P                  P                  VRV4      p
\        P                  ! V\	        R4      V4      p\        \        P                  V4      pWVP                  &   \        P                  ! WV4      p\        P                  P!                  WV.RV4      pVP#                  WCV P                  ,          W1P                  ,          ./ 4      pVP%                  W.4       W3# )zgenerate np.divide() instead of / for array_expr to get numpy error model
like inf for division by zero (test_division_by_zero).
r  r   dividez	$div_attrri   )r  rv  r   rk  r   r
   r  r  r  r\  r  r  r  r  r"   r  r  r  r  )arg1arg2r  r  r  r  rv  r  r  r  div_attr_callattr_varfunc_var_typattr_assigndiv_callr  s   &&&&&           rf   r  r    s     JJE
((Cvve];7=H"ZZ..u5GMM99T5#&D))DC0KGGOOHh<Mvve];7=H#ELL)<L)HMM))MS9Kww||HTlB<H))DII&		(:;RAH
MM;,-rj   c
           	     N   VP                   p
TpWqP                  ,          pWqP                  ,          P                  p\        V4      pV P	                  V4      ;'       g    . pV Uu. uF  pV P                  V4      NK  	  ppV^ 8X  EdD   \        P                  ! VP                  \        R4      V
4      p\        P                  P                  VP                  ^RR7      pVVVP                  &   \        P                  ! R\         P"                  VV.WgV4      pVP$                  P'                  V4       Tp\        P(                  ! ^ VP                   4      p\        P                  ! VP                  \        R4      V
4      p\        P*                  VVP                  &   \        P,                  ! VVV
4      pV	P/                  V4       TpEMV^8X  d   VR,          pEM\1        V Uu. uF  pVRJNK	  	  up4      '       Ed   W,
          p\        P                  ! VP                  \        R4      V
4      p\        P2                  P5                  \        P*                  V4      VVP                  &   \        P(                  ! ^ VP                   4      p\        P                  ! VP                  \        R4      V
4      p\        P*                  VVP                  &   \        P,                  ! VVV
4      pV	P/                  V4       . p\7        \9        V4      4       FN  pVV,          pVV,          pV^8X  d   VP/                  V4       K/  VP/                  VVV,           ,          4       KP  	  \;        \7        V4      4      p\        P<                  P?                  VV
4      p\        P,                  ! VVV
4      pV	P/                  V4       Tp\        P<                  PA                  WV
4      p \C        WGVP                  ,          W{P                  ,          4      VV &   V # u upi u upi )	a  if there is implicit dimension broadcast, generate proper access variable
for getitem. For example, if indices are (i1,i2,i3) but shape is (c1,0,c3),
generate a tuple with (i1,0,i3) for access.  Another example: for (i1,i2,i3)
and (c1,c2) generate (i2,i3).
z$ravelr  )r   r   r  r   z$const_ind_0Nz$parfor_index_tuple_var_bcastr!  )"rv  r\  r   r   rO  get_equiv_constr   rk  r  r   r
   r   r   r   r   gen_np_callr  r   r  r  r	  r  r  rj  r4  r  r  r8  rt   r  r  r  rR  rP   )!r  r  r  r  rY  r  r  r  r}  r  rv  r  r  r  num_indicesrZ  rc   size_consts	ravel_var	ravel_typstmts
const_node	const_varconst_assign
ind_offsetr  r[  r   r  
size_constr  r  r  s!   &&&&&&&&&&                       rf   r  r    s%     ''C&Ixx GHH""E()K##C(..BI9BCA9,,Q/KCzFF399mH&=sC	NN((w}}1S(Q	"+	$$Wekk9seYajku%XXa)
FF399mN&CSI	"'++	yyY<l#		!&r*		[1[atm[1	2	2 (
FF399m+'-.13	"'"2"2";";EKK"O	 XXa)
FF399mN&CSI	"'++	yyY<l#
%,'A |H$QJQ!!),!!"4Z!^"DE ( (:./
WW((S9
yyY<l#	ggoocc2G"6388+<#*>>#:<IgNi D, 2s   'P)P"c                    V F8  pW,          p\        V\        4      '       g   K#  VP                  V8X  g   K6  Vu # 	  \        P                  ! RVR7      h)zAfind variable in typemap which represents the function func.
    zufunc call variable not foundr  )r   rQ   
typing_keyr   r  )r  r]  r  rv  r  r
  s   &&&&  rf   r  r  O  sH     Ja""q||t';H	 
 
(
()Hc
RRrj   c                 
   \         P                  P                  \         P                  ! VP                  4      4       R p/ p\        \        VP                  P                  4       4      4      P                  pVP                  P                  4        F  w  r\        WWbW5VR7      w  rWV&   K  	  Wan        V'       d   \        VP                  4      Vn        \        VR4       \        WW4R,          4       \        VR4       R# )Fr  z after parfor sequential loweringr   z after parfor sequential simplifyN)r   r,  rA  r  r  nextiterr  r  r  _lower_parfor_sequential_blockr1   r.   r3   )
r  r  r  r  r-  parfor_foundr  r  r  r  s
   &&&&&     rf   r  r  Z  s    ""8#:#:7>>#JKLJgnn++-./55E ' 4 4 6$B
Y%! #(; !7  N&w~~67>?Wy9*=>7>?rj   c                    \        VP                  4      pVR8w  EdJ   RpVP                  V,          pVP                  P                  p	\        P
                  ! Wi4      p
VP                  RV V
n        VP                  V^,           R Vn        \        4       pV
P                  P                  \        P                  ! W4      4       \        VP                  V4      W+&   WV &   \        4       p \        VP                  4      p\        V4       EFX  pVP                  V,          p\        4       p\        4       p\        VVP                  VP                  VP                   VVV	4      pVVP                  R,          n        VP                  R,          P"                  pVW.&   \%        VVVWi4      pVP&                  VP                  R,          n        VW/&   V^ 8X  dS   VP                  P                  P                  \        P                  ! W4      4       V VP                  R,          n        M6WX,          P                  R,          n        VVP                  R,          n        TpEK[  	  \-        VP.                  P1                  4       4      pVP.                  V,          P                  P                  \        P                  ! XV	4      4       \3        VP.                  P1                  4       4      pVXP                  R,          n        VP.                  P5                  4        F(  w  pp\7        VVW#WEVR7      w  pp\        VV4      VV&   K*  	  \        VP                  4      pEKQ  W3# )r   TNr  r!  )_find_first_parforr  r}  rv  r   rN  r    rj  r  rI   r   r|  rt   r#   r  r  r  r  r$   ra  falsebrtruebrr   r~  r  r   r  r   )r  r  r  r  r  r  r  r   r  rv  
prev_block
init_labelr  r  range_labelheader_labelrange_blockphi_varheader_blockprev_header_labelbody_last_labelbody_first_labelrd   r   s   &&&&&&&                 rf   r   r   n  s    	5::&A
r'zz!}oo!!XXe)
**Ra.
ZZA'
\
rwwz78!/!G
",; lDOO$uAq)H$,K%<L(K +7KR '!&&r*11G&1J#)'7I*/6L+3+B+BLb!('3J$Av$$++BGGK,EF0;!!"%-@K,-2226=0A!!"%- ,7 < dnn1134',,33GGL#&	( t~~2245'7"$nn**,FQ<1j9OA| +1e4JqM	 -
 uzz*$$rj   c                     \        V 4       F3  w  r\        V\        4      '       g   K  VP                  '       d   K1  Vu # 	  R# r   r!  )rQ  r   rq  rr  r  r   r  s   &  rf   r  r    s6    t_	dF##D,G,G,GH % Irj   c                x   \        4       p. p\        4       p\        V 4      w  rg\        V 4      pV EF  p	W	,          p
\        V
P                  4       F  w  r\
        P                  ! V
P                  V
P                  4      pV
P                  RV Vn        \        ^ V/4      P                  ^ ,          pW^,          p\        WW4      p\        V
P                  WP                  4      w  Vn        Vn        VP                  VP                  4       VP!                  V4       K  	  WWV	,          ,          pEK  	  W43# )zwfind variables used in body of parfors from outside and save them.
computed as live variables at entry of first block.
N)rw  rJ   r/   _find_parforsr  r   rN  r  rv  r,  get_parfor_params_inner#_combine_params_races_for_ssa_namesrs  r  r   r{  rj  )r  options_fusionr  r  r   pre_defsr  all_defsrD  r  r  r   r   dummy_blockbefore_defsr  s   &&&             rf   r  r    s    JGuH"6*KA (J&uzz2IA((5;;		:K$zz"1~K*A{+;<CCAFK#H,.F +NV\\+'FM6< NN699%NN6" 3 	UO## $ rj   c                $  a aa V 3R lo\        V4      p\        \        SV4      4      pV FX  o\        ;QJ d     VV3R lV 4       F  '       g   K   RM	  RM! VV3R lV 4       4      '       d   VP	                  S4       KX   M	  W,          V3# )zReturns `(params|races1, races1)`, where `races1` contains all variables
in `races` are NOT referring to the same unversioned (SSA) variables in
`params`.
c                 v   <  SP                  V 4      P                  #   \        P                   d    T u # i ; ir^   )rm  rn  r   ro  )r  r  s   &rf   	unversion6_combine_params_races_for_ssa_names.<locals>.unversion  s7    	??1%666!! 	H	s    88c              3   :   <"   T F  pS! S4      V8H  x  K  	  R # 5ir^   ri   )r$  pvrvr  s   & rf   r%  6_combine_params_races_for_ssa_names.<locals>.<genexpr>  s     :\ry}"\s   TF)rw  r  rt  r4  discard)r  r  rs  races1unver_paramsr#  r  s   f&&  @@rf   r  r    sm    
 ZFIv./L3:\:333:\:::NN2	  ?F""rj   c                 D   \        V 4      p\        V4      p\        V4      p\        WTVP                  VP
                  4      p\        WBV4      w  r\        V4      p
V
^ 8  d_   \        P                  '       d2   V'       d   RMRp\        RP                  WP                  W4      4       \        V4      W0P                  &   \        V 4       \        VP!                  4       4      pV^ ,          pV^,          pVP
                  V,          V,          pW~,          V,          pV# )r   r  r  z2{}, parallel for-loop {} has nested Parfor(s) #{}.)r  rM   rJ   rK   r+  r,  r  r   r   r  rb   r6  r{  r  r  r  r  )r   r  r  r  r  r<  r=  r%  r  r  r  r  keylistr}  first_non_init_blockr  r  s   &&&&             rf   r  r    s    'F
!&
)Cv&GW^^W^^LH%fkJMJJI1}'''.<N!7  ()/ii*@A "&j!1II X]]_%GJ"1:..,x7K+k9FMrj   c              #   p   "   \        V 4       F"  w  r\        V\        4      '       g   K  W3x  K$  	  R # 5ir^   )rQ  r   rq  r  s   &  rf   r  r    s)     T?dF##'M #s   $66c                 :   \        \        WP                  4      p\        V\        P
                  4      '       dW   VP                  R 8X  dF   VP                   Uu. uF  qDP                  NK  	  upV Uu. uF  qDP                  NK  	  up8X  d   R# R# u upi u upi )r  TF)r:   r>   r\  r   r   r  ru  r  )r  r   nest_indices	index_defrc   s   &&&  rf   _is_indirect_indexr/    sj    ngzz:I)RWW%%),,-*G%OO,OqFFO,0NA0NN -0Ns   B4Bc           
      p   V  EF.  pVP                    EF  p\        V\        P                  \        P                  34      '       d   \        V4      p\        V\        P                  4      '       dL   VP                  V8X  g   \        VVV4      '       d(   VP                  VP                  P                  4       K  VP                  VP                  P                  4       K  \        V\        P                  4      '       d   \        VP                  \        P                  4      '       d   VP                  P                  R9   d   VP                  P                  p	VP                  P                  P                  p
\        V	\        P                  4      '       d9   V	P                  V8X  g   \        VV	V4      '       d   VP                  V
4       EK  VP                  V
4       EK  \        V\         4      '       g   EK  \#        VP$                  P'                  4       VVVVV4       EK  	  EK1  	  R# )rR  Nr  )r  r   r   r~  rU  rr  rk  r\  r/  r   r  r  r  r  ru  r   rq  ,get_array_indexed_with_parfor_index_internalr~  r  )r~  r   ret_indexedret_not_indexedr-  r  r  r  setarray_indexgetarray_indexgetarray_names   &&&&&&     rf   r1  r1     s    HHD$!1!12:: >??!.t!4~rvv66#((E1' '%' '  OODKK$4$45#''(8(89T299--TZZ11**--#@@!%!1!1 $

 0 0 5 5~rvv66#((E1' '%' '  OOM2#''6D&))<NN))+# 7  rj   c                 P    \        4       p\        4       p\        V VVVVV4       WE3# r^   )rw  r1  )r~  r   r-  r  r2  r3  s   &&&&  rf   #get_array_indexed_with_parfor_indexr8  K  s7     %KeO0 ''rj   c                    \        V P                  P                  4       4      p. pV P                  P                  4        F  pVP                   F  p\        V\        P                  \        P                  34      '       g   K5  \        V4      P                  V P                  P                  8X  g   Ke  VP                  VP                  P                  4       K  	  K  	  \        \        V4      \        V4      ,          4      p\!        V4      # )z`get arrays that are written to inside the parfor and need to be passed
as parameters to gufunc.
)r   r~  r  r  r  r   r   r~  rU  rr  r\  r  rj  r  r  rw  r  )r   parfor_params
last_labeloutputsr  r  s   &&    rf   get_parfor_outputsr=  [  s     V%%**,-JG&&(HHD4""2"2BJJ!?@@d#((F,<,<,A,AAt{{//0  ) 3w<#m"445G'?rj   _RedVarInfoT)frozenc	                H   Vf   / pVf   . pVf   \        \        4      pVf   \        \        4      pVf   / p\        V4      p	\        V	4      p
V
R,          p
\	        V4       \        V
4       EF  p\        VP                  V,          P                  4       EF  p\        V\        P                  4      '       Edy   VP                  P                  V9   g   VP                  P                  V9   EdB   VP                  pVP                  pVP                  V9   d   TMWP                  ,          p. p\        V\        P                  4      '       d   VP                  .pMS\        V\        P                  4      '       d4   VP                  P!                  4        Uu. uF  pVP                  NK  	  ppWo,          P#                  V4       V F  pWV&   K	  	  \$        P&                  ! V4      pVP                  V9   d    W<P                  ,          VVP                  &   W,          P)                  V4       \        V\*        4      '       g   EK  \-        WW#WERWx4	       EK  	  EK  	  VP/                  4        F  w  ppVP                  pVV9   g   K  VV9  g   K$  VV,          P1                  4        \3        VVV,          V 4      pVf   KU  VP)                  V4       \5        VV4       \7        \8        V4      pVe   Vw  ppMRpRp\;        VVVR7      VV&   K  	  WT3# u upi )zzfind variables that are updated using their previous values and an array
item accessed with parfor index, e.g. s = s+A[i]
N:r   NNr   reduce_nodesredop)r   r  r  r/   r  r8  r~  r  r   r   r  r  r\  r  rk  r  rm  r  r  r  rj  rq  r  r  r^  get_reduce_nodes%check_conflicting_reduction_operatorsr:   get_reduction_initr>  )r  r   r:  r  
reductionsreduce_varnames
param_usesparam_nodesvar_to_paramr  rD  r  r  r  rA  	cur_param	used_varsr  stmt_cpparam
param_namerB  gri_outr   rC  s   &&&&&&&&&                rf   r  r  t  s    
  &
!$''F (JBJ *%V--e499:D4++))]:))\9kkjj#&88}#<C,xxBX		c266**!$
IRWW--151E1E1G H1GA1GI H%,,Y7"A&/O # ---::*/8/DIgmm,&--g6$''%g]{R- ; &4 ',,.y ZZ
"z'H&&(+E;u3EwOL '&&z25e\J 2LA&&-OHe#H E)4%!-*
:&/ /: &&W !Is   Lc                   RpV F  p\        V\        P                  4      '       g   K%  \        VP                  \        P                  4      '       g   KQ  VP                  P
                  R8X  g   Kn  Vf   VP                  P                  pK  W#P                  P                  8w  g   K  RV P                  ,          p\        P                  ! WCP                  4      h	  R# )zIn prange, a user could theoretically specify conflicting
reduction operators.  For example, in one spot it is += and
another spot *=.  Here, we raise an exception if multiple
different reduction operators are used in one prange.
Nr;  zCReduction variable %s has multiple conflicting reduction operators.)r   r   r  r  r  ru  fnrn  r   r  rv  )rO  nodesfirst_red_funcnoder  s   &&   rf   rE  rE    s     NtRYY''tzz277++JJMM?*%!%!ZZ]]22494J4JKC 88hhGG rj   c                   \        \        V 4      ^8  4       \        \        R V 4      4      R,          P                  p\        \        V\        P                  4      ;'       d    VP                  R9   4       VP                  pVP                  R8X  d   V\        P                  8X  d   \        P                  pMqV\        P                  8X  d   \        P                  pMKV\        P                  8X  d   \        P                   pM%V\        P"                  8X  d   \        P$                  pV\        P                  8X  g   V\        P                  8X  d   ^ V3# V\        P                   8X  g   V\        P$                  8X  d   ^V3# R# )zR
Get initial value for known reductions.
Currently, only += and *= are supported.
c                 J    \        V P                  \        P                  4      # r^   )r   r  r   r  r0  s   &rf   rH  $get_reduction_init.<locals>.<lambda>  s    Z%Arj   rS  r!  )r;  rS  r!  )r;   r   r  r  r  r   r   r  ru  rS  rj  r   iaddsubisubmulimulr  itruediv)rT  acc_expracc_expr_fns   &  rf   rF  rF    s   
 CJ!O FA5IJ2NTTHJx)WWhkk=W.WX++K{{g(,,&"--KHLL("--KHLL("--KH,,,"++Khmm#{hmm'C+~

&
**
*+~rj   c                 n   V P                   R 8X  g   V P                   R8X  d   V P                  \        P                  8X  g    V P                  \        P                  8X  d"   \
        P                  ! RV P                  4      h\        P                  \        P                  \        P                  \        P                  \        P                  \        P                  \        P                  \        P                  .pV P                  V9   # V P                   R8X  d   \!        \"        W4      pVR9   d   R# R# )r;  rS  zParallel floordiv reductions are not supported. If all divisors are integers then a floordiv reduction can in some cases be parallelized as a multiply reduction followed by a floordiv of the resulting product.r  TF))r   r   )r   r   )r   numba.np.npdatetime_helpers)r   rc  )ru  rS  rj  	ifloordivfloordivr   NumbaValueErrorrv  rZ  r\  r^  r_  r   r[  r]  r  r:   r8   )rc   r  suppsr  s   &&  rf   supported_reductionrh    s    tt!$$'/448%%%1B1B)B(( +7 :;	@ @
 ""!!# ttu}ttv~3 
 
 rj   c           	     l  aaa Rp/ oR
VV3R lloV3R loV P                   pV P                  p\        V4       EFd  w  rgVP                  pVP                  p	V	SVP                   &   \        V	\        P                  4      '       d   V	P                   S9   d	   S! V	4      p	\        V	\        P                  4      '       g   K  \        V3R lV	P                  4        4       4      p
WJ9   g   K  V^,           \        V4      8  d   \        W^,           ,          \        P                  4      '       d)   W^,           ,          P                  P                  V8w  d   Rp\        W^,           R 4       FI  w  r\        V\        P                  4      '       g   K'  VP                  V8X  g   K:  Wl,           ^,           p M	  Ve=   VRV^,            WV^,            ,           W^,           V ,           W^,           R ,           pV^,           \        V4      8  dV   \        W^,           ,          \        P                  4      '       d)   W^,           ,          P                  P                  V8X  g"   VP                  V8w  d   \        RV: R24      h\        W4      '       g   \        RV,           R,           4      h\        V	4       Uu. uF  pVP                   S! VR4      3NK  	  ppV UUu. uF  w  ppVP                   V8w  g   K  VNK  	  ppp\        V4      ^8X  g   Q hV UUu. uF  w  ppVVP                   8w  g   K  VV3NK  	  ppp\!        V4      p\        P                  ! VP"                  VR	,           VP$                  4      VV^ ,          &   \'        V	V4       WR p V# 	  V# u upi u uppi u uppi )z
Get nodes that combine the reduction variable with a sentinel variable.
Recognizes the first node that combines the reduction variable with another
variable.
NTc                   < SP                  V P                  R4      p\        V\        P                  4      '       d   Vf   TpMW#8X  d   R# S! W2R7      # V'       g   Vf   V # T# )zULookup definition of ``var``.
Returns ``None`` if variable definition forms a cycle.
N)r  )r  r\  r   r   rk  )r  varonlyr  lookedup_varcyclic_lookupdefss   &&& rf   rm  'get_reduce_nodes.<locals>.cyclic_lookup  sZ     xx$/lBFF++}$& ;;"l&:3MMrj   c                 6   < S! V / VB pVf   \        R4      hV# )zJSimilar to cyclic_lookup but raise AssertionError if a cycle is
detected.
zunexpected cycle in lookup())r  )rv   kwargsr  rm  s   *, rf   noncyclic_lookup*get_reduce_nodes.<locals>.noncyclic_lookup(  s*     T,V,; !?@@
rj   c              3   J   <"   T F  pS! VR 4      P                   x  K  	  R# 5iTNr  )r$  r  rr  s   & rf   r%  #get_reduce_nodes.<locals>.<genexpr>:  s%      4#2a +1d388#2r  zUse of reduction variable z? other than in a supported reduction function is not permitted.z& in an unsupported reduction function.z#initru  )r\  rn  rQ  r  r  r   r   rk  r  rw  rm  r   r  r5  rh  get_expr_argsr  r  rv  r'   )reduction_noderT  r  rB  r\  rn  r   r  r  rA  in_varsfoundjr   jstmtrc   rv   re   non_red_argsreplace_dictrm  rn  rr  s   &&&                @@@rf   rD  rD    s<    LDN N D%66U#kkjjSXXc266""sxx4'7$Cc277## 4#&==?4 4G& ECJ&$Uq5\299==q5\((99=MM!F$-eEFm$< &eRYY77EKK3<N &'UQYF! %= ) "'vA!&fqj!9":!&1uV!4"5 "'z{!3"4
 1s5z)jsRYY.O.O!A#J-->>BRR004DD$45E4H I% %  +388$&BEU&U&N'O Q Q "/s!36!3A !1!T!:;!3  615Iv14I<(A---.2CdFQa166k!QdC#Dz02syy$w,PSPWPW0X\!_-"35$RyS $R 6ICs    N%%N* N* N0;N0c                    V P                   R9   d   V P                  V P                  .# V P                   R8X  d   V P                   Uu. uF  qNK  	  up# \	        RP                  V 4      4      hu upi )z%
Get arguments of an expression node
r  zget arguments for expression {})rS  r;  )ru  r  rA  rv   r  r6  )r  r  s   & rf   rw  rw  ~  se     ww,,$((##ww&99%9a9%%
?FFtL
MM &s   	
A0c                    V P                    F  pV^ ,          R8X  g   K  V^,          ^ ,          p\        \        V4      4       F?  p\        WE,          \        P
                  4      '       g   K+  \        WE,          W4      WE&   KA  	  V^,          ^,          p\        \        V4      4       F?  p\        We,          \        P
                  4      '       g   K+  \        We,          W4      We&   KA  	  K  	  R# )r   r  N)r  rt   r   r   r   rk  r)   )r   callbackcbdatar  left_lengthsr   right_lengthss   &&&    rf   visit_parfor_pattern_varsr    s    ??1:""1:a=L3|,-lorvv66&6|<D'NLO . $AJqMM3}-.m.77'78H<D(NM$ / #rj   c                     \         P                  ^8  d0   \        RV 4       \        R\        VP	                  4       4      4       V P
                   F  p\        VP                  W4      Vn        \        VP                  \        P                  4      '       d   \        VP                  W4      Vn	        \        VP                  \        P                  4      '       d   \        VP                  W4      Vn        \        VP                  \        P                  4      '       g   K  \        VP                  W4      Vn        K  	  \        RV P                  /W4       \!        WV4       \        V P"                  W4       R# )r   zvisiting parfor vars for:zcbdata: Nr!  )r   rW  rb   r  r  r|  r)   ra  r   r  r   rk  r  r  r(   r}  r  r~  )r   r  r  rd   s   &&& rf   visit_vars_parforr    s    ")62j&01+A,<,<hOaggrvv&&&qwwAAGaffbff%%%affh?AFaffbff%%%affh?AF  F%%&9f7v2
rj   c                ,   Vf   \        4       pVf   \        4       p\        V 4      p\        V4      w  rE\        V4      p\	        VP                  4       4      p\        V 4       VP                  4       pVP                  4       V,          p	VP                  4       P                  4        F  p
WP                  ,          p	K  	  V F^  pW9   d8   VP                  WK,          V,
          4       VP                  W[,          4       K@  VP                  WK,          V,
          4       K`  	  V P                   Uu0 uFE  p\        VP                  \         P"                  4      '       g   K/  VP                  P$                  kKG  	  ppTV P                   Uu0 uFE  p\        VP&                  \         P"                  4      '       g   K/  VP&                  P$                  kKG  	  up,          pTV P                   Uu0 uFE  p\        VP(                  \         P"                  4      '       g   K/  VP(                  P$                  kKG  	  up,          pVP                  W,
          4       V\+        V 4      ,          p\,        P.                  ! WR7      # u upi u upi u upi )zrlist variables written in this parfor by recursively
calling compute_use_defs() on body and combining block defs.
)r+  r,  )rw  r  rJ   rM   r   r  r  rD  
dominatorsr-  r  r  rA  r|  r   r  r   rk  r\  r  r  get_parfor_pattern_varsr   _use_defs_result)r   use_setdef_setr  usesrn  r<  r;  rD  definitely_executedr  r  rd   	loop_varss   &&&           rf   parfor_defsr    s    %%'F!&)JD
!&
)CV[[]#J  !J..*:6		""$yy( %'
 NN4;01NN4;'NN4;01  %///:GGRVV4/   #...*FFBFF3. I #...*FFBFF3. I NN9&'&v..G$$GDDs$   4,J%J,JJ3,J$Jc                    V\        V P                  4      ,          p\        V 4      pV\        P                  ! V4      ,          p\        V 4       R# )zl
Reduction variables for parfors and the reduction variables within
nested parfors must be stack allocated.
N)rw  r  r  r   must_use_allocar  )r   
alloca_setr  s   && rf   _parfor_use_allocar    s>    
 #fnn%%J'F(**622J rj   c                   \        V 4      p\        V4      p\        V4      p\        W2VP                  VP
                  4      p\        W2WTP
                  4      pV P                   Uu0 uFE  p\        VP                  \        P                  4      '       g   K/  VP                  P                  kKG  	  ppTV P                   Uu0 uFE  p\        VP                  \        P                  4      '       g   K/  VP                  P                  kKG  	  up,          pTV P                   Uu0 uFE  p\        VP                  \        P                  4      '       g   K/  VP                  P                  kKG  	  up,          pYP                   Uu0 uF  qwP                  P                  kK  	  up,          p\!        4       p	VP#                  4        F  p
VP$                  V
;;,          V,          uu&   VP$                  V
;;,          V,          uu&   WP$                  V
,          ,          p	VP&                  V
;;,          V,          uu&   VP&                  V
;;,          V,          uu&   WP&                  V
,          ,          p	K  	   ! R R\(        4      p\*        P,                  ! V! V4      4      pVP/                  VP$                  VP&                  4       \1        V 4       W,          # u upi u upi u upi u upi )zvinsert dels in parfor. input: dead variable set right after parfor.
returns the variables for which del was inserted.
c                   &   a  ] tR tRt o R tRtV tR# )'parfor_insert_dels.<locals>.DummyFuncIRi  c                    Wn         R # r^   r  r  s   &&rf   rc  0parfor_insert_dels.<locals>.DummyFuncIR.__init__  s     Krj   r  N)ry   rz   r{   r|   rc  r}   r~   r   s   @rf   DummyFuncIRr    s     	! 	!rj   r  )r  rM   rJ   rK   r+  r,  rL   r|  r   r  r   rk  r\  r  r  ra  rw  r  r   escapingobjectr   PostProcessor_patch_var_delsr  )r   curr_dead_setr  r<  r=  r%  dead_maprd   r  dead_setr  r  	post_procs   &&           rf   parfor_insert_delsr    sC     'F
!&
)Cv&GW^^W^^LH hGH %///:GGRVV4/   #...*FFBFF3. I #...*FFBFF3. I 1B1BC1BA""''1BCCI uH% M1 % I- %%e,,% M1 % I- %%e,, !f ! &&{6':;Ih//1B1BC A Ds*   ',K"K",K'4K'&,K,K,K1c           	         \        V4      w  rE\        VV P                  VV 4      w  rgVP                  4        F  pRp	V	'       g   K  \	        V VVVVV4      p	K  	  R# )za
Reorder statements to maximize parfor fusion. Push all parfors up or down
so they are adjacent.
TN)r2   rG   	arg_namesr  maximize_fusion_inner)
r  r  r  r  r  r  	alias_maparg_aliasesr  order_changeds
   &&&&      rf   r  r  %  sg    
 #6*MJ3!'!(!2!2!(!(	I m1 ' % * ) + ,M !rj   c                 `   R p^ pV\        VP                  4      ^,
          8  d   VP                  V,          pVP                  V^,           ,          p	V'       d   \        WV W#V4      M\        WWW44      p
V
'       d&   WP                  V&   WP                  V^,           &   RpV^,          pK  V# )FT)r   r  _can_reorder_stmts)r  r  r  r  r  r  r  r   r  r  can_reorders   &&&&&&     rf   r  r  =  s    M	A c%**o!
!zz!}JJqsO	 ( *$7*4N-?	Y.E 	 %JJqM"JJqsO M	Qrj   c                     \        4       pV  FH  pWA9   d   VP                  W,          4      pWB9   d   VP                  V4      pVP                  V4       KJ  	  V# r^   )rw  r  r   )the_setr  r  retr   s   &&&  rf   expand_aliasesr  Q  sN    
%C>))IL)C))K(C
  Jrj   c                   \        V \        4      '       EdS   \        V\        4      '       Eg<   \        V\        P                  4      '       Eg   \        V\        P                  4      '       dF   \        VP                  \        4       V4      '       g!   \        \        W!P                  4      '       d   \        V P                  4        Uu0 uF  qfP                  kK  	  upWE4      p\        \        V 4      WE4      p\        VP                  4        Uu0 uF  qfP                  kK  	  upWE4      p	\        \        V4      WE4      p
\        W,          W,          ,          4      ^ 8X  d   R# R# u upi u upi )zk
Check dependencies to determine if a parfor can be reordered in the IR block
with a non-parfor statement.
TF)r   rq  r   r  r  r5   r  rw  r:   is_assert_equivr  rm  r\  get_parfor_writesr0   r   )r  r  r  r  r  r  r  stmt_accessesstmt_writesnext_accessesnext_writess   &&&&&&     rf   r  r  [  s    	4  9f--9bhh//Iryy11!)//35*EE_g??&8H'I8H18H'I'0?$%6t%<%.=&	8K8K8M'N8M18M'N'0?$_Y%?%.=+.0 1456 (J (Os   E,E1c                 &    \        W4      w  r#VR 8H  # )rW   )r8   )r  r  rT  r  s   &&  rf   r  r  x  s    '6I&&rj   c                    \        V \        4      '       g   Q h\        4       pV P                  P	                  4       pV P
                  VR&   VP                  4        Fb  pVP                   FO  pVP                  \        V4      4       \        V\        4      '       g   K5  VP                  \        V4      4       KQ  	  Kd  	  V# r  )r   rq  rw  r~  r  r}  r  r  rA  r0   r  )r   writesr  r  r  s   &    rf   r  r  }  s    ff%%%%UF""$F""F2JJJDMM/$/0$''/56  !
 Mrj   FusionReportc           
     
  a aaa \        RVRV4       RpVP                  VP                  8w  d3   \        R4       Rp\        VP                  VP                  V4      pRV3# \	        VP
                  4      \	        VP
                  4      8w  d   \        R4       RpRpWP                  \	        VP
                  4      3,          p	WP                  \	        VP
                  4      3,          p
\        VP                  VP                  WyV
3,          4      pRV3# \	        VP
                  4      pV 3R	 lpV3R
 lp\        V4       EFY  pVP
                  V,          pVP
                  V,          pV! VP                  VP                  4      '       dI   V! VP                  VP                  4      '       d&   V! VP                  VP                  4      '       d   K  \        RV4       RpVRV! VP                  4      : RV! VP                  4      : RV! VP                  4      : R2,          pVRV! VP                  4      : RV! VP                  4      : RV! VP                  4      : R2,          p\        VP                  VP                  W~,          4      pRV3u # 	  \        VP                  4      Vn        \        WS4      w  ppppV'       g   \        W$SVVV4      ^ ,          pMRpV'       g	   V'       dO   \        R4       Rp\        VP                  VP                  WqP                  VP                  3,          4      pRV3# \        VP                  4      p\!        4       pVP"                  P%                  4        F  pVV,          pK  	  V\'        V4      ,          pV\!        VP(                  4      ,          p\        VP                  4      p\        ^ VP*                  /4      P,                  ^ ,          pVP,                  P%                  4        F  pVV,          pK  	  VP/                  V4      p\	        V4      ^ 8w  d   \1        VP                  P%                  4       VP2                  P4                  VP7                  4       V4      w  poVV3R lV 4       p\9        V4      '       dO   \        R4       Rp\        VP                  VP                  WqP                  VP                  3,          4      pRV3# \;        W4      # )zItry to fuse parfors and return a fused parfor, otherwise return None
    ztry_fuse: trying to fuse 
rK  Nz$try_fuse: parfors different lowerersz!- fusion failed: lowerer mismatchz/try_fuse: parfors number of dimensions mismatchz4- fusion failed: number of loops mismatched, %s, %s.z(parallel loop #%s has a nest of %s loopsc                 >   < W8H  ;'       g    SP                  W4      # r^   )is_equiv)rc   re   r  s   &&rf   r  try_fuse.<locals>.is_equiv  s    v11++A11rj   c                   < \        V \        P                  4      '       g   V # V P                  p RS9   d!   V SR,          9   d   SR,          V ,          pV# V # )z.get original variable name by user if possiblevar_rename_map)r   r   rk  r\  )r  user_varnamer-  s   & rf   get_user_varname"try_fuse.<locals>.get_user_varname  sR    !RVV$$HFFx'A:J1K,K#$45a8Lrj   z/try_fuse: parfor dimension correlation mismatchz7- fusion failed: loop dimension mismatched in axis %s. zslice(r  z) != r  Tz1try_fuse: parfor cross iteration dependency foundzK- fusion failed: cross iteration dependency found between loops #%s and #%sc              3      <"   T F8  p\        SV,          \        P                  4      '       * ;'       g    VS9   x  K:  	  R # 5ir^   )r   r
   r  )r$  rc   p2arraynotindexedr  s   & rf   r%  try_fuse.<locals>.<genexpr>  s9     skrfg*WQZ1F1FGGaa1PaKaakrs
   1AAz)try_fuse: parfor2 depends on parfor1 bodyzT- fusion failed: parallel loop %s has a dependency on the body of parallel loop %s. )dprintr  r  r{  r   r|  rt   r  r  r  r?   r  r  has_cross_iter_deprJ   r~  rw  r,  r  r  r  r}  r+  r7  r8  r  r\  r  r4  fuse_parfors_inner) r  parfor1parfor2r-  r  r  r  r  r  r  r  r  r  r  r   nest1nest2p1_cross_depp1_ipp1_ia	p1_non_iap2_cross_depp1_body_usedefsp1_body_defsrn  
p2_usedefsp2_usesr  overlapr  
unsafe_varr  s    f&&f&f                         @rf   r  r    s    ('4A F '//)561gjj'**c:V| 7#g&8&8"99@AD8JJG$6$6 788JJG$6$6 788gjj'**cHnEV|""#E2 5\""1%""1%ekk22UZZ00UZZ00DaHKC.>u{{.K ,.>uzz.JL LC*:5;;*G ,.>uzz.JL LC!'**gjj#'BF<  -W^^<G,>wQX,Y)L%	)'GUES\]^_`|BC,gjj'** #zz7::&> >@V|
 'w'8'89O5L&&--/ 0%g..L C((L!'"3"34J7#5#567>>qAG!!((*4 + ''0G
7|qB$$&""&&(	  tkrs
z??>?1C!'**gjj$'::wzz*B$BDF<g//rj   c                    V P                   P                  P                  VP                   P                  4       \        VP                  P                  4       4      pVP                  V,          P                  p\        V P                  P                  4       4      p\        V P                  P                  4       4      pV P                  V,          P                  P                  V4       V P                  P                  VP                  4       V P                  P                  V4       \        V P                  4      pVP                  P                  V P                  /p\        V4       FG  pV P                  V,          P                  WqP                  V,          P                  P                  &   KI  	  \        V P                  V4       \!        WR 7      p	\#        V	4      p	\%        W	4       \'        R VP)                  4        4       4      p
\+        V P                  V
4       V P,                  P                  VP,                  4       \.        P0                  '       d0   \3        RP5                  VP6                  V P6                  4      4       RpVP5                  VP6                  V P6                  4      p\9        V P6                  VP6                  V4      pW3# ))entry_labelc              3   8   "   T F  qP                   x  K  	  R # 5ir^   r  r  s   & rf   r%  %fuse_parfors_inner.<locals>.<genexpr>  s     6"5Q&&"5r  z1Parallel for-loop #{} is fused into for-loop #{}.zE- fusion succeeded: parallel for-loop #{} is fused into for-loop #{}.)r}  r  r  r   r~  r  r   rA  r  r   r|  r  r\  rt   ra  r&   r  r1   r  rw  r  remove_duplicate_definitionsr  r   r  rb   r6  r{  r  )r  r  parfor2_first_labelparfor2_first_blockparfor1_first_labelparfor1_last_labelr  
index_dictr   r  namesetr  r  s   &&           rf   r  r    s6    ""7#5#5#:#:; g//4467!++,?@EEg//4467W..3356()..556IJ W../-. ""#E##(('*;*;<J5\@G@R@RA~ 	%%a(77<<=  ""J/  IF6"F)6*"3"3"566G !2!2G<G,,-###AHHjj'**& 	' RC
**WZZ
,C'**gjj#6F?rj   c                R   V P                  4        F  w  r#VP                  p. p\        4       pV Fi  p\        V\        P
                  4      '       d6   VP                  P                  pW9   d   W9   d   KG  VP                  V4       VP                  V4       Kk  	  WSn        K  	  R# )zkRemove duplicated definition for variables in the given nameset, which
is often a result of parfor fusion.
N)
r  r  rw  r   r   r  r  r\  r   rj  )	r  r  r  r  r  rE  definedr  r\  s	   &&       rf   r  r  %  s     zz%D$		**{{''? KK%OOD!  
 ' rj   c                   aaaa V P                    Uu0 uF  qfP                  P                  kK  	  upo\        4       pVf   / pVf   \        4       pVf   \        4       pR oVVVV3R lpV P                  P                  4        EFJ  p	V	P                   EF5  p
\        V
\        P                  \        P                  34      '       d   \        SV
P                  P                  ,          \        P                  P                  4      '       d;   V! V
P                  V
P                  P                  VVVV4      '       d
   RW4V3u u # K  \        V
\        P                   4      '       g   K  \        V
P"                  \        P$                  4      '       dG   V
P"                  P                  S9   d)   SP'                  V
P                  P                  4       EKD  EKG  \        V
P"                  \        P(                  4      '       g   EKt  V
P"                  P*                  pVR9   d   \        SV
P"                  P"                  P                  ,          \        P                  P                  4      '       dO   V! V
P"                  P                  V
P"                  P"                  P                  VVVV4      '       d
   RW4V3u u # EK1  VR8X  dv   \-        V
P"                  P/                  4        Uu. uF8  p\        SVP                  ,          \        P                  P                  4      NK:  	  up4      '       d
   RW4V3u u # V
P"                  P/                  4        Uu. uF  qP                  NK  	  ppSP1                  V4      '       d   VP1                  V4      '       d   EK  VP'                  V
P                  P                  4       EK8  	  EKM  	  RW4V3# u upi u upi u upi )Nc                    \        V \        4      '       d   \        V 4      p RV 9  d   W9   d   R# VP                  V4       R# W9   d   R# VP                  V4       \	        V 4      pWR9  d   WV&   R# W%,          V 8g  # )a
  Returns True if there is a reason to prevent fusion based
on the rules described above.
new_position will be a list or tuple of booleans that
says whether the index in that spot is a parfor index
or not.  array_accessed is the array on which the access
is occurring.TF)r   r  r#  r   r   )new_positionarray_accessedindex_positionsindexed_arraysnon_indexed_arraysnpsizes   &&&&& rf   add_check_position.has_cross_iter_dep.<locals>.add_check_positiono  s     lD)) .L |# / #&&~6
 />*\"( '3F# &,66rj   c                L  < \        V \        P                  4      '       d   \        SV P                  ,          \        P
                  4      '       d   \        \        SV 4      pVeu   Vw  rx\        V U	u. uF)  p	V	P                  S9   ;'       g    V	P                  V9  NK+  	  up	4      '       d*   V U	u. uF  qP                  S9   NK  	  p
p	S! V
VVVV4      # R# R# V P                  S9   d   S! RVVVV4      # V P                  V9   d   R# S! RVVVV4      # R# u up	i u up	i )zLooks at the indices of a getitem or setitem to see if there
is a reason that they would prevent fusion.
Returns True if fusion should be prohibited, False otherwise.
TTF)r   r   rk  r\  r
   r  r:   r9   allr   InternalError)
stmt_indexr  r  r  r  derived_from_indicesfbs_resind_seqr  rc   new_index_positionsr  r  r  r  s   &&&&&&     rf   check_index'has_cross_iter_dep.<locals>.check_index  s[    j"&&))'*//2EOODD 3WjI&!(JG DKMDKq VVw. ; ;&::;DKM N N KR.R'Qvv/@'+.R  22E2@2A2@2D	 F F  $   ??g- .g.<.=.<.@	B B
  __(<<  
 .h.<.=.<.@	B B WM /Ss   5DD5D!Tr  Fr  )r|  ra  r\  rw  r~  r  r  r   r   rU  r~  r  r
   r   r   r   r  r  rk  r   r  ru  r4  rm  
isdisjoint)r   r  r  r  r  r  rd   r  r  r   r  ru  rc   rhs_varsr  r  s   &ff&&&        @@rf   r  r  9  s   ( /5.?.?@.?$$.?@G
 5, ! U07dDJ DJN $$&FFD$R-=-= >??gdkk&6&679M9MNN"4::#';;#3#3#2#1#5#79 9  $_FXXXD")),, djj"&&11zz'1DKK$4$45  2  

BGG44B::%gdjj.>.>.C.C&DennFZFZ[[*4::+;+;+/::+;+;+@+@+:+9+=+? A  A (,_N`'` ` v  %)ZZ%9%9%;!=%; ",GAFFOU^^=Q=Q!R%;!= > >#'J\#\\ 15

0D0D0FG0F10FHG $..x880;;HEE,001A1ABk  'p /3EEEg AH!=
  Hs   O/>OO$c                  F    \         P                  ^8  d   \        V !   R# R# r   )r   rW  rb   )r   s   *rf   r  r  #  s    "q	 #rj   c                8   \        4       pV P                   F  pV^ ,          R8X  g   K  V^,          ^ ,          pV^,          ^,          pW4,            F@  p\        V\        P                  4      '       g   K%  VP                  VP                  4       KB  	  K  	  V# )z9get the variables used in parfor pattern information
    r  )rw  r  r   r   rk  r   r\  )r   outr  r  r  r  s   &     rf   r  r  '  sv     %C??1:""1:a=L#AJqMM!//a((GGAFFO 0	 # Jrj   c                
   \        V P                  4      ;_uu_ 4        \        V P                  4      pRRR4       X^ ,          p/ p	\        V P                  V,          P                  V P
                  VV	V4       \        V	P                  4       4      p
V EF  pW8X  d   K  V P                  V,          P                   F  p\        V\        P                  4      '       d   \        VP                  \        P                  4      '       dW   VP                  P                  R8X  d<   VP                  P                  P                  V P
                  P                  8X  d   K  \        R VP!                  4        4       4      pW,          pV F  pV	P#                  VR4       K  	  K  	  EK  	  V FQ  pW8X  d   K  V P                  V,          pV	P%                  4       p\        VP                  V P
                  VVV4       KS  	  V P                  P%                  4       p\'        VP                  4       4      p\)        VW&4      w  pp\        P*                  ! V\        P,                  ! RR4      4      pVV,          P                  P/                  V4       \1        V4      p\3        V4      p\5        VVVP6                  VP8                  4      p\        VP                  4       4      pVP;                  4        EF  w  pp. pVP<                  P!                  4        Uu0 uF  pVP                  kK  	  ppVP?                  V4       F  w  pp VVV,          ,          pK  	  \A        VP                  4       F  pVV,          p!V! F  pVVV,          ,          pK  	  \        V\        PB                  \        PD                  34      '       dg   \G        V4      P                  V P
                  P                  8X  d9   VPH                  P                  V9  d   VPH                  P                  V9  d   K  TVP!                  4        Uu0 uF  pVP                  kK  	  up,          pVP/                  V4       EK   	  VPK                  4        VVn        EK  	  VP#                  VP                  4       VV,          P                  P#                  4         \M        WW4WV4       \O        V PP                  P                  4      ^ 8H  p"V P                  PS                  4        F"  pV"\O        VP                  4      ^ 8H  ,          p"K$  	  V"'       d   R# V #   + '       g   i     EL; iu upi u upi )z6remove dead code inside parfor including get/sets
    NrR  c              3   8   "   T F  qP                   x  K  	  R # 5ir^   r  )r$  r  s   & rf   r%  %remove_dead_parfor.<locals>.<genexpr>S  s     <+;a66+;r  parfors_dummyr!  )*rs  r~  r/   _update_parfor_get_setitemsr  r  rw  r  r   r   r  r  r  ru  r   r\  rm  r  r  r   _add_liveness_return_blockr  Locrj  rM   rJ   rK   r+  r,  r  
terminator
successorsr8  r~  rU  rr  r  r^  remove_dead_parfor_recursiver   r}  r  )#r   liveslives_n_aliasesr  r  r  r  rQ  rx  first_block_saved_values
saved_arrsrd   r  varnamesrm_arrsr   r  saved_valuesr  r;  return_labelr  jumpr<  r=  r%  	alias_setr  rE  r  in_livesout_blk_dataalias_livesis_emptys#   &&&&&&&                            rf   remove_dead_parforr  5  s0    
#6#3#3	4	4 !1!12 
5 )K!%**) 	
 -2245J$$Q',,D4++
4::rww0O0O

2

((--1A1A1F1FF<4>>+;<<H+G(,,Q5  -     #/446#EJJ0@0@)(4o	G  ""$FV[[]#J8ZL)77<!<=D
:""4(
!&
)Cv&GVW^^W^^LHINN$%Iu$)$4$4$>$>$@A$@qAFF$@A!nnU3NGU))H 4UZZ(D"Y.K IaL( !4""2"2BJJ!?@@d#((F,<,<,A,AA  0  3)9:)9A)9::HOOD! ) 	
' '* KK	
:! !{wA 6$$))*a/H!!((*C

Oq(( +MA 
5	4	4r B ;s   UU U!
U	c                X   V  EF"  p\        V\        P                  \        P                  34      '       d   \	        V4      P
                  VP
                  8X  d   VP                  P
                  V9  dd   VP                  VP                  P
                  . 4       F  pVP                  VR4       K  	  VP                  W5P                  P
                  &   K  \        V\        P                  4      '       d   \        VP                  \        P                  4      '       d   VP                  pVP                  R8X  d~   \        VP                  \        P                  4      '       dT   VP                  P
                  VP
                  8X  d/   VP                  VP                  P
                  V4      Vn	        EK  VP                  4        FT  pVP                  VP
                  R4       VP                  VP
                  . 4       F  pVP                  VR4       K  	  KV  	  EK%  	  R# )zK
replace getitems of a previously set array in a block of parfor loop body
NrR  )r   r   r~  rU  rr  r\  r  r  r  r  r  r  ru  r   rk  rm  )	
block_bodyr  r  r  r  r  wrA  r  s	   &&&&&    rf   r  r    ss   
 tb..

;<<$$$	6KKE)]]4;;#3#3R8  D) 9 .2ZZL))*dBII&&:djj"''+J+J**Cvv"z#))RVV'D'D99>>Y^^3!-!1!1#))..#!FDJ !AQVVT*]]1662.  D) / ") 4 rj   c           	        V P                   P                  4       p\        VP                  4       4      pV^ 8  g   Q h\	        VP                  4       4      p \        WaV4      w  rWh,          P                  p\        P                  ! V\        R4      \        P                  ! RR4      4      p\        P                  W\P                  &   \        P                  ! WV	\        P                  ! RR4      4      pWh,          P                  P!                  V4       V P"                  V^ &   V^ ,          P                  P!                  \        P$                  ! V\        P                  ! RR4      4      4       \'        WbWEW24       VP)                  V
P                  4       V^ ,          P                  P)                  4        Wh,          P                  P)                  4        R# )zIcreate a dummy function from parfor and call remove dead recursively
    z$branchcondr  Nr!  )r~  r  r   r  r   r  r  r   rk  r   r	  r
   booleanr\  r  r  rj  r}  r  r*   r  )r   r  r  r  r  r  r  rO  r;  r  r  r  
branchcondbranchs   &&&&&&        rf   r  r    s]    ""$F6;;=)aV[[]#J
 9PL $$E}];RVVOUW=XYJ$}}GOOYYz\266/[]C^_F
""6* !!F1I
1INN"''"2BFF?B4OPQ WyNKK	
1INN
!
rj   c                    \        V P                  4       4      pV^,           pW,          P                  pW,          P                  p\        P
                  ! We4      W&   \        P                  ! V\        R4      V4      p\        P                  P                  \        P                  ^4      W'P                  &   V Uu. uF  p\        P                  ! WhV4      NK  	  p	p\        P                  P                  W4      p
W,          P                  P!                  \        P"                  ! WV4      4       W,          P                  P!                  \        P$                  ! Wu4      4       WG3# u upi )r   z
$tuple_var)r   r  rv  r  r   rN  rk  r   r
   r  r  r  r\  r  r  r  rj  r  Return)r  r  r  r;  r  rv  r  r  r  r"  r  s   &&&        rf   r  r    s
   V[[]#J>L


 
 C$$E88E/F umL93?I#..77QGNN0561#&I6$$Y4J
$$RYYzc%JK
$$RYYy%>?""	 7s   > E-c                 b    \        V 4      p\        P                  ! WaW#WE4       \        V 4       R # r^   )r  r   rG   r  )r   rv   r  r  r  r  r  s   &&&&&& rf   find_potential_aliases_parforr'    s-    'F##g	@ 
rj   c           
     ~   ^ pV P                  4        EF  pVP                   EF  p\        V\        4      '       g   K  V^,          pTpVP                  \        VP                  P                  4       4      ,          pVP                  p\        P                  ! RR4      p\        P                  ! V\        R4      V4      pVP                  P                  \        P                  ! \        P                  ! ^ V4      W4      4       VP                  P                  \        P                  ! W4      4       \!        VP                  4      Vn        VP                  \        VP                  P                  4       4      ,          pVP                  P#                  4        \%        VP                  4       EK  	  EK  	  V# )z%simplify CFG of body loops in parforsr  $constr!  )r  r  r   rq  r~  r   r  r  r   r	  rk  r   rj  r  r	  r%  r4   r  r  )	r  r  r  r  r   
last_blockr  rv  consts	   &        rf   r  r    s8   IJJD$''Q	 $--c&2B2B2G2G2I.JK
"((ff_b1umH&=sC&&ryy!S1A5'NO&&ryy'<=#/0@0@#A #--c&2B2B2G2G2I.JK
##%()9)9:!  !$ rj   c                P   V P                   P                  4       pVf   \        VP                  4       4      pV^ 8  g   Q hV P                  V^ &   V^ ,          P
                  P                  \        P                  ! W^ ,          P                  4      4       VP                  4        F{  p\        VP
                  4      ^ 8X  g&   VP
                  R,          P                  '       d   KB  VP
                  P                  \        P                  ! WP                  4      4       K}  	  V# )z5wrap parfor blocks for analysis/optimization like CFGr!  )r~  r  r   r  r}  r  rj  r   r  rv  r  r   is_terminator)r   r  r  r  s   &&  rf   r  r    s    ""$F&++-(?? !!F1I
1INN"''+ay}}=>uzz?a

2(D(D(DJJbggk99=> ! Mrj   c                   Ve1   \        VP                  4       4      pVP                  V4       Wn        \        V P                  P                  4       4      p\	        V P
                  P                  R,          \        P                  4      '       g   Q hV P
                  P                  P                  4        V P                  P                  4        Ft  p\	        VP                  R,          \        P                  4      '       g   K6  VP                  R,          P                  V8X  g   KZ  VP                  P                  4        Kv  	  R# )zV
unwrap parfor blocks after analysis/optimization.
Allows changes to the parfor loop.
Nr!  )r   r  r  r~  r   r}  r  r   r  r  r  )r   r  init_block_labelrR  r  s   &&   rf   r  r  .  s    
 v{{}-

#$! 6++0023f'',,R0"''::::   !!((*uzz"~rww//JJrN!!%55JJNN	 +
 rj   c                   \        V 4      p\        W!4      w  r4\        W!4      w  rV\        V 4       V^ ,          pV P                  P                  4        F5  pYuV,           U	U
u0 uF  w  rV	kK	  	  up
p	,          pWvV,          ,          pK7  	  \        V P                  P                  4       4      pWK,          V^ ,          ,          p\        P                  ^8  d   \        RVRV4       W3# u up
p	i )z&find copies generated/killed by parforzcopy propagate parfor gens:kill_set)
r  r+   r,   r  r~  r  r   r   rW  rb   )r   r  r  in_copies_parforout_copies_parforin_gen_copiesin_extra_killr1  r  rd   rG  r;  genss   &&           rf   get_copies_parforr7  J  s    'F*8*I'#3F#D M  QH!!&&(#78#741Q#788%(( )
 V%%**,-J(=+;;D"+T:xH> 9s   #C,
c                (   \        V P                  4       F7  w  rgV^ ,          R8X  g   K  R\        V^,          V4      3V P                  V&   K9  	  V P                   FT  p\        VP                  V4      Vn        \        VP
                  V4      Vn        \        VP                  V4      Vn        KV  	  \        V 4      p	. p
VP                  4        FG  w  rV
P                  \        P                  ! WV,          \        P                  ! RR4      4      4       KI  	  W^ ,          P                  ,           V	^ ,          n        \        W4      w  r\        WW#WE4       \!        V 4       V	^ ,          P                  \#        V
4      R V	^ ,          n        R# )z*apply copy propagate recursively in parforr  dummyNr!  )rQ  r  r'   r|  r  r  r  r  r  rj  r   r  r	  r  r+   r-   r  r   )r   var_dictname_var_tabler  r  save_copiesr   r  rd   r  assign_listlhs_namerA  r2  r3  s   &&&&&&         rf   apply_copies_parforr?  f  s@     0
1:""+"71:x8":FOOA 1 $QWWh7#AFFH5#AFFH5 
  'FK!)299S*B%'VVGR%8: 	; * !!9>>1F1IN*8*I'>"1 AY^^C$4$56F1IN
rj   c                  aaa V P                  4        EFH  p. p\        4       o/ pVP                   F  pVVV3R lp	V'       gy   \        V\        4      '       dc   VP
                  P                   F  p
V	! V
4       K  	  VP                  P                  4       p\        VSSVRR7       VP                  V4       K  V	! V4       VP                  4        F#  pV\        VP                  SSSV4      ,          pK%  	  VP                  V4       K  	  Wen        \        V4      ^ 8  g   EK  VP                  4        F  w  rW=,          W<&   K  	  ^ V/p\        W4       EKK  	  R# )zpush call variables to right before their call site.
assuming one global/getattr is created for each call site and control flow
doesn't change it.
c                 B  < \        V \        P                  4      '       d   V P                  pV P                  p\        V\        P
                  4      '       d-   V SVP                  &   SP                  VP                  4       R# \        V\        P                  4      '       dx   VP                  R 8X  de   VP                  P                  S9   g   VP                  P                  S9   d-   V SVP                  &   SP                  VP                  4       R# R# R# R# R# )r  N)
r   r   r  r  r  r  r\  r   r  ru  )r  rA  r  
block_defssaved_getattrssaved_globalss   &  rf   process_assign&push_call_vars.<locals>.process_assign  s    dBII..**C++C"3		2226chh/"sxx0#C11cff	6IIINNm;#&99>>^#C7;N3884&NN3884 $D 7J1 /rj   T)nestedN)r  rw  r  r   rq  r}  r~  r  r  rj  rm  _get_saved_call_nodesr\  r   r  rH   )r  rD  rC  r  rG  r  rE  rename_dictr  rE  r   pblocksr  r  temp_blocksrB  s   &ff&&          @rf   r  r    s2   
  U
 JJD5 jv66--A"1% ...--/w~wW[\%t$^^%1!&&-2@*k[ [ & OOD!5 6 
{a#))+$Z
 , e*Kk7] !` rj   c                   . pW9  dl   W9   g   W9   d`   R pW9   d   V! W,          RWSV4       Rp K0  W9   g   K8  V! W ,          RWSV4       W ,          P                   P                   P                  p Kq  VP                  4        V# )aG  Implement the copying of globals or getattrs for the purposes noted in
push_call_vars.  We make a new var and assign to it a copy of the
global or getattr.  We remember this new assignment node and add an
entry in the renaming dictionary so that for this block the original
var name is replaced by the new var name we created.
c                     \        V \        P                  4      '       g   Q h\        P                  ! V P                  P
                  \        V4      V P                  P                  4      p\        P                  ! \        P                  ! V P                  4      VV P                  4      pVP                  V4       VP                  V P                  P                  4       VP                  P                  W@P                  P                  &   R # r^   )r   r   r  rk  r  r  r   rv  r  r  r  rj  r   r\  )objvar_baserT  rB  rI  renamed_varrenamed_assigns   &&&&&  rf   rename_global_or_getattr7_get_saved_call_nodes.<locals>.rename_global_or_getattr  s    c299--.-&&!1!1!.x!8!$1K  YYt}}SYY'?'2'*ww0N LL(NN3::??++9+@+@+E+EK

(rj   z$push_global_to_block_PA_DONEz$push_getattr_to_block)r  r\  r^  )fnamerD  rC  rB  rI  rT  rR  s   &&&&&  rf   rH  rH    s     E"(>+0+B
	F !$]%9;R%*EE$$^%:<T%*E")//55::E	MMOLrj   c           
        \        V \        4      '       d   V ^ ,          p\        V\        4      '       g"   \        VR4      '       d   VP                  pMRpV ^,          p\        V4      ^8X  d#   RP                  V\        V^ ,          4      4      # RV,           R,           pRP                  TP                  V Uu. uF  p\        V4      NK  	  up4      4      # \        V \        P                  P                  P                  4      '       d/   V P                  pVP                  R4      '       d
   RV,          # V# \        V \        P                  P                  P                  4      '       d   \!        V P"                  4      # R# u upi )zMExtract operators from arrayexpr to represent it abstractly as a string.
    ry   r  z({}({}))r5  z({})$z'%s' (temporary variable))r   r#  r  hasattrry   r   r6  r  r7  r   r  r   rk  r\  r  r	  r  r  )r  oprrv   rc   r\  s   &    rf   r  r    s!    )U##l#s##sJ''ll|t9>$$S.a*ABB)c/C==t*Mt!N1,=t*M!NOO	Iuzz}}00	1	1~~??30477K	Iuzz}}22	3	3IOO$$ +Ns   <Fc                ~    . pV P                    F  pVP                  W$,          4       K  	  \        V4      Vn        R# )zpostproc updates generator_info with live variables after transformations
but generator variables have types in return_type that are updated here.
N)
state_varsrj  r#  state_types)r  r   r  new_state_typesr  s   &&&  rf   r  r    s9     O&&wz* '#O4K
rj   c                 h    Vf   / pVf   / p\        V 4      p\        W1V4      w  r\        V 4       W3# r^   )r  r2   r  )r   r  reverse_call_tabler  s   &&& rf   get_parfor_call_tabler`    sG    
!'F%3F4F&H"J ))rj   c                 j    Vf   / p\        V 4      p\        P                  ! W!4      p\        V 4       V# r^   )r  r   get_tuple_tabler  )r   tuple_tabler  s   && rf   get_parfor_tuple_tablerd    s5    'F**6?K rj   c                 z    Vf   \        4       p\        V 4      p\        P                  ! W!4      p\	        V 4       V# r^   )rw  r  r   get_array_accessesr  )r   accessesr  s   && rf   get_parfor_array_accessesrh  #  s6    5'F**6<H Orj   c                     \        V 4      p\        W!4      pW!,          V^ &   VP                  V4       \        W4       R# r)  )r  r7   r  r  )r   r  r  s   && rf   parfor_add_offset_to_labelsrj  0  s8    'F!&1FF1I
JJv(
rj   c                 ^    \        V 4      p\        P                  ! V4      p\        V 4       V# r^   )r  r   r  r  )r   r  	max_labels   &  rf   parfor_find_max_labelrm  <  s*    'F''/I rj   c                 4   VP                   p\        V 4      pV P                   Uu. uF  qDP                  NK  	  pp\	        VP                  4       4      pW6,          P                  pV Uu. uF1  p\        P                  ! \        P                  ! ^VRR7      W4      NK3  	  p	pW6,          P                  p
WV,          P                  ,           W6,          n
        W1n         VP                  4        W!n         WV,          n
        \        V 4       R# u upi u upi )r   F)rv  use_literal_typeN)r  r  r|  ra  r   r  rv  r   r  r	  r  build_constraintr  )r   typeinferersave_blocksr  rd   r[  first_blockrv  r  index_assignssave_first_block_bodys   &&         rf   parfor_typeinferrv  E  s    $$K'F,2,=,=>,=q"",=J> fkkm$K


!
!C^hi^hYZRYYrxxsUKQT^hMi"/44,k/B/G/GGF  "$4;  ? js   D+7Dc                    Vf   \        \        4      p\        V P                  V4       \        ^ V P                  /V4       V# )z)get variable definition table for parfors)r   r  r?   r~  r}  )r   definitionss   &&rf   build_parfor_definitionsry  Z  s?    !$' f&&4q&++,k:rj   c           	   #    "   \        V P                  4       4      pW,          P                  p\        P                  ! V\        R4      \        P                  ! RR4      4      pW,          P                  P                  \        P                  ! V\        P                  ! RR4      4      4       Rx  W,          P                  P                  4        R# 5i)zLadds dummy return to last block of parfor loop body for CFG computation
    r)  r  Nr!  )r   r  r  r   rk  r   r	  r  rj  r%  r  )r~  r;  r  r+  s   &   rf   rs  rs  g  s     
 Y^^%&J!''EFF5-1266/23NOE%%
		%457	""$s   CCc                   &   a  ] tR tRt o R tRtV tR# )ReduceInferiu  c                    V'       d   Q h\        V4      ^8w  d   \        P                  ! R4      h\        V^,          \        P
                  4      '       g   Q h\        V^,          P                  .VO5!  # )r  zlen(args) != 3)r   r   NumbaAssertionErrorr   r
   r   rP   r   )rb  rv   r  s   &&&rf   genericReduceInfer.genericw  sY    wt9>,,-=>>$q'5;;////a...rj   ri   N)ry   rz   r{   r|   r  r}   r~   r   s   @rf   r|  r|  u  s     / /rj   r|  c                 b    \         P                  '       d   Rp \        P                  ! V 4      hR# )zKCheck if the platform supports parallel=True and raise if it does not.
    zDThe 'parallel' target is not currently supported on 32 bit hardware.N)r   	IS_32BITSr   r  )r  s    rf   ensure_parallel_supportr    s-     ,,S11 rj   )argminr  )argmaxr  )r   r  )r   r  )aminr  )amaxr  )sumr  )prodr  )r   r  )r  r  )stdr  )dotr  )r  r  )r;  r  r  rA  )NNNNNr!  r  )firstsecondmessage)NNNr^   (  ro  r
   pytypesr  r(  r  textwrapr  rN  r  	functoolsr   collectionsr   r   r   
contextlibr   rj  dataclassesr   r1  llvmliter   lirnumba.core.imputilsr	   numba.core.irr   rl  r   r   r   r   r   r   r   r   r   r   r   numba.np.npdatetime_helpersr   r   numba.np.numpy_supportr   r   numba.core.typing.templatesr   r   numba.stencils.stencilparforr   numba.core.extendingr   r   numba.core.ir_utilsr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   numba.core.analysisrJ   rK   rL   rM   numba.core.controlflowrN   numba.core.typingrO   rP   numba.core.types.functionsrQ   numba.parfors.array_analysisrR   rS   rT   rU   rV   rW   rX   r  r   numba.parforsrY   numba.cpython.builtinsnumba.stencilsrZ   r  TextWrapperr`   rg   r  rk   rp   r  rr   r   r   r   r   r   r   r   r   r   r   r   r  r  r7  rD  r  rP  r  r   r   r   r   r[  r  r_  r  Stmtrq  r  array_analysis_extensionsr  r  r
  r'  r0  rr  rt  rQ  rP  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r/  r1  r8  r=  r>  r  rE  rF  rh  rD  rw  r  r  visit_vars_extensionsr  ir_extension_usedefsr  ir_extension_use_allocar  ir_extension_insert_delsr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  remove_dead_extensionsr  r  r'  alias_analysis_extensionsr  r  r  r7  copy_propagate_extensionsr?  apply_copy_propagate_extensionsr  rH  r  r  r`  call_table_extensionsrd  tuple_table_extensionsrh  array_accesses_extensionsrj  add_offset_to_labels_extensionsrm  find_max_label_extensionsrv  typeinfer_extensionsry  build_defs_extensionsrs  r|  r  ri   rj   rf   <module>r     s`     	      < < %  &   2  r r r r " J : F 4 @, , , , , , , , , , , ,\H H * 0 /> > *    (  ( 
""UK0 # 
 
+ 
f  D@			"
',..8
4G4 4GlI0 99''(('))'''-1 "(   > >
 > >
 G G G G .66*:; ,'7H,'7H|M;?|M;?]K@]K@" v :K(RWWbgg K(\  4C ( ( 0N Nbc"F c"J% %<sW sWlA~W ~WB
:!Z ZzS$ S$l`; `;F.b6E! 6Erf%' f%RPE, PEf%P	-nb2JZS@(D%N F#04(V( $ )P'dH&68l\NN& *;  v &1Eh )4  f %
! ,>     (+ \ -? ! !& )0(:'

 .*HIl0^(V(gFTdLB +=   '(T#( .K " "6 *0 82 .? " "6 *> 4G ( ( 05pB8	* *?  v & +A   ' .G " "6 * 4O ( ( 0 .C " "6 *!& *:	  v &	 *B  v &% % f/" / /2rj   