Skip to content

fix: ensure segments are below thresholds#2138

Merged
shuklaayush merged 6 commits into
mainfrom
feat/checkpoint-metered-exec
Sep 16, 2025
Merged

fix: ensure segments are below thresholds#2138
shuklaayush merged 6 commits into
mainfrom
feat/checkpoint-metered-exec

Conversation

@shuklaayush

@shuklaayush shuklaayush commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator

Replace the optimistic execution/segmentation with a checkpointing approach that checkpoints the last trace_height/instret value that is below the thresholds and use these values for the segments. This should make the segmentation more predictable for downstream usage since the segments should satisfy the thresholds (with the only caveat being if segmentation happens when there is no checkpoint to fall back to i.e. if we overshoot the threshold before the first segmentation check)

This requires storing some extra state and results in a higher segment count compared to earlier for the same thresholds. Also makes execution slightly slower since we're doing some extra work now

benchmark run with 0.7B max cells
benchmark run with 1.2B max cells

@github-actions

This comment has been minimized.

@shuklaayush shuklaayush force-pushed the feat/checkpoint-metered-exec branch from 9c55ffc to 88ea52e Compare September 16, 2025 00:11
@github-actions

This comment has been minimized.

@shuklaayush shuklaayush marked this pull request as draft September 16, 2025 00:30
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@shuklaayush shuklaayush marked this pull request as ready for review September 16, 2025 15:52
Base automatically changed from fix/metered-add-program-air to main September 16, 2025 17:34
@shuklaayush shuklaayush force-pushed the feat/checkpoint-metered-exec branch from 21cb0ff to 7fe4ed2 Compare September 16, 2025 17:35
@github-actions

This comment has been minimized.

@nyunyunyunyu nyunyunyunyu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. This's more decent than subtracting DEFAULT_MAX_TRACE_HEIGHT with a random number.

Comment thread crates/vm/src/arch/execution_mode/metered/segment_ctx.rs Outdated
Comment thread crates/vm/src/arch/execution_mode/metered/segment_ctx.rs Outdated

@jonathanpwang jonathanpwang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actual implementation is ok, but you should leave comments explaining the rational about when to use padded versus unpadded and the considerations that went into it

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair (+1 [+0.4%]) 269 322,610 2,058,654 - - -
fibonacci (+298 [+32.6%]) 1,211 1,500,210 (+1047730 [+98.8%]) 2,107,962 - - -
regex (+300 [+11.2%]) 2,972 4,108,483 (+4259282 [+31.8%]) 17,662,886 - - -
ecrecover (-7 [-0.8%]) 887 140,497 2,275,056 - - -
pairing (+277 [+18.6%]) 1,767 1,882,939 (+2125140 [+9.0%]) 25,847,762 - - -

Commit: d0480da

Benchmark Workflow

@shuklaayush shuklaayush merged commit 46bb8d8 into main Sep 16, 2025
44 of 45 checks passed
@shuklaayush shuklaayush deleted the feat/checkpoint-metered-exec branch September 16, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants