-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[mlir][EmitC] Add pass that combines all available emitc conversions #117549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
75382a9
[mlir][EmitC] Add pass that combines all available emitc conversions
3fa4597
Review comments
31fe821
Review comment
bc6ecd3
Use TypeConverter in FuncToEmitC conversion
29366fc
Drop unused includes and fix header format
7a6e240
Fix errors after rebase
3e82694
Add interfaces for conversion
d619ac5
Fix formatting errors
c207678
Address review comments
cd6e5c9
Don't run failure tests with the interface based conversion pass
452c8a8
Update pass description
2ad78a3
format fixes
0364077
Remove method
simon-camp 4bf2f8c
EMitC->EmitC
mtrofin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
mlir/include/mlir/Conversion/ConvertToEmitC/ConvertToEmitCPass.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//===- ConvertToEmitCPass.h - Conversion to EmitC pass ----------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_CONVERSION_CONVERTTOEMITC_CONVERTTOEMITCPASS_H | ||
#define MLIR_CONVERSION_CONVERTTOEMITC_CONVERTTOEMITCPASS_H | ||
|
||
#include "llvm/ADT/SmallVector.h" | ||
|
||
#include <memory> | ||
|
||
namespace mlir { | ||
class Pass; | ||
|
||
#define GEN_PASS_DECL_CONVERTTOEMITC | ||
#include "mlir/Conversion/Passes.h.inc" | ||
|
||
} // namespace mlir | ||
|
||
#endif // MLIR_CONVERSION_CONVERTTOEMITC_CONVERTTOEMITCPASS_H |
45 changes: 45 additions & 0 deletions
45
mlir/include/mlir/Conversion/ConvertToEmitC/ToEmitCInterface.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//===- ToEmitCInterface.h - Conversion to EmitC iface ---*- C++ -*-===========// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_CONVERSION_CONVERTTOEMITC_TOEMITCINTERFACE_H | ||
#define MLIR_CONVERSION_CONVERTTOEMITC_TOEMITCINTERFACE_H | ||
|
||
#include "mlir/IR/DialectInterface.h" | ||
#include "mlir/IR/MLIRContext.h" | ||
#include "mlir/IR/OpDefinition.h" | ||
|
||
namespace mlir { | ||
class ConversionTarget; | ||
class TypeConverter; | ||
class MLIRContext; | ||
class Operation; | ||
class RewritePatternSet; | ||
class AnalysisManager; | ||
|
||
class ConvertToEmitCPatternInterface | ||
: public DialectInterface::Base<ConvertToEmitCPatternInterface> { | ||
public: | ||
ConvertToEmitCPatternInterface(Dialect *dialect) : Base(dialect) {} | ||
|
||
/// Hook for derived dialect interface to provide conversion patterns | ||
/// and mark dialect legal for the conversion target. | ||
virtual void populateConvertToEmitCConversionPatterns( | ||
ConversionTarget &target, TypeConverter &typeConverter, | ||
RewritePatternSet &patterns) const = 0; | ||
}; | ||
|
||
/// Recursively walk the IR and collect all dialects implementing the interface, | ||
/// and populate the conversion patterns. | ||
void populateConversionTargetFromOperation(Operation *op, | ||
ConversionTarget &target, | ||
TypeConverter &typeConverter, | ||
RewritePatternSet &patterns); | ||
|
||
} // namespace mlir | ||
|
||
#endif // MLIR_CONVERSION_CONVERTTOEMITC_TOEMITCINTERFACE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
add_mlir_conversion_library(MLIRConvertToEmitC | ||
mtrofin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ConvertToEmitCPass.cpp | ||
|
||
ADDITIONAL_HEADER_DIRS | ||
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/ConvertToEmitC | ||
|
||
DEPENDS | ||
MLIRConversionPassIncGen | ||
|
||
LINK_LIBS PUBLIC | ||
MLIRArithToEmitC | ||
MLIRFuncToEmitC | ||
MLIRMemRefToEmitC | ||
MLIRPass | ||
MLIRSCFToEmitC | ||
MLIRTransformUtils | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.