Loading mlir/dialect/lib/Quantum/QuantumDialect.cpp +27 −1 Original line number Diff line number Diff line Loading @@ -2,10 +2,35 @@ #include "Quantum/QuantumDialect.h" #include "Quantum/QuantumOps.h" #include "mlir/IR/OpImplementation.h" #include "mlir/Transforms/InliningUtils.h" using namespace mlir; using namespace mlir::quantum; namespace { /// Inliner interface /// This class defines the interface for handling inlining with Quantum /// operations. // We simplify inherit from the base interface class and override /// the necessary methods. struct QuantumInlinerInterface : public DialectInlinerInterface { using DialectInlinerInterface::DialectInlinerInterface; /// This hook checks to see if the given callable operation is legal to inline /// into the given call. /// Operations in Quantum dialect are always legal to inline. bool isLegalToInline(Operation *, Operation *, bool) const final { return true; } /// This hook checks to see if the given operation is legal to inline into the /// given region. /// Always legal to inline. bool isLegalToInline(Operation *, Region *, bool, BlockAndValueMapping &) const final { return true; } }; } // namespace //===----------------------------------------------------------------------===// // Quantum dialect. //===----------------------------------------------------------------------===// Loading @@ -15,6 +40,7 @@ void QuantumDialect::initialize() { #define GET_OP_LIST #include "Quantum/QuantumOps.cpp.inc" >(); addInterfaces<QuantumInlinerInterface>(); } // static void print(mlir::OpAsmPrinter &printer, mlir::quantum::InstOp op) { Loading mlir/transforms/pass_manager.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,8 @@ // across different use cases of MLIR compilation. namespace qcor { void configureOptimizationPasses(mlir::PassManager &passManager) { auto inliner = mlir::createInlinerPass(); passManager.addPass(std::move(inliner)); // TODO: configure the pass pipeline to handle repeated applications of passes. // Add passes constexpr int N_REPS = 5; Loading Loading
mlir/dialect/lib/Quantum/QuantumDialect.cpp +27 −1 Original line number Diff line number Diff line Loading @@ -2,10 +2,35 @@ #include "Quantum/QuantumDialect.h" #include "Quantum/QuantumOps.h" #include "mlir/IR/OpImplementation.h" #include "mlir/Transforms/InliningUtils.h" using namespace mlir; using namespace mlir::quantum; namespace { /// Inliner interface /// This class defines the interface for handling inlining with Quantum /// operations. // We simplify inherit from the base interface class and override /// the necessary methods. struct QuantumInlinerInterface : public DialectInlinerInterface { using DialectInlinerInterface::DialectInlinerInterface; /// This hook checks to see if the given callable operation is legal to inline /// into the given call. /// Operations in Quantum dialect are always legal to inline. bool isLegalToInline(Operation *, Operation *, bool) const final { return true; } /// This hook checks to see if the given operation is legal to inline into the /// given region. /// Always legal to inline. bool isLegalToInline(Operation *, Region *, bool, BlockAndValueMapping &) const final { return true; } }; } // namespace //===----------------------------------------------------------------------===// // Quantum dialect. //===----------------------------------------------------------------------===// Loading @@ -15,6 +40,7 @@ void QuantumDialect::initialize() { #define GET_OP_LIST #include "Quantum/QuantumOps.cpp.inc" >(); addInterfaces<QuantumInlinerInterface>(); } // static void print(mlir::OpAsmPrinter &printer, mlir::quantum::InstOp op) { Loading
mlir/transforms/pass_manager.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,8 @@ // across different use cases of MLIR compilation. namespace qcor { void configureOptimizationPasses(mlir::PassManager &passManager) { auto inliner = mlir::createInlinerPass(); passManager.addPass(std::move(inliner)); // TODO: configure the pass pipeline to handle repeated applications of passes. // Add passes constexpr int N_REPS = 5; Loading