You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
qss-compiler expresses variable references and assignments in OpenQASM 3 source code as MLIR operations that directly reflect these references and assignments in the initial MLIR -- that is, the initial MLIR uses memory semantics for variables. For later optimization, it is beneficial to resolve these operations with memory semantics such that the use of a variable directly uses the SSA value that has been assigned to the variable at that point.
Currently, the compiler uses the pass VariableElimination towards that goal. That pass takes a detour through the affine dialect and its scalar replacement pass. As a downside, that approach currently cannot resolve variable memory semantics around control flow.
We should revise the VariableElimination pass to fully resolve the OpenQASM 3 variable operations into SSA form.
Tasks
Identify test cases first.
Revise the VariableElimination pass.
Acceptance Criteria
New test cases check corner cases.
Proposal
The transformation could be integrated into quirgen. Yet, it should remain its own pass to facilitate debugging and unit testing.
Consider Marc M. Brandis, Hanspeter Mössenböck
Notes
The paper Marc M. Brandis, Hanspeter Mössenböck: Single-pass generation of static single-assignment form for structured languages describes an algorithm for transforming structured control flow into SSA form in a single pass and may serve as a starting point. The algorithm generates "classical SSA" with phi nodes, while MLIR has block and region arguments (and yield values), so there's some transformation required.
The text was updated successfully, but these errors were encountered:
Description
qss-compiler expresses variable references and assignments in OpenQASM 3 source code as MLIR operations that directly reflect these references and assignments in the initial MLIR -- that is, the initial MLIR uses memory semantics for variables. For later optimization, it is beneficial to resolve these operations with memory semantics such that the use of a variable directly uses the SSA value that has been assigned to the variable at that point.
Currently, the compiler uses the pass
VariableElimination
towards that goal. That pass takes a detour through theaffine
dialect and its scalar replacement pass. As a downside, that approach currently cannot resolve variable memory semantics around control flow.We should revise the
VariableElimination
pass to fully resolve the OpenQASM 3 variable operations into SSA form.Tasks
VariableElimination
pass.Acceptance Criteria
Proposal
Notes
The text was updated successfully, but these errors were encountered: