
    UpfY                        d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z
 ddlT ddlT  G d d	e          Z[ G d
 de          Z[ddZdS )z,Python bindings for the MLIR Triton dialect.    )annotations)Sequence)PointerTypeinfer_reduce_op_encodingregister_dialect)ir   )*c                  (     e Zd Zdddd fdZ xZS )ReduceOpNlocipoperandsSequence[ir.Value]axisintr   ir.Location | Noner   ir.InsertionPoint | Nonec               t    t          ||          }t                                          |||||           d S )Nr   )_infer_reduce_op_return_typessuper__init__)selfr   r   r   r   return_types	__class__s         U/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/jaxlib/triton/dialect.pyr   zReduceOp.__init__$   s=     14@@L	GG\8TsrBBBBB    )r   r   r   r   r   r   r   r   __name__
__module____qualname__r   __classcell__r   s   @r   r   r   "   s[         !%%)	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	Cr   r   c                  ,     e Zd Z	 ddddd fdZ xZS )ScanOpFNr   r   r   r   r   reverseboolr   r   r   r   c               n    d |D             }t                                          ||||||           d S )Nc                    g | ]	}|j         
S  )type).0ops     r   
<listcomp>z#ScanOp.__init__.<locals>.<listcomp>?   s    ///BG///r   r   )r   r   )r   r   r   r'   r   r   r   r   s          r   r   zScanOp.__init__6   sC     0/h///L	GG\8T7KKKKKr   )F)
r   r   r   r   r'   r(   r   r   r   r   r   r$   s   @r   r&   r&   4   sf         	
L !%%)
L 
L 
L 
L 
L 
L 
L 
L 
L 
L 
L 
Lr   r&   r   r   r   r   returnSequence[ir.Type]c                   g }| D ]}t          j        |j                  }t          |j                  }||= |s|                    |j                   O|j        x}r[t          ||          }|t          d          |                    t           j        
                    ||j        |                     |                    t           j        
                    ||j                             |S )Nz1Failed to infer return type encoding for ReduceOp)r   RankedTensorTyper,   listshapeappendelement_typeencodingr   RuntimeErrorget)r   r   r   r.   op_typer5   op_encodingr8   s           r   r   r   N   s    , P Pb!"'**GEd 
P'.////(	( P)+t<<h		NOOO


!
!%)=x
H
H    "-11%9MNNOOOO	r   N)r   r   r   r   r0   r1   )__doc__
__future__r   collections.abcr   "jaxlib.mlir._mlir_libs._triton_extr   r   r   jaxlib.mlirr   _triton_enum_gen_triton_ops_genr   reducer&   scanr   r+   r   r   <module>rF      s  " 3 2 " " " " " " $ $ $ $ $ $         
              C C C C Cx C C C L L L L LV L L L  	     r   