Repository navigation
Improve compiler driver tool stages [1/3] - #3402
Merged
Merged
Conversation
The separate stages now allow invoking the Catalyst CLI with a precise target: - starting MLIR (implicitly since it's input) - final MLIR - starting LLVM - final LLVM - object code
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3402 +/- ##
==========================================
- Coverage 96.23% 96.22% -0.01%
==========================================
Files 177 177
Lines 21638 21639 +1
Branches 2169 2168 -1
==========================================
- Hits 20824 20823 -1
- Misses 629 630 +1
- Partials 185 186 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mehrdad2m
approved these changes
Oct 28, 2026
Co-authored-by: Mehrdad Malek <39844030+mehrdad2m@users.noreply.github.com>
dime10
added a commit
that referenced
this pull request
Oct 28, 2026
This is PR 3 of 3 to improve and fix the Catalyst CLI interface pertaining to stage selection and output production. It also builds on PR #3391 to provide an accessible way of running compilation to a particular stage for testing and benchmarking. In this PR, the `target` selection feature for AOT compilation is fixed to properly select the appropriate stage, even when that stage is not controlled from the frontend (like jaxpr/mlir generation or linking is). In particular: - `target="llvmir"` now correctly stops after the translation step from MLIR to LLVM IR, which previously wasn't possible (see follow up recorded here: #3391 (comment)) - new targets "llvmir_opt" and "object" further provide access to the internal stages of the catalyst compiler (exposed in #3402 and #3403) Additional, some cleanup on previous changes in the series is performed: - The obsolete second "llvm_ir" return value from internal compile functions is removed, such that there is always exactly one result. - In order to prevent invalid state from being returned by the `.llvmir` accessor, the cache attribute `.llvm_ir` is removed from the class. While this means the textual llvm ir needs to be regenerated upon each inspection, this is inline with the other IR accessors (`.mlir` and `.mlir_opt`) and leaves the door open to overhaul these together in future work. --- assisted by Astra
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.
This is PR 1 of 3 to improve and fix the Catalyst CLI interface pertaining to stage selection and output production, which is inflexible and even non-sensical at times (e.g., generating object code via the cli requires specifying an output file for the llvm ir via
-o, which should not only be unrelated, but also isn't even written to unlesskeep-intermediateis also specified).In this PR, the LLVM stages are split up into separate
llvm-optandllctools, responsible for running our LLVM IR pass pipeline and LLVM's object code generation pipeline, respectively. Additionally, the--toolis extended to accept aggregate "tools" as well in order to easily run compilation to a certain point without requiring separate invocations.assisted by Astra