#include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/Tensor/IR/Tensor.h" #include "mlir/Interfaces/SideEffectInterfaces.h" #include "ShapingUtils.hpp" #include "src/Accelerators/PIM/Dialect/Spatial/SpatialOps.hpp" #include "src/Dialect/ONNX/ONNXOps.hpp" using namespace mlir; namespace onnx_mlir { bool isShapingOnlyOp(Operation *op) { return isa(op); } bool isPureIndexComputationOp(Operation *op) { if (op->getNumRegions() != 0 || op->getNumResults() == 0 || op->hasTrait() || !isMemoryEffectFree(op)) return false; auto isIndexOrInteger = [](Type type) { return type.isIndex() || isa(type); }; return llvm::all_of(op->getOperandTypes(), isIndexOrInteger) && llvm::all_of(op->getResultTypes(), isIndexOrInteger); } } // namespace onnx_mlir