MLIR Passes v1.0
|
Go to the source code of this file.
Functions | |
void | mqss::interfaces::insertQASMGateIntoQuakeModule (std::string gateId, OpBuilder &builder, Location loc, std::vector< mlir::Value > vecParams, std::vector< mlir::Value > vecControls, std::vector< mlir::Value > vecTargets, bool adj) |
Given a gate type as a string, this functions inserts the corresponding Quake gate in the given builder. | |
bool | mqss::interfaces::isMultiQubitGate (const std::string &gateType) |
Given a gate type as a string, this functions checks if the given gate type has control outputs. | |
size_t | mqss::interfaces::getNumControls (const std::string &gateType) |
Given a gate type as a string, this functions returns the number of control outputs associated with the given gate type. | |
double | mqss::interfaces::evaluateExpression (const std::shared_ptr< qasm3::Expression > &expr) |
Function that evaluates a numeric expression in the AST. | |
void | mqss::interfaces::insertGate (const std::shared_ptr< qasm3::GateCallStatement > &gateCall, OpBuilder &builder, Location loc, mlir::Operation *inOp, QASMVectorToQuakeVector QASMToVectors) |
This function inserts a gate into a MLIR/Quake module. | |
void | mqss::interfaces::parseAndInsertMeasurements (const std::vector< std::shared_ptr< qasm3::Statement > > &statements, OpBuilder &builder, Location loc, mlir::Operation *inOp, QASMVectorToQuakeVector QASMToVectors) |
This function inserts measurements into a MLIR/Quake module. | |
std::tuple< QASMVectorToQuakeVector, QuantumVectorsOrder > | mqss::interfaces::insertAllocatedQubits (const std::vector< std::shared_ptr< qasm3::Statement > > &program, OpBuilder &builder, Location loc, mlir::Operation *inOp) |
This function return the quantum vectors and its order, given a Abstract Syntax Tree of a QASM program. | |
This header defines a set of functions utilized to parse QASM circuits to MLIR/Quake modules.
double mqss::interfaces::evaluateExpression | ( | const std::shared_ptr< qasm3::Expression > & | expr | ) |
Function that evaluates a numeric expression in the AST.
[in] | expr | is as qasm3 numeric expression. |
size_t mqss::interfaces::getNumControls | ( | const std::string & | gateType | ) |
Given a gate type as a string, this functions returns the number of control outputs associated with the given gate type.
[in] | gateType | is a string specifying the type a quantum gate. |
std::tuple< QASMVectorToQuakeVector, QuantumVectorsOrder > mqss::interfaces::insertAllocatedQubits | ( | const std::vector< std::shared_ptr< qasm3::Statement > > & | program, |
OpBuilder & | builder, | ||
Location | loc, | ||
mlir::Operation * | inOp ) |
This function return the quantum vectors and its order, given a Abstract Syntax Tree of a QASM program.
This function receives an AST of QASM program, and create a quake::veq
for each quantum register declared in the QASM program. Moreover, returns the order of appearance of each quantum register.
[in] | program | is the AST of a QASM program. |
[out] | builder | is an OpBuilder object associated with a MLIR module. It is used to insert new instructions (quantum registers) to the corresponding MLIR module. |
[in] | loc | is the location of the new inserted instruction (quantum registers). |
[in] | inOp | is the return operation in the module associated to the builder. New instructions are inserted before thereturn operation. |
QASMVectorToQuakeVector
and std::vector<std::pair<std::string, int>>
. The QASMVectorToQuakeVector
is a map of type std::unordered_map<std::string, mlir::Value>
. The key
is a string corresponding to a quantum vector declared in the QASM program and the value
corresponds to an mlir::Value
associated to a created and inserted quake::veq
. The second argument of the tuple is a vector that preserves the order of the inserted quake::veq
, each entry is pair storing the quantum vector id, and the size of the quantum vector. void mqss::interfaces::insertGate | ( | const std::shared_ptr< qasm3::GateCallStatement > & | gateCall, |
OpBuilder & | builder, | ||
Location | loc, | ||
mlir::Operation * | inOp, | ||
QASMVectorToQuakeVector | QASMToVectors ) |
This function inserts a gate into a MLIR/Quake module.
The QASM to Quake parser invokes this function to insert each gate in the AST.
[in] | gateCall | is qasm3 gate declaration. |
[out] | builder | is an OpBuilder object associated with a MLIR module. It is used to insert new instructions (quantum registers) to the corresponding MLIR module. |
[in] | loc | is the location of the new inserted instruction (quantum registers). |
[in] | inOp | is the return operation in the module associated to the builder. New instructions are inserted before thereturn operation. |
[in] | QASMToVectors | map that returns a mlir::Value associated to a declared quantum vector, given the QASM quantum vector declaration. |
void mqss::interfaces::insertQASMGateIntoQuakeModule | ( | std::string | gateId, |
OpBuilder & | builder, | ||
Location | loc, | ||
std::vector< mlir::Value > | vecParams, | ||
std::vector< mlir::Value > | vecControls, | ||
std::vector< mlir::Value > | vecTargets, | ||
bool | adj ) |
Given a gate type as a string, this functions inserts the corresponding Quake gate in the given builder.
This method inserts a quake operation into an MLIR module associated with the builder passed as parameter.
[in] | gateId | is a string specifying the type of the quantum gate to be inserted. |
[out] | builder | is an OpBuilder object associated with a MLIR module. It is used to insert new instructions to the corresponding MLIR module. |
[in] | loc | is the location of the new inserted instruction. |
[in] | vecParams | is the vector of arguments of the gate to be inserted, e.g., rotation angles in rotation gates. |
[in] | vecControls | is the vector of control qubits. |
[in] | vecTargets | is the vector of target qubits. |
[in] | adj | determines is the gate is an adjoint operation. |
bool mqss::interfaces::isMultiQubitGate | ( | const std::string & | gateType | ) |
Given a gate type as a string, this functions checks if the given gate type has control outputs.
[in] | gateType | is a string specifying the type of a quantum gate. |
true
if a gate is a multi-qubit gate with implicit controls. void mqss::interfaces::parseAndInsertMeasurements | ( | const std::vector< std::shared_ptr< qasm3::Statement > > & | statements, |
OpBuilder & | builder, | ||
Location | loc, | ||
mlir::Operation * | inOp, | ||
QASMVectorToQuakeVector | QASMToVectors ) |
This function inserts measurements into a MLIR/Quake module.
The QASM to Quake parser invokes this function to insert measurements into a given MLIR/Quake module.
[in] | statements | is qasm3 measurements declarations. |
[out] | builder | is an OpBuilder object associated with a MLIR module. It is used to insert new instructions (quantum registers) to the corresponding MLIR module. |
[in] | loc | is the location of the new inserted instruction (quantum registers). |
[in] | inOp | is the return operation in the module associated to the builder. New instructions are inserted before thereturn operation. |
[in] | QASMToVectors | map that returns a mlir::Value associated to a declared quantum vector, given the QASM quantum vector declaration. |