Loading mlir/tools/qcor-mlir-tool.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -74,10 +74,6 @@ int main(int argc, char **argv) { mlir::MLIRContext &context = *(mlir_gen_result.mlir_context); std::vector<std::string> &unique_function_names = mlir_gen_result.unique_function_names; if (emitAction == Action::DumpMLIR) { module->dump(); return 0; } // Create the PassManager for lowering to LLVM MLIR and run it mlir::PassManager pm(&context); Loading @@ -87,6 +83,19 @@ int main(int argc, char **argv) { // Add optimization passes qcor::configureOptimizationPasses(pm); } if (emitAction == Action::DumpMLIR) { if (qoptimizations) { auto module_op = (*module).getOperation(); if (mlir::failed(pm.run(module_op))) { std::cout << "Pass Manager Failed\n"; return 1; } } module->dump(); return 0; } // Lower MLIR to LLVM pm.addPass(std::make_unique<qcor::QuantumToLLVMLoweringPass>( qoptimizations, unique_function_names)); Loading mlir/transforms/optimizations/RemoveUnusedQIRCallsPass.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,14 @@ void RemoveUnusedQIRCallsPass::runOnOperation() { } }); // Remove any constant ops that are not being used. getOperation().walk([&](mlir::ConstantOp op) { // Extracted qubit has no use if (op.getResult().use_empty()) { deadOps.emplace_back(op.getOperation()); } }); // Need to remove these extract calls to realize qalloc removal below. for (auto &op : deadOps) { op->dropAllUses(); Loading runtime/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ foreach(EXTRA_HEADER ${QCOR_EXTRA_HEADERS}) set(EXTRA_INCLUDE "${EXTRA_INCLUDE} -I ${EXTRA_HEADER}") endforeach() install(CODE "execute_process(COMMAND ${LLVM_INSTALL_PREFIX}/bin/clang++ -std=c++17 -x c++-header ${CMAKE_INSTALL_PREFIX}/include/qcor/qcor_lang_ext.hpp -o ${CMAKE_BINARY_DIR}/runtime/qcor_lang_ext.hpp.pch -I ${XACC_ROOT}/include/xacc -I ${XACC_ROOT}/include/qcor -I ${XACC_ROOT}/include/eigen ${EXTRA_INCLUDE})") install(CODE "execute_process(COMMAND ${LLVM_INSTALL_PREFIX}/bin/clang++ -std=c++17 -x c++-header ${CMAKE_INSTALL_PREFIX}/include/qcor/qcor_lang_ext.hpp -o ${CMAKE_BINARY_DIR}/runtime/qcor_lang_ext.hpp.pch -I ${XACC_ROOT}/include/xacc -I ${CMAKE_INSTALL_PREFIX}/include/qcor -I ${XACC_ROOT}/include/eigen ${EXTRA_INCLUDE})") install(FILES ${CMAKE_BINARY_DIR}/runtime/qcor_lang_ext.hpp.pch DESTINATION include/qcor) if (QCOR_BUILD_TESTS) Loading tools/driver/qcor.in +1 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,7 @@ def main(argv=None): if '-no-entrypoint' in sys.argv[1:]: sys.argv.remove('-no-entrypoint') extra_args.append('-no-entrypoint') # FIXME: define pass-mamanegement CLI options for qcor if '--q-optimize' in sys.argv[1:]: sys.argv.remove('--q-optimize') Loading Loading
mlir/tools/qcor-mlir-tool.cpp +13 −4 Original line number Diff line number Diff line Loading @@ -74,10 +74,6 @@ int main(int argc, char **argv) { mlir::MLIRContext &context = *(mlir_gen_result.mlir_context); std::vector<std::string> &unique_function_names = mlir_gen_result.unique_function_names; if (emitAction == Action::DumpMLIR) { module->dump(); return 0; } // Create the PassManager for lowering to LLVM MLIR and run it mlir::PassManager pm(&context); Loading @@ -87,6 +83,19 @@ int main(int argc, char **argv) { // Add optimization passes qcor::configureOptimizationPasses(pm); } if (emitAction == Action::DumpMLIR) { if (qoptimizations) { auto module_op = (*module).getOperation(); if (mlir::failed(pm.run(module_op))) { std::cout << "Pass Manager Failed\n"; return 1; } } module->dump(); return 0; } // Lower MLIR to LLVM pm.addPass(std::make_unique<qcor::QuantumToLLVMLoweringPass>( qoptimizations, unique_function_names)); Loading
mlir/transforms/optimizations/RemoveUnusedQIRCallsPass.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,14 @@ void RemoveUnusedQIRCallsPass::runOnOperation() { } }); // Remove any constant ops that are not being used. getOperation().walk([&](mlir::ConstantOp op) { // Extracted qubit has no use if (op.getResult().use_empty()) { deadOps.emplace_back(op.getOperation()); } }); // Need to remove these extract calls to realize qalloc removal below. for (auto &op : deadOps) { op->dropAllUses(); Loading
runtime/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ foreach(EXTRA_HEADER ${QCOR_EXTRA_HEADERS}) set(EXTRA_INCLUDE "${EXTRA_INCLUDE} -I ${EXTRA_HEADER}") endforeach() install(CODE "execute_process(COMMAND ${LLVM_INSTALL_PREFIX}/bin/clang++ -std=c++17 -x c++-header ${CMAKE_INSTALL_PREFIX}/include/qcor/qcor_lang_ext.hpp -o ${CMAKE_BINARY_DIR}/runtime/qcor_lang_ext.hpp.pch -I ${XACC_ROOT}/include/xacc -I ${XACC_ROOT}/include/qcor -I ${XACC_ROOT}/include/eigen ${EXTRA_INCLUDE})") install(CODE "execute_process(COMMAND ${LLVM_INSTALL_PREFIX}/bin/clang++ -std=c++17 -x c++-header ${CMAKE_INSTALL_PREFIX}/include/qcor/qcor_lang_ext.hpp -o ${CMAKE_BINARY_DIR}/runtime/qcor_lang_ext.hpp.pch -I ${XACC_ROOT}/include/xacc -I ${CMAKE_INSTALL_PREFIX}/include/qcor -I ${XACC_ROOT}/include/eigen ${EXTRA_INCLUDE})") install(FILES ${CMAKE_BINARY_DIR}/runtime/qcor_lang_ext.hpp.pch DESTINATION include/qcor) if (QCOR_BUILD_TESTS) Loading
tools/driver/qcor.in +1 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,7 @@ def main(argv=None): if '-no-entrypoint' in sys.argv[1:]: sys.argv.remove('-no-entrypoint') extra_args.append('-no-entrypoint') # FIXME: define pass-mamanegement CLI options for qcor if '--q-optimize' in sys.argv[1:]: sys.argv.remove('--q-optimize') Loading