Skip to content

Conversation

@Nashtare
Copy link
Contributor

@Nashtare Nashtare commented Oct 14, 2025

Following the discussion we had highlighting the current issues of having to provide all necessary inputs for non-primitive ops to the CircuitRunner before the actual run, here's my attempt at simplifying the barrier between Primitive vs NonPrimitive ops, as well as allowing a custom execution context for non-primitive ops to alleviate the issue above.

For now the way we pass private witness data is unchanged, but this should also ease a transition towards automatic handling at runtime, so that users don't need to pre-generate specific data for each instance of their non-primitive ops.

Main changes:

  • merged all operations together, renaming Prim to Op to reflect it
  • expression lowering now handles both kinds, although it outputs separate vectors for convenience (for future optimization passes and for faster iteration when filling up auxiliary traces)
  • mapped to the (new) Expr::NonPrimitiveOp is an Op::NonPrimitiveOpWithExecutor, which contains
    • inputs (as Vec<ExprId>)
    • outputs (as Vec<ExprId>)
    • an associated ExprId (unlike the initial design not assigning any to non-primitive operations)
    • an executor, which defines custom logic specific to the operation to interact with the runner (so that it can get/set witnesses, execute its own internal logic and interact with private data (if needed))

There is still more work to allow for proper dynamic dispatch at runtime with minimum disruption but this isn't the main goal of this PR so I'd rather hold off any other changes.

@Nashtare Nashtare moved this from Todo to Ready for review in Plonky3 Recursion Oct 14, 2025
…odular tables, align Op-based runners and MMCS trace builder, fix hash ops and executors.
@github-project-automation github-project-automation bot moved this from Ready for review to Ready to be merged in Plonky3 Recursion Oct 23, 2025
@sai-deng sai-deng merged commit 4bd1ea7 into main Oct 23, 2025
8 checks passed
@sai-deng sai-deng deleted the robin/prim_refactoring branch October 23, 2025 23:29
@github-project-automation github-project-automation bot moved this from Ready to be merged to Done in Plonky3 Recursion Oct 23, 2025
nguyenthingot1973v-spec

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants