18struct LinalgCopyOpSubsetOpInterface
19 :
public SubsetOpInterface::ExternalModel<LinalgCopyOpSubsetOpInterface,
21 bool operatesOnEquivalentSubset(
22 Operation *op, SubsetOpInterface candidate,
25 if (
auto otherCopyOp = dyn_cast<linalg::CopyOp>(candidate.getOperation()))
26 return equivalenceFn(cast<linalg::CopyOp>(op).getOutputs()[0],
27 otherCopyOp.getOutputs()[0]);
33 bool operatesOnDisjointSubset(
34 Operation *op, SubsetOpInterface candidate,
42struct LinalgCopyOpInterface
43 :
public SubsetInsertionOpInterface::ExternalModel<LinalgCopyOpInterface,
45 OpOperand &getSourceOperand(Operation *op)
const {
46 auto copyOp = cast<CopyOp>(op);
47 return llvm::getSingleElement(copyOp.getInputsMutable());
51 isEquivalentSubset(Operation *op, Value candidate,
53 auto copyOp = cast<CopyOp>(op);
54 return equivalenceFn(candidate,
55 llvm::getSingleElement(copyOp.getOutputs()));
60 auto copyOp = cast<CopyOp>(op);
61 return llvm::getSingleElement(copyOp.getOutputs());
65 getValuesNeededToBuildSubsetExtraction(Operation *op)
const {
66 auto copyOp = cast<CopyOp>(op);
67 return {llvm::getSingleElement(copyOp.getOutputs())};
75 linalg::CopyOp::attachInterface<LinalgCopyOpSubsetOpInterface>(*ctx);
76 linalg::CopyOp::attachInterface<LinalgCopyOpInterface>(*ctx);
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
MLIRContext is the top-level object for a collection of MLIR operations.
Value buildSubsetExtraction(RewriterBase &rewriter, SubsetInsertionOpInterface op, tensor::EmptyOp emptyTensorOp, Operation *user)
This method builds and returns a subset extraction value for the destination tensor that the given op...
void registerSubsetOpInterfaceExternalModels(DialectRegistry ®istry)
Include the generated interface declarations.
llvm::function_ref< Fn > function_ref