Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dynamic bus (JIT) #2545

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Implement dynamic bus (JIT) #2545

wants to merge 4 commits into from

Conversation

georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Mar 13, 2025

With this PR, there is no more .unwrap() on BusSend::static_bus_id() (previously bus_id()) and BusSend::try_match_static().

Note that this will only generate a machine call when the bus ID is "known concrete". Getting there might require branching. To relax this (and require only known, but not concrete), I think we could change Effect::MachineCall to take a symbolic expression instead of a concrete value, but CanProcessCall::can_process_call_fully() still expects a concrete value, which can't easily be changed, so I think this is the best we can do.

@georgwiese georgwiese marked this pull request as ready for review March 13, 2025 14:48
Base automatically changed from dynamic-bus to main March 20, 2025 14:13
@@ -65,7 +65,7 @@ impl<T: FieldElement> BusSend<T> {

/// Returns the bus ID if it is a static number.
/// Sends and receives can be matched by matching the bus ID.
pub fn bus_id(&self) -> Option<T> {
pub fn static_bus_id(&self) -> Option<T> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pub fn static_bus_id(&self) -> Option<T> {
pub fn try_to_static_bus_id(&self) -> Option<T> {

@@ -500,6 +485,12 @@ impl<'a, T: FieldElement, FixedEval: FixedEvaluator<T>> WitgenInference<'a, T, F
) -> Option<AffineSymbolicExpression<T, Variable>> {
Evaluator::new(self).evaluate(expr, offset)
}

pub fn evaluate_to_known_number(&self, expr: &Expression<T>, offset: i32) -> Option<T> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
pub fn evaluate_to_known_number(&self, expr: &Expression<T>, offset: i32) -> Option<T> {
pub fn try_evaluate_to_known_number(&self, expr: &Expression<T>, offset: i32) -> Option<T> {

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.

2 participants