-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce OpenQASM 3 (OQ3) dialect #34
Conversation
QUIR_VariableAssignOp -> OQ3_AssignVariableOp
N.B. `variable_elimination3.mlir` currently failing due to: ``` error: failed to legalize operation 'oq3.assign_cbit_bit' that was explicitly marked illegal ```
Plus some additional clean-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've posted a few comments and questions from my first round of review:
2618837
to
0066495
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Vince, mostly LGTM
- How much work would it be to rename this
qasm
orqasm3
and define this as an MLIR reflection of OpenQASM3 by definition? I think this would make exmaples/code much clearer but it is not strictly necessary. Thoughts @mbhealy / @mhillenbrand / @kitbarton - Is it necessary to separate all of the ops into separate TD files? IMO, there aren't that many. For an example of modern MLIR dialect specifications see https://github.com/llvm/llvm-project/tree/main/mlir/include/mlir/Dialect
- Can we please add an ops.mlir test for the new dialect (similar to https://github.com/Qiskit/qss-compiler/blob/main/test/Dialect/QUIR/IR/ops.mlir) to test the core dialect functionality (its also a great example file).
- When updating our internal targets can we please make sure to add this new dialect to the docs (message me if you don't know where to do this)
Are you referring to the renaming
I based the separation on modern (as of 14.0.6) MLIR. See, e.g., SPIRV dialect (which was largely the influence behind the design implemented here.)
For sure. My oversight here.
Will do--thanks! |
Yes, we can keep as OQ3 as discussed internally. Is it necessary to separate all of the ops into separate TD files? IMO, there aren't that many. For an example of modern MLIR dialect specifications see https://github.com/llvm/llvm-project/tree/main/mlir/include/mlir/Dialect
Thanks for the pointer. This is fine and not a blocker. |
4f5f3d6
to
fb5b14c
Compare
Reviews addressed. Only [potentially] outstanding is if we want @mhillenbrand, @kitbarton, @taalexander, @mbhealy I prefer to take a democratic approach to this. Once decided, I think we are finally ready to LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'm fine with keeping the name of the dialect as it is.
@taalexander Are we g2g? |
If the accompanying PR internally is, otherwise we can't merge until that point. |
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
* `UseVariableOp` -> `VariableLoadOp`
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
clang-tidy review says "All clean, LGTM! 👍" |
@taalexander Ready. |
We introduce the first phase of decoupling our OpenQASM 3 frontend from our QUIR middle-end to define the structure and space for growing our OpenQASM 3 frontend with the means of MLIR.
This is the first phase, migrating only the relevant QUIR
Operation
s to OQ3, leaving QUIR types and attributes as is. Additionally, pattern-matching can be further, more cleanly, separated between QUIR and OQ3, as well as lowering between the two dialects (presently, QUIR and OQ3 go directly to standard dialects).