37 lines
1.2 KiB
TableGen
37 lines
1.2 KiB
TableGen
#ifndef SPATIAL_TO_PIM
|
|
#define SPATIAL_TO_PIM
|
|
|
|
#ifndef OP_BASE
|
|
include "mlir/IR/PatternBase.td"
|
|
include "mlir/Dialect/Tensor/IR/TensorOps.td"
|
|
include "src/Dialect/ONNX/ONNX.td"
|
|
include "src/Accelerators/PIM/Dialect/Spatial/Spatial.td"
|
|
include "src/Accelerators/PIM/Dialect/Pim/Pim.td"
|
|
#endif // OP_BASE
|
|
|
|
def onnxToPimTransposeOp : Pat<
|
|
(ONNXTransposeOp:$srcOpRes $data, $perms),
|
|
(PimTransposeOp $data, $perms,
|
|
(NativeCodeCall<"onnx_mlir::getBestOutputTensorFromOperandsOrAllocate($_builder, $0.getDefiningOp())"> $srcOpRes))
|
|
>;
|
|
|
|
def spatToPimVMMOp : Pat<
|
|
(SpatWeightedVMMOp:$srcOpRes $weightIndex, $vector),
|
|
(PimVMMOp $weightIndex, $vector,
|
|
(NativeCodeCall<"onnx_mlir::getBestOutputTensorFromOperandsOrAllocate($_builder, $0.getDefiningOp())"> $srcOpRes))
|
|
>;
|
|
|
|
def spatToPimMVMOp : Pat<
|
|
(SpatWeightedMVMOp:$srcOpRes $weightIndex, $vector),
|
|
(PimMVMOp $weightIndex, $vector,
|
|
(NativeCodeCall<"onnx_mlir::getBestOutputTensorFromOperandsOrAllocate($_builder, $0.getDefiningOp())"> $srcOpRes))
|
|
>;
|
|
|
|
def spatToPimVAddOp : Pat<
|
|
(SpatVAddOp:$srcOpRes $a, $b),
|
|
(PimVAddOp $a, $b,
|
|
(NativeCodeCall<"onnx_mlir::getBestOutputTensorFromOperandsOrAllocate($_builder, $0.getDefiningOp())"> $srcOpRes))
|
|
>;
|
|
|
|
#endif // SPATIAL_TO_PIM
|