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

Return groups #372

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

Return groups #372

wants to merge 10 commits into from

Conversation

gabriel-barrett
Copy link
Member

@gabriel-barrett gabriel-barrett commented Nov 6, 2024

This PR allows you to specify chips for group of returns in Lair code. For instance, in the Lurk evaluator, we could create a group for all returns that are errors, like

    let (env_tag, new_env) = call(eval, env_expr_tag, env_expr, env);
    match env_tag {
        Tag::Err => {
            #[group=err]
            return (env_tag, new_env)
        }
        Tag::Env => {
            let (res_tag, res) = call(eval, res_tag, res, new_env);
            return (res_tag, res)
        }
    };
    #[group=err]
    let err = EvalErr::NotEnv;
    return (err_tag, err)

so that it splits the Lurk eval chip into 2 different chips using the same lookup index, minimizing the cost of successful computations

@gabriel-barrett gabriel-barrett force-pushed the return-chips branch 7 times, most recently from ce11eaa to 24e79a7 Compare November 8, 2024 01:22
@gabriel-barrett gabriel-barrett marked this pull request as ready for review November 8, 2024 01:44
@gabriel-barrett gabriel-barrett force-pushed the return-chips branch 5 times, most recently from fe1d0af to 1f4b0e4 Compare November 8, 2024 14:02
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.

1 participant