add PIM accelerator
This commit is contained in:
37
src/PIM/Pass/MessagePass.cpp
Normal file
37
src/PIM/Pass/MessagePass.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "mlir/Pass/Pass.h"
|
||||
#include "src/Compiler/CompilerUtils.hpp"
|
||||
|
||||
using namespace mlir;
|
||||
|
||||
namespace onnx_mlir {
|
||||
|
||||
namespace {
|
||||
|
||||
struct MessagePass : public PassWrapper<MessagePass, OperationPass<ModuleOp>> {
|
||||
|
||||
MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MessagePass)
|
||||
|
||||
StringRef getArgument() const override { return "message-pass"; }
|
||||
|
||||
StringRef getDescription() const override {
|
||||
return "Lower ONNX ops to Spatial ops.";
|
||||
}
|
||||
|
||||
// Make sure that we have a valid default constructor and copy
|
||||
// constructor to make sure that the options are initialized properly.
|
||||
MessagePass(std::string message) : message(message) {}
|
||||
MessagePass(const MessagePass &pass)
|
||||
: PassWrapper<MessagePass, OperationPass<ModuleOp>>() {}
|
||||
void runOnOperation() final { showCompilePhase(message); }
|
||||
|
||||
private:
|
||||
std::string message;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<Pass> createMessagePass(std::string message) {
|
||||
return std::make_unique<MessagePass>(message);
|
||||
}
|
||||
|
||||
} // namespace onnx_mlir
|
||||
Reference in New Issue
Block a user