-
Notifications
You must be signed in to change notification settings - Fork 46
Added mlir_opt property to Qjit #1579
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
Conversation
This test uses the opt tool which will now always print when using the tool=opt option.
This reverts commit ad404b9.
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.
Thanks!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1579 +/- ##
==========================================
+ Coverage 96.45% 96.48% +0.02%
==========================================
Files 80 80
Lines 8584 8592 +8
Branches 827 828 +1
==========================================
+ Hits 8280 8290 +10
+ Misses 247 246 -1
+ Partials 57 56 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Thanks for PR, @mehrdad2m! 🚀
@mehrdad2m Are you rebasing this on Erick's changes? I think that would make more sense then modifying the shared lib class to be able to do nothing. |
well I agree that for the purpose |
Fair, I guess that's the question if we still need |
I see, that's a fair concern. I think now that with Erick's PR, we can call an |
ef5fa8a
to
770fe6a
Compare
…uld mess with a subsequent calls to the compiler
770fe6a
to
d33c327
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.
I would prefer if we didn't add a lot more to the qjit object. But I do find it easier to just access this field to get the MLIR after optimizations. The other approach I see is by passing the output of circuit.mlir
to quantum_opt
. But I also don't like it too much. So 👍
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.
Thanks Mehrdad 🎉
Context:
Currently, if one wants to inspect the intermediate IR, they should use
keep_intermediate=True
alongsideget_compilation_stage
. However, for custom passes or dialects lacking backend support, running the whole compilation pipeline (mlir-opt, mlir-trasnlate, llc) could fail hindering IR inspection. It would be nice if we have an easy way to disable mlir-trasnlate and llc from frontend since what we are interested to inspect is the transformed MLIR IR as opposed to the final binary.Description of the Change:
Introduces a QJIT.mlir_opt property. This property provides access to the optimized MLIR IR after mlir-opt transformations, but before lowering to LLVM IR (skipping mlir-translate and llc). This differs from QJIT.mlir, which only displays the initial, unoptimized MLIR.
Benefits:
Simplifies inspection of optimized MLIR IR.
Possible Drawbacks:
None
Related GitHub Issues: