Skip to content

feat: emit labeled MLIR at each pipeline stage#308

Open
hedgar2017 wants to merge 1 commit intomainfrom
emit-mlir-stages
Open

feat: emit labeled MLIR at each pipeline stage#308
hedgar2017 wants to merge 1 commit intomainfrom
emit-mlir-stages

Conversation

@hedgar2017
Copy link
Contributor

@hedgar2017 hedgar2017 commented Mar 25, 2026

  • finalize_module returns Vec<(String, String)> with labeled MLIR snapshots at each dialect / pipeline stage
  • --emit-mlir prints all stages (MLIR Dialect sol:, MLIR Dialect llvm:)
  • --output-dir writes per-dialect files ({contract}.sol.mlir, {contract}.llvm.mlir)
  • Standard JSON carries the full labeled list
  • Missing LLVM dialect entry is an explicit error (not silent empty bytecode)

@hedgar2017 hedgar2017 added the ci:slang Trigger slang unit tests on PR label Mar 25, 2026
@hedgar2017 hedgar2017 requested a review from Copilot March 25, 2026 16:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_module to return Vec<(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-core project/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.

@hedgar2017 hedgar2017 self-assigned this Mar 26, 2026
@hedgar2017 hedgar2017 added the ci:sanitizer Trigger sanitizer workflow on PR label Mar 26, 2026
@hedgar2017 hedgar2017 requested review from a team and Copilot March 26, 2026 02:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:sanitizer Trigger sanitizer workflow on PR ci:slang Trigger slang unit tests on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants