Skip to content

Commit

Permalink
Replace base profile DependencyAnalysis with WIP adaptive profile Dep…
Browse files Browse the repository at this point in the history
…endencyAnalysis (#2095)

* WIP of dep-analysis with ifs

* Make LifeTimeSet a stack of frames

* Make getting first use separate from detecting allocs

* Add fixes to assign-ids

* Add support for lifting operations from blocks

* Formatting

* Make analysis work inside-out, move scheduling later in the process

* OpName needs to be public, no reason to be optional

* Myriad bug fixes

* Ignore lifting ops that depend on allocs
* Makes gatherOperands use the no. of dependencies as the no. of operands
* Fix an issue getting the QID for the wire output of a measurement
* Make generation of block arguments from dependency blocks more flexible
* Make result types of IfDependencyNodes more flexible
* IfDependencyNodes now invokes codegen on successors correctly
* TerminatorDependencyNode constructor used so virtual method lookup works properly

* Support for contracting allocs, and WIP refactoring to separate analysis into "passes"

* Formatting

* Add functionality to update height metadata after lifting

* Fix a few bugs related to lifting

* Single graph per block, based on terminator

* Some more clean up and bug fixes

* Refactor allocation pass

* Formatting

* Update pipelines

* Remove outdated tests

* Formatting
  • Loading branch information
atgeller authored Aug 15, 2024
1 parent 00a324e commit e97f14b
Show file tree
Hide file tree
Showing 17 changed files with 1,379 additions and 893 deletions.
2 changes: 0 additions & 2 deletions include/cudaq/Optimizer/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ void registerAggressiveEarlyInlining();

void registerUnrollingPipeline();

void registerQubitManagementPipeline();

std::unique_ptr<mlir::Pass> createApplyOpSpecializationPass();
std::unique_ptr<mlir::Pass>
createApplyOpSpecializationPass(bool computeActionOpt);
Expand Down
15 changes: 2 additions & 13 deletions include/cudaq/Optimizer/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,7 @@ def ArgumentSynthesis : Pass<"argument-synthesis", "mlir::func::FuncOp"> {
"mlir::cf::ControlFlowDialect"];
}

def AssignIDs : Pass<"assign-ids", "mlir::func::FuncOp"> {
let summary = "Generate and assign unique identifiers for virtual qubits.";
let description = [{
Attachs a matching unique ID attribute to each `quake.null_wire` and
corresponding `quake.sink`. This is used in DependencyAnalysis to associate
allocations and deallocations for tracking qubit lifetimes.
}];

let dependentDialects = ["quake::QuakeDialect"];
}

def BasisConversionPass : Pass<"basis-conversion", "mlir::ModuleOp"> {
def BasisConversionPass: Pass<"basis-conversion", "mlir::ModuleOp"> {
let summary = "Converts kernels to a set of basis operations.";
let description = [{
This pass takes as input a list of target (allowed) quantum operations.
Expand Down Expand Up @@ -226,7 +215,7 @@ def DecompositionPass: Pass<"decomposition", "mlir::ModuleOp"> {
];
}

def DependencyAnalysis : Pass<"dep-analysis", "mlir::func::FuncOp"> {
def DependencyAnalysis : Pass<"dep-analysis", "mlir::ModuleOp"> {
let summary = "Maps qubits and reorders operations based on dependency graph.";
let description = [{
A dependency graph is a Directed Acyclic Graph (DAG) where each node
Expand Down
174 changes: 0 additions & 174 deletions lib/Optimizer/Transforms/AssignIDs.cpp

This file was deleted.

1 change: 0 additions & 1 deletion lib/Optimizer/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ add_cudaq_library(OptTransforms
ApplyControlNegations.cpp
ApplyOpSpecialization.cpp
ArgumentSynthesis.cpp
AssignIDs.cpp
BasisConversion.cpp
CombineQuantumAlloc.cpp
ConstPropComplex.cpp
Expand Down
Loading

0 comments on commit e97f14b

Please sign in to comment.