feat: emit labeled MLIR at each pipeline stage#308
Open
hedgar2017 wants to merge 1 commit intomainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances MLIR observability by capturing and emitting labeled MLIR snapshots for each compilation pipeline stage (e.g., Sol dialect pre-lowering and LLVM dialect post-lowering) across CLI output, --output-dir artifacts, and standard JSON.
Changes:
- Update
solx-mlir::Context::finalize_moduleto returnVec<(dialect, mlir_text)>with per-stage snapshots. - Emit/serialize stage-labeled MLIR in CLI (
--emit-mlir), output directory writing, and standard JSON contract output. - Update downstream consumers (Slang frontend +
solx-coreproject/build structs) to store and use the staged MLIR representation, including an explicit error when the LLVM stage is missing.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
solx/tests/cli/output_dir.rs |
Tightens --output-dir MLIR test to require multiple stage outputs and expected per-dialect filenames. |
solx/tests/cli/emit_mlir.rs |
Updates CLI test expectations to validate labeled stage headers and representative ops per dialect. |
solx-standard-json/src/output/contract/mod.rs |
Changes mlir output field from a single string to an optional labeled stage list. |
solx-slang/src/slang/mod.rs |
Switches Slang frontend to store staged MLIR output into standard JSON. |
solx-mlir/src/context/mod.rs |
Introduces dialect constants and returns labeled MLIR snapshots from finalize_module. |
solx-core/src/project/mod.rs |
Extracts LLVM-stage MLIR for compilation while retaining full stage list for outputs; adds explicit missing-LLVM-stage error. |
solx-core/src/project/contract/mod.rs |
Updates project-level contract representation to store staged MLIR. |
solx-core/src/build/contract/mod.rs |
Prints and writes per-dialect MLIR outputs for CLI and --output-dir; writes staged MLIR into standard JSON. |
solx-core/src/arguments.rs |
Updates CLI help text to reflect emitting MLIR at each pipeline stage. |
1b5d2e8 to
ba63df0
Compare
aee3925 to
3c02eef
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3c02eef to
80b777a
Compare
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.
finalize_modulereturnsVec<(String, String)>with labeled MLIR snapshots at each dialect / pipeline stage--emit-mlirprints all stages (MLIR Dialect sol:,MLIR Dialect llvm:)--output-dirwrites per-dialect files ({contract}.sol.mlir,{contract}.llvm.mlir)