feat(mlir): enable the spill-retry protocol for the MLIR pipeline - #653
feat(mlir): enable the spill-retry protocol for the MLIR pipeline#653abinavpp wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the MLIR-based compilation pipeline to support the spill-retry protocol by keeping memoryguard symbolic through MLIR lowering and then folding it into a constant in the LLVM module before LLVM optimization runs.
Changes:
- Updates the MLIR
convert-yul-to-stdpass binding and usage to keepmemoryguardsymbolic via a newsymbolic_mem_guardparameter. - Adds a pre-optimization fold step in the EVM codegen context to rewrite
llvm.evm.memoryguardcalls into constants based onspill_area_size. - Updates Sol dialect array type construction stub to the newer API shape (optional fixed-size vs dynamic).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| solx-mlir/src/ffi.rs | Updates the MLIR pass FFI binding to accept symbolic_mem_guard. |
| solx-mlir/src/context/mod.rs | Uses the new pass constructor and documents symbolic memoryguard behavior in the pass pipeline. |
| solx-mlir/sol_attr_stubs.cpp | Updates Sol dialect ArrayType construction to use an optional size representation. |
| solx-core/src/project/contract/mod.rs | Folds symbolic memoryguard in the MLIR→LLVM path before running optimization/codegen. |
| solx-codegen-evm/src/codegen/context/mod.rs | Introduces fold_memory_guard to rewrite llvm.evm.memoryguard into constants and capture the guard value. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Coverage Summary
|
2f831d3 to
e43f9a2
Compare
|
The delta is one file, Measured with the two commits cherry-picked onto |
|
Correction to the tally above, after rebasing the MLIR side onto current Baseline and branch are now identical: 10247 passed / 241 failed / 474 invalid, same failing set - so this PR's tester delta is 0. The +4 I reported was not this PR. It came from solx-llvm So the corpus currently contains no test whose outcome depends on the retry path. What the fix buys is still real, just unobservable here: under the pre-dispatch-table MLIR that file was the demonstration (corrupted arrays -> pass), and the hand-written spill inputs behave correctly (reload reuse and the return buffer land at G+S, a non-spilling contract keeps FMP at 0x80). Cost is nil: a sequential sweep of |
14877f9 to
935e266
Compare
hedgar2017
left a comment
There was a problem hiding this comment.
LGTM, but please get merged LLVM first.
935e266 to
db4030d
Compare
Only -1 means dynamic; any other negative size silently produced a dynamic array type.
The MLIR pipeline keeps the memoryguard symbolic through the conversion, and the EVM backend's evm-fold-memory-guard pass folds it and publishes the spill region's base, so the retry no longer places the region under the heap.
db4030d to
cf298a4
Compare
The pipeline needs evm-fold-memory-guard, which the pinned revision predates.
cf298a4 to
c72be44
Compare
NomicFoundation/solx-llvm#142