
    uki                        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 ddl  G d d	e      Z[ G d
 de      Z[	 	 	 	 	 	 ddZy)z,Python bindings for the MLIR Triton dialect.    )annotations)Sequence)PointerTyperegister_dialectinfer_reduce_op_encoding)ir   )*c                  6     e Zd Zddd	 	 	 	 	 	 	 d fdZ xZS )ReduceOpNlocipc               F    t        ||      }t        | 	  |||||       y Nr   )_infer_reduce_op_return_typessuper__init__)selfoperandsaxisr   r   return_types	__class__s         P/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jaxlib/triton/dialect.pyr   zReduceOp.__init__$   s)     14@L	G\8TsrB    )r   Sequence[ir.Value]r   intr   ir.Location | Noner   ir.InsertionPoint | None__name__
__module____qualname__r   __classcell__r   s   @r   r   r   "   sA     !%%)	C"	C 	C
 	C #	C 	Cr   r   c                  >     e Zd Z	 dddd	 	 	 	 	 	 	 	 	 d fdZ xZS )ScanOpNr   c               l    |D cg c]  }|j                    }}t        | 	  ||||||       y c c}w r   )typer   r   )	r   r   r   reverser   r   opr   r   s	           r   r   zScanOp.__init__6   s;     '//BGG/L/	G\8T7K 0s   1)F)
r   r   r   r   r*   boolr   r   r   r   r    r%   s   @r   r'   r'   4   sW     	
L !%%)
L"
L 
L 	
L 
L #
L 
Lr   r'   c                   g }| D ]  }t        j                  |j                        }t        |j                        }||= |s|j                  |j                         X|j                  x}rTt        ||      }|t        d      |j                  t         j                  j                  ||j                  |             |j                  t         j                  j                  ||j                                |S )Nz1Failed to infer return type encoding for ReduceOp)r   RankedTensorTyper)   listshapeappendelement_typeencoding_infer_reduce_op_encodingRuntimeErrorget)r   r   r   r+   op_typer0   op_encodingr3   s           r   r   r   N   s     , Pb!!"''*GEd'../((	(	(*;=h		NOO



!
!%)=)=x
H "--11%9M9MNOP 
r   N)r   r   r   r   returnzSequence[ir.Type])__doc__
__future__r   collections.abcr   "jaxlib.mlir._mlir_libs._triton_extr   r   r   r4   jaxlib.mlirr   _triton_enum_gen_triton_ops_genr   reducer'   scanr    r   r   <module>rD      sh   " 3 " $ 
   Cx C LV L  	 (+r   