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

ACIR gen: Handle recursive ACIR calls #4616

Closed
Tracked by #4426
vezenovm opened this issue Mar 21, 2024 · 0 comments · Fixed by #4948
Closed
Tracked by #4426

ACIR gen: Handle recursive ACIR calls #4616

vezenovm opened this issue Mar 21, 2024 · 0 comments · Fixed by #4948
Labels
acir-gen enhancement New feature or request

Comments

@vezenovm
Copy link
Contributor

Problem

With the move to non-inlined ACIR calls we need to appropriately account for a program having multiple returns. Initial work for non-inlining ACIR was started here (AztecProtocol/aztec-packages#5341), however, it is missing recursive calls.

Happy Case

I should be able to recurse non-inlined ACIR functions.

Something like this should be feasible:

fn main(x: u32) {
    assert(fibonacci(x) == 8);
}

#[fold]
fn fibonacci(x: u32) -> u32 {
    if x <= 1 {
        x
    } else {
        fibonacci(x - 1) + fibonacci(x - 2)
    }
}

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@vezenovm vezenovm added enhancement New feature or request acir-gen labels Mar 21, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Mar 21, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 30, 2024
# Description

## Problem\*

Resolves #4616 

## Summary\*

I wrote the initial issue for recursive calls a while ago. I thought I
had an error at the time and that is why I wrote the issue but it looks
to all be working for fibonacci example. This simply adds a test to
validate recursive ACIR calls.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [X] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acir-gen enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant