| 91 | |
| 92 | template <> |
| 93 | LogicalResult onMemoryForwardFailure<Kernel::Reshape>( |
| 94 | Kernel::Reshape op, PatternRewriter& rewriter) { |
| 95 | Value input = op->getOperand(0), output = op->getResult(0); |
| 96 | MemRefType outputType = output.getType().dyn_cast<MemRefType>(); |
| 97 | Value newOutput = rewriter.create<memref::AllocOp>( |
| 98 | op->getLoc(), |
| 99 | MemRefType::get(outputType.getShape(), outputType.getElementType())); |
| 100 | MemRefType inputType = input.getType().dyn_cast<MemRefType>(); |
| 101 | Value newOutputReshaped = rewriter.create<Kernel::Reshape>( |
| 102 | op->getLoc(), |
| 103 | MemRefType::get(inputType.getShape(), inputType.getElementType()), |
| 104 | newOutput, true); |
| 105 | rewriter.create<Kernel::RelayoutKernel>(op->getLoc(), input, newOutputReshaped); |
| 106 | rewriter.replaceOp(op, newOutput); |
| 107 | return success(); |
| 108 | } |
| 109 | |
| 110 | template <typename OpTy> |
| 111 | class MemFwdOpConversion final : public OpRewritePattern<OpTy> { |
nothing calls this directly
no outgoing calls
no test coverage detected