This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg][bufferize][NFC] Use RewritePatterns instead of custom traversal
ClosedPublic

Authored by springerm on Dec 31 2021, 7:39 AM.

Details

Summary

This change simplifies BufferizableOpInterface and other functions. Overall, the API will get smaller: Functions related to custom IR traversal are deleted entirely. This will makes it easier to write BufferizableOpInterface implementations.

This is also in preparation of unifying Comprehensive Bufferize and core bufferization. While Comprehensive Bufferize could theoretically maintain its own IR traversal, there is no reason to do so, because all bufferize implementations in BufferizableOpInterface have to support partial bufferization anyway. And we can share a larger part of the code base between the two bufferizations.

Depends On D116742

Diff Detail

Event Timeline

springerm created this revision.Dec 31 2021, 7:39 AM
springerm requested review of this revision.Dec 31 2021, 7:39 AM
springerm edited the summary of this revision. (Show Details)Jan 5 2022, 11:56 PM
springerm edited the summary of this revision. (Show Details)
nicolasvasilache accepted this revision.Jan 6 2022, 12:17 AM

As discussed offline, please split BufferizationState into an Analysis and the rest and pass a const reference to the analysis in the rewrite pattern to make it clear that it does not mutate.

This revision is now accepted and ready to land.Jan 6 2022, 12:17 AM

state is now a const field in the rewrite pattern. The rewriteOp functions are extracted from BufferizationState in the next commit. BufferizationState could be renamed to AnalysisState in a future commit.

This revision was landed with ongoing or failed builds.Jan 6 2022, 7:57 AM
This revision was automatically updated to reflect the committed changes.