Adding 'debug.compile_mlir` to support compiling a standalone MLIR module through Catalyst pipeline #2832
Open
mehrdad2m wants to merge 11 commits into
Open
Adding 'debug.compile_mlir` to support compiling a standalone MLIR module through Catalyst pipeline #2832mehrdad2m wants to merge 11 commits into
mehrdad2m wants to merge 11 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2832 +/- ##
=======================================
Coverage 97.00% 97.00%
=======================================
Files 167 167
Lines 18875 18908 +33
Branches 1773 1775 +2
=======================================
+ Hits 18309 18342 +33
Misses 420 420
Partials 146 146 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
joeycarter
reviewed
May 13, 2026
Contributor
joeycarter
left a comment
There was a problem hiding this comment.
Wow this is great @mehrdad2m! 🤩
I think this would be a great debugging feature to have, I'm happy to approve if the rest of the team agrees.
Co-authored-by: Joey Carter <joseph.carter@xanadu.ai>
mehrdad2m
commented
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context:
Currently, there was no way to compile and run a standalone MLIR file directly from Python without a full @qjit-decorated function. This could be useful for debugging and also for prototyping an MLIR functionality for which frontend lowering doesn't exist yet. The existing but rather hacky workaround for such use-cases is to use
debug.replace_irto create a dummy MLIR and replace the whole file with the desired one.Description of the Change:
This is essentially a QoL improvement where we add
debug.compile_mlir, which compiles an MLIR string or file through the full Catalyst pipeline and returns a callable CompiledMLIR object. The entry-point function name and output types are supplied explicitly viafunc_nameandresult_types. The result can be called like a regular Python function and passed toget_compilation_stageto inspect intermediate IR.Benefits:
Possible Drawbacks:
Related GitHub Issues: