Lines Matching refs:ir
14 from mlir import ir
33 def __init__(self, context: ir.Context):
41 (np.float64, ir.F64Type.get(context=context)),
42 (np.float32, ir.F32Type.get(context=context)),
43 (np.int64, ir.IntegerType.get_signless(64, context=context)),
44 (np.int32, ir.IntegerType.get_signless(32, context=context)),
45 (np.int16, ir.IntegerType.get_signless(16, context=context)),
46 (np.int8, ir.IntegerType.get_signless(8, context=context)),
49 self._ir2sc = dict(( (ir,sc) for sc,ir in types_list ))
51 def dtype_to_irtype(self, dtype: np.dtype) -> ir.Type:
58 def sctype_to_irtype(self, sctype) -> ir.Type:
65 def irtype_to_dtype(self, tp: ir.Type) -> np.dtype:
69 def irtype_to_sctype(self, tp: ir.Type):
76 def get_RankedTensorType_of_nparray(self, nparray: np.ndarray) -> ir.RankedTensorType:
80 return ir.RankedTensorType.get(nparray.shape,
92 def _assertEqualsRoundtripTp(self, tp: ir.RankedTensorType):
101 def build(self, types: List[ir.Type]):
106 self._module = ir.Module.create()
107 with ir.InsertionPoint(self._module.body):
112 funcTp = ir.FunctionType.get(inputs=[tp0], results=[tp0])
114 funcOp.attributes['llvm.emit_c_interface'] = ir.UnitAttr.get()
115 with ir.InsertionPoint(funcOp.add_entry_block()):
185 with ir.Context() as ctx, ir.Location.unknown():
203 f64 = ir.F64Type.get()
212 orderings = list(map(ir.AffineMap.get_permutation,
216 types = [ir.RankedTensorType.get(shape, f64)]
222 types.append(ir.RankedTensorType.get(shape, f64, attr))