Ë
    ÏGìjÊ  ã                   ó   — d dl ­ d dl mZ d dlmZ 	 ddl­ d dlmZmZ	m
Z dd	lmZmZmZmZmZ  ej*                  ed
¬«       G d„ de«      «       Zdeeeeeef      deee   ee   f   fd„Z ej*                  ed
¬«       G d„ de«      «       Z ej*                  ed
¬«       G d„ de«      «       Z ej*                  ed
¬«       G d„ de«      «       Z	 	 	 ddddœdeee      fd„Zy# e$ rZ ed«      e‚dZ[ww xY w)é   )Ú*)Ú_Dialect)Úconstanté   )Úget_op_result_or_valueÚget_op_results_or_valuesÚ_cextz+Error loading imports from extension moduleNé    )ÚListÚOptionalÚSequenceÚTupleÚUnionT)Úreplacec            	       ó|   ‡ — e Zd ZdZ	 d	dddœdeeeeee	   f      fˆ fd„Z
ed„ «       Zed„ «       Zed„ «       Zˆ xZS )
ÚForOpz(Specialization for the SCF for op class.N©ÚlocÚipÚ	iter_argsc          	      ó  •— |€g }t        |«      }|D �cg c]  }|j                  ‘Œ }}t        ‰	| �  |||||||¬«        | j                  d   j
                  j                  | j                  d   j                  g|¢­Ž  yc c}w )af  Creates an SCF `for` operation.

        - `lower_bound` is the value to use as lower bound of the loop.
        - `upper_bound` is the value to use as upper bound of the loop.
        - `step` is the value to use as loop step.
        - `iter_args` is a list of additional loop-carried arguments or an operation
          producing them as results.
        Nr   r
   )Ú_get_op_results_or_valuesÚtypeÚsuperÚ__init__ÚregionsÚblocksÚappendÚoperands)
ÚselfÚlower_boundÚupper_boundÚstepr   r   r   ÚargÚresultsÚ	__class__s
            €ú\C:\Users\Stabi\Downloads\virtual-tryon(1)\venv\Lib\site-packages\jaxlib/mlir/dialects/scf.pyr   zForOp.__init__   sŒ   ø€ ð$ ÐØˆIÜ-¨iÓ8ˆ	á'0Ó1¡y �3—8“8 yˆÐ1Ü‰ÑØ�[ +¨t°YÀCÈBð 	ô 	
ð 	&ˆ�‰�Q‰×Ñ×%Ñ% d§m¡m°AÑ&6×&;Ñ&;ÐF¸gÔFùò	 2s   •Bc                 ó:   — | j                   d   j                  d   S ©z%Returns the body (block) of the loop.r
   ©r   r   ©r    s    r'   Úbodyz
ForOp.body7   ó   € ð �|‰|˜A‰×%Ñ% aÑ(Ð(ó    c                 ó4   — | j                   j                  d   S )z+Returns the induction variable of the loop.r
   ©r,   Ú	argumentsr+   s    r'   Úinduction_variablezForOp.induction_variable<   s   € ð �y‰y×"Ñ" 1Ñ%Ð%r.   c                 ó4   — | j                   j                  dd S )ú‚Returns the loop-carried arguments usable within the loop.

        To obtain the loop-carried operands, use `iter_args`.
        r   Nr0   r+   s    r'   Úinner_iter_argszForOp.inner_iter_argsA   s   € ð �y‰y×"Ñ" 1 2Ð&Ð&r.   ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú	OperationÚOpViewr   ÚValuer   Úpropertyr,   r2   r5   Ú__classcell__©r&   s   @r'   r   r      s}   ø„ á2ð JNðGð ØòGð
 ˜E )¨V°X¸e±_Ð"DÑEÑFõGð8 ñ)ó ð)ð ñ&ó ð&ð ñ'ó ô'r.   r   ÚofrsÚreturnc                 óø   — g }g }| D ]n  }t        |t        t        t        f«      r@t	        |«      }|j                  |«       |j                  t        j                  «       «       Œ^|j                  |«       Œp ||fS )z"`mlir::dispatchIndexOpFoldResults`)Ú
isinstancer;   r<   r=   Ú_get_op_result_or_valuer   Ú
ShapedTypeÚget_dynamic_size)rA   Údynamic_valsÚstatic_valsÚofrÚvals        r'   Ú_dispatch_index_op_fold_resultsrL   J   ss   € ð €LØ€KÛˆÜ�cœI¤v¬uÐ5Ô6Ü)¨#Ó.ˆCØ×Ñ Ô$Ø×Ñœz×:Ñ:Ó<Õ=à×Ñ˜sÕ#ð ð ˜Ð$Ð$r.   c                   óö   ‡ — e Zd ZdZ	 dddddœdeeeeee	f      deeeeee	f      deeee	f      de
eeeee   f      fˆ fd„Zed	efd
„«       Zed	e	fd„«       Zed	efd„«       Zed	efd„«       Zd	efd„Zˆ xZS )ÚForallOpz+Specialization for the SCF forall op class.N©Úmappingr   r   Úlower_boundsÚupper_boundsÚstepsÚshared_outsc                óî  •— t        |«      t        |«      cxk(  rt        |«      k(  sJ d«       ‚ J d«       ‚|€g }t        |«      }t        |«      \  }}	t        |«      \  }
}t        |«      \  }}|D �cg c]  }|j                  ‘Œ }}t        ‰| �  |||
||	||||||¬«       t        |	«      }t        j                  «       g|z  } | j                  d   j                  j                  g |¢|¢­Ž  yc c}w )aw  Creates an SCF `forall` operation.

        - `lower_bounds` are the values to use as lower bounds of the loop.
        - `upper_bounds` are the values to use as upper bounds of the loop.
        - `steps` are the values to use as loop steps.
        - `shared_outs` is a list of additional loop-carried arguments or an operation
          producing them as results.
        z;Mismatch in length of lower bounds, upper bounds, and stepsNrO   r
   )Úlenr   rL   r   r   r   Ú	IndexTypeÚgetr   r   r   )r    rQ   rR   rS   rT   rP   r   r   Údynamic_lbsÚ
static_lbsÚdynamic_ubsÚ
static_ubsÚdynamic_stepsÚstatic_stepsr$   r%   ÚrankÚiv_typesr&   s                     €r'   r   zForallOp.__init__^   s  ø€ ô( �Ó¤ \Ó!2Ô@´c¸%³jÒ@ð	IàHó	IÙ@ð	IàHó	IØ@àÐØˆKÜ/°Ó<ˆä"AÀ,Ó"OÑˆ�ZÜ"AÀ,Ó"OÑˆ�ZÜ&EÀeÓ&LÑ#ˆ�|á'2Ó3¡{ �3—8“8 {ˆÐ3Ü‰ÑØØØØØØØØØØØð 	ô 	
ô �:‹ˆÜ—M‘M“OÐ$ tÑ+ˆØ%ˆ�‰�Q‰×Ñ×%Ñ%Ð: xÐ:°'Ô:ùò! 4s   Á4C2rB   c                 ó:   — | j                   d   j                  d   S r)   r*   r+   s    r'   r,   zForallOp.bodyŽ   r-   r.   c                 ó,   — t        | j                  «      S )z7Returns the number of induction variables the loop has.)rV   ÚstaticLowerBoundr+   s    r'   r_   zForallOp.rank“   s   € ô �4×(Ñ(Ó)Ð)r.   c                 óH   — | j                   j                  d| j                   S )z7Returns the induction variables usable within the loop.N©r,   r1   r_   r+   s    r'   Úinduction_variableszForallOp.induction_variables˜   s   € ð �y‰y×"Ñ" ; T§Y¡YÐ/Ð/r.   c                 óH   — | j                   j                  | j                  d S )r4   Nre   r+   s    r'   r5   zForallOp.inner_iter_args�   s   € ð �y‰y×"Ñ" 4§9¡9 ;Ð/Ð/r.   c                 ó  — | j                   j                  }t        | j                   «      5  |st        «       cddd«       S |t	        |«      dz
     }t        |t        «      r|n	t        «       cddd«       S # 1 sw Y   yxY w)za
        Returns the loop terminator if it exists.
        Otherwise, creates a new one.
        Nr   )r,   Ú
operationsÚInsertionPointÚInParallelOprV   rD   )r    ÚopsÚlasts      r'   Ú
terminatorzForallOp.terminator¥   s_   € ð
 �i‰i×"Ñ"ˆÜ˜DŸI™IÕ&ÙÜ#“~÷ 'Ñ&ð ”s˜3“x !‘|Ñ$ˆDÜ% d¬LÔ9‘4¼|»~÷	 '×&Ò&ús   ¬A8Á,A8Á8Br6   )r7   r8   r9   r:   r   r   r;   r<   r=   Úintr   r   r>   ÚBlockr,   r_   ÚBlockArgumentListrf   r5   rk   rn   r?   r@   s   @r'   rN   rN   Z   s  ø„ á5ð LPð.;ð ØØò.;à˜u Y°¸¸sÐ%BÑCÑDð.;ð ˜u Y°¸¸sÐ%BÑCÑDð.;ð ˜˜e S˜jÑ)Ñ*ð	.;ð
 ˜e I¨v°xÀ±Ð$FÑGÑHõ.;ð` ð)�eò )ó ð)ð ð*�cò *ó ð*ð ð0Ð%6ò 0ó ð0ð ð0Ð!2ò 0ó ð0ð
N˜L÷ 
Nr.   rN   c                   ó:   ‡ — e Zd ZdZdˆ fd„	Zedefd„«       Zˆ xZS )rk   z6Specialization of the SCF forall.in_parallel op class.c                 óp   •— t         ‰| �  ||¬«       | j                  j                  j	                  «        y )Nr   )r   r   Úregionr   r   )r    r   r   r&   s      €r'   r   zInParallelOp.__init__¶   s+   ø€ Ü‰Ñ˜S RÐÔ(Ø�‰×Ñ×!Ñ!Õ#r.   rB   c                 ó4   — | j                   j                  d   S )Nr
   )rt   r   r+   s    r'   ÚblockzInParallelOp.blockº   s   € à�{‰{×!Ñ! !Ñ$Ð$r.   )NN)	r7   r8   r9   r:   r   r>   rp   rv   r?   r@   s   @r'   rk   rk   ²   s&   ø„ á@õ$ð ð%�uò %ó ô%r.   rk   c                   óN   ‡ — e Zd ZdZdddddœˆ fd„Zed„ «       Zed„ «       Zˆ xZS )	ÚIfOpz'Specialization for the SCF if op class.NF)ÚhasElser   r   c                ó  •— |€g }g }|j                  |«       g }|j                  |«       t        ‰| �  ||||¬«        | j                  d   j
                  j                   g Ž  |r' | j                  d   j
                  j                   g Ž  yy)zØCreates an SCF `if` operation.

        - `cond` is a MLIR value of 'i1' type to determine which regions of code will be executed.
        - `hasElse` determines whether the if operation has the else branch.
        Nr   r
   r   )r   Úextendr   r   r   r   )	r    ÚcondÚresults_ry   r   r   r   r%   r&   s	           €r'   r   zIfOp.__init__Ã   sŒ   ø€ ð ÐØˆHØˆØ�‰˜ÔØˆØ�‰�xÔ Ü‰Ñ˜ $¨C°BÐÔ7Ø%ˆ�‰�Q‰×Ñ×%Ñ% rÑ*ÙØ)ˆD�L‰L˜‰O×"Ñ"×)Ñ)¨2Ò.ð r.   c                 ó:   — | j                   d   j                  d   S )z+Returns the then block of the if operation.r
   r*   r+   s    r'   Ú
then_blockzIfOp.then_blockÔ   r-   r.   c                 ó:   — | j                   d   j                  d   S )z+Returns the else block of the if operation.r   r
   r*   r+   s    r'   Ú
else_blockzIfOp.else_blockÙ   r-   r.   r6   )	r7   r8   r9   r:   r   r>   r   r�   r?   r@   s   @r'   rx   rx   ¿   s>   ø„ á1ð/°uÀ$È4ö /ð" ñ)ó ð)ð ñ)ó ô)r.   rx   r   r   c             #   óN  K  — |€d}|€| }d} | ||g}t        |«      D ]X  \  }}t        |t        «      rt        t        j                  «       |«      }nt        |t        «      rt        d|›d�«      ‚|||<   ŒZ |\  } }}t        | |||||¬«      }	|	j                  }
t        |	j                  «      }t        |	j                  «      5  t        |«      dkD  r|
||	j                  f–— n*t        |«      dk(  r|
|d   |	j                  d   f–— n|
–— d d d «       y # 1 sw Y   y xY w­w)Nr   r
   zp=z must be int.r   )Ú	enumeraterD   ro   r   rW   rX   ÚfloatÚ
ValueErrorr   r2   Útupler5   rj   r,   rV   r%   )ÚstartÚstopr#   r   r   r   ÚparamsÚiÚpÚfor_opÚivs              r'   Úfor_rŽ   ß   s  è ø€ ð €|ØˆØ€|ØˆØˆØ�T˜4Ð €FÜ˜&Ö!‰ˆˆ1Ü�aœÔÜœŸ™›¨!Ó,‰AÜ˜œ5Ô!Ü  ˜t =Ð1Ó2Ð2ØˆˆqŠ	ð "ð Ñ€Eˆ4�ä�5˜$  i°S¸RÔ@€FØ	×	"Ñ	"€BÜ�f×,Ñ,Ó-€IÜ	˜Ÿ™Õ	$Üˆy‹>˜AÒØ�i §¡Ð/Ó/Ü�‹^˜qÒ Ø�i ‘l F§N¡N°1Ñ$5Ð5Ó5àŠH÷ 
%×	$Ñ	$üs   ‚CD%ÃADÄ	D%ÄD"ÄD%)NNN) Ú_scf_ops_genr   Úarithr   ÚirÚ_ods_commonr   rE   r   r   r	   Ú	_ods_cextÚImportErrorÚeÚRuntimeErrorÚtypingr   r   r   r   r   Úregister_operationr   r;   r<   r=   ro   rL   rN   rk   rx   rŽ   © r.   r'   Ú<module>rš      si  ðô Ý "Ý ðMÜ÷ñ ÷ :Õ 9ð €×Ñ˜h°Ô5ô/'ˆEó /'ó 6ð/'ðd%Ø
�5˜ F¨E°3Ð6Ñ7Ñ
8ð%à
ˆ4�‰;˜˜S™	Ð!Ñ"ó%ð  €×Ñ˜h°Ô5ôTNˆxó TNó 6ðTNðn €×Ñ˜h°Ô5ô	%�<ó 	%ó 6ð	%ð €×Ñ˜h°Ô5ô)ˆ4ó )ó 6ð)ðB 
Ø	Ø+/ð	!ð 	Øò!ð ˜ ™Ñ(ô	!øð] ò MÙ
ÐDÓ
EÈ1ÐLûðMús   “C* Ã*C=Ã/	C8Ã8C=