diff --git a/include/cudaq/Frontend/nvqpp/ASTBridge.h b/include/cudaq/Frontend/nvqpp/ASTBridge.h index baf4518fce..3b257dc51e 100644 --- a/include/cudaq/Frontend/nvqpp/ASTBridge.h +++ b/include/cudaq/Frontend/nvqpp/ASTBridge.h @@ -20,7 +20,6 @@ #include "clang/Frontend/FrontendAction.h" #include "clang/Rewrite/Core/Rewriter.h" #include "llvm/ADT/ScopedHashTable.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "mlir/IR/Builders.h" diff --git a/include/cudaq/Optimizer/InitAllDialects.h b/include/cudaq/Optimizer/InitAllDialects.h index c6df70d88f..0748b5866a 100644 --- a/include/cudaq/Optimizer/InitAllDialects.h +++ b/include/cudaq/Optimizer/InitAllDialects.h @@ -10,7 +10,6 @@ #include "cudaq/Optimizer/Dialect/CC/CCDialect.h" #include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" @@ -26,7 +25,6 @@ inline void registerAllDialects(mlir::DialectRegistry ®istry) { // clang-format off registry.insert< // MLIR dialects - mlir::AffineDialect, mlir::arith::ArithDialect, mlir::cf::ControlFlowDialect, mlir::complex::ComplexDialect, diff --git a/include/cudaq/Optimizer/Transforms/Passes.h b/include/cudaq/Optimizer/Transforms/Passes.h index 77f461bec2..d699e25355 100644 --- a/include/cudaq/Optimizer/Transforms/Passes.h +++ b/include/cudaq/Optimizer/Transforms/Passes.h @@ -42,7 +42,6 @@ std::unique_ptr createQuakeSynthesizer(std::string_view, const void *, std::size_t startingArgIdx = 0, bool sameAddressSpace = false); -std::unique_ptr createRaiseToAffinePass(); std::unique_ptr createUnwindLoweringPass(); std::unique_ptr diff --git a/lib/Optimizer/CodeGen/CMakeLists.txt b/lib/Optimizer/CodeGen/CMakeLists.txt index 56951cd07a..5c056e0e11 100644 --- a/lib/Optimizer/CodeGen/CMakeLists.txt +++ b/lib/Optimizer/CodeGen/CMakeLists.txt @@ -54,7 +54,6 @@ add_cudaq_library(OptCodeGen MLIRTransforms # Conversions - MLIRAffineToStandard MLIRArithToLLVM MLIRComplexToLibm MLIRComplexToLLVM diff --git a/lib/Optimizer/CodeGen/ConvertToQIR.cpp b/lib/Optimizer/CodeGen/ConvertToQIR.cpp index e23691af94..738ee66ea1 100644 --- a/lib/Optimizer/CodeGen/ConvertToQIR.cpp +++ b/lib/Optimizer/CodeGen/ConvertToQIR.cpp @@ -20,7 +20,6 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/TypeSwitch.h" #include "llvm/Support/FormatVariadic.h" -#include "mlir/Conversion/AffineToStandard/AffineToStandard.h" #include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h" #include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h" #include "mlir/Conversion/ComplexToLibm/ComplexToLibm.h" @@ -166,7 +165,6 @@ class ConvertToQIR : public cudaq::opt::impl::ConvertToQIRBase { populateComplexToLibmConversionPatterns(patterns, 1); populateComplexToLLVMConversionPatterns(typeConverter, patterns); - populateAffineToStdConversionPatterns(patterns); arith::populateCeilFloorDivExpandOpsPatterns(patterns); arith::populateArithToLLVMConversionPatterns(typeConverter, patterns); populateMathToLLVMConversionPatterns(typeConverter, patterns); diff --git a/lib/Optimizer/Transforms/PassDetails.h b/lib/Optimizer/Transforms/PassDetails.h index 95d6b69476..36b45aa69e 100644 --- a/lib/Optimizer/Transforms/PassDetails.h +++ b/lib/Optimizer/Transforms/PassDetails.h @@ -11,7 +11,6 @@ #include "cudaq/Optimizer/Dialect/CC/CCDialect.h" #include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h" #include "cudaq/Optimizer/Dialect/Quake/QuakeOps.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Complex/IR/Complex.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" #include "mlir/Dialect/Func/IR/FuncOps.h" diff --git a/lib/Optimizer/Transforms/QuakeAddMetadata.cpp b/lib/Optimizer/Transforms/QuakeAddMetadata.cpp index 6f174463f3..2c8dbc284b 100644 --- a/lib/Optimizer/Transforms/QuakeAddMetadata.cpp +++ b/lib/Optimizer/Transforms/QuakeAddMetadata.cpp @@ -12,7 +12,6 @@ #include "cudaq/Optimizer/Transforms/Passes.h" #include "cudaq/Todo.h" #include "llvm/Support/Debug.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" diff --git a/runtime/cudaq/builder/kernel_builder.cpp b/runtime/cudaq/builder/kernel_builder.cpp index be415c6620..6870ebef2a 100644 --- a/runtime/cudaq/builder/kernel_builder.cpp +++ b/runtime/cudaq/builder/kernel_builder.cpp @@ -17,8 +17,6 @@ #include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h" #include "cudaq/Optimizer/Dialect/Quake/QuakeOps.h" #include "cudaq/Optimizer/Transforms/Passes.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" -#include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/Dialect/Math/IR/Math.h" #include "mlir/ExecutionEngine/ExecutionEngine.h" diff --git a/test/Quake/ccnot.qke b/test/Quake/ccnot.qke deleted file mode 100644 index a74536dfd6..0000000000 --- a/test/Quake/ccnot.qke +++ /dev/null @@ -1,52 +0,0 @@ -// ========================================================================== // -// Copyright (c) 2022 - 2024 NVIDIA Corporation & Affiliates. // -// All rights reserved. // -// // -// This source code and the accompanying materials are made available under // -// the terms of the Apache License 2.0 which accompanies this distribution. // -// ========================================================================== // - -// RUN: cudaq-opt %s --inline --canonicalize | FileCheck %s - -module { - - // CHECK-LABEL: func.func @apply_x( - // CHECK-SAME: %[[arg0:.*]]: !quake.ref) { - // CHECK: quake.x %[[arg0]] : - // CHECK: return - // CHECK: } - - // CHECK-LABEL: func.func @ccnot() { - // CHECK: %[[a0:.*]] = quake.alloca !quake.veq<3> - // CHECK: affine.for %[[arg0:.*]] = 0 to 3 { - // CHECK: %[[a2:.*]] = quake.extract_ref %[[a0]][%[[arg0]]] : (!quake.veq<3>, index) -> !quake.ref - // CHECK: quake.x %[[a2]] : - // CHECK: } - // CHECK: %[[a1:.*]] = quake.extract_ref %[[a0]][1] : (!quake.veq<3>) -> !quake.ref - // CHECK: quake.x %[[a1]] : - // CHECK: return - // CHECK: } - - func.func @apply_x(%q : !quake.ref) { - quake.x %q : (!quake.ref) -> () - return - } - - func.func @ccnot() { - %c_3 = arith.constant 3 : i32 - %c_0 = arith.constant 0 : i32 - %c_1 = arith.constant 1 : i32 - %c_2 = arith.constant 2 : i32 - %qubits = quake.alloca !quake.veq [ %c_3 : i32 ] - %c_3_idx = arith.index_cast %c_3 : i32 to index - affine.for %i = 0 to %c_3_idx { - %q0 = quake.extract_ref %qubits [%i] : (!quake.veq, index) -> !quake.ref - quake.x %q0 : (!quake.ref) -> () - } - - %q1 = quake.extract_ref %qubits [%c_1] : (!quake.veq, i32) -> !quake.ref - func.call @apply_x(%q1) : (!quake.ref) -> () - - return - } -} diff --git a/tools/cudaq-quake/CMakeLists.txt b/tools/cudaq-quake/CMakeLists.txt index f5f2960ed6..277df39c22 100644 --- a/tools/cudaq-quake/CMakeLists.txt +++ b/tools/cudaq-quake/CMakeLists.txt @@ -25,7 +25,6 @@ target_link_libraries(cudaq-quake MLIRLLVMCommonConversion MLIRLLVMToLLVMIRTranslation - MLIRAffineDialect MLIRMemRefDialect clangCodeGen