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

Add @check_allocs macro to enforce allocation checks #34

Merged
merged 1 commit into from
Nov 15, 2023
Merged

Conversation

topolarity
Copy link
Member

@topolarity topolarity commented Nov 14, 2023

This allows a user to enforce that a function will not be called with any set of arguments that would trigger unbounded allocation in its body:

@check_allocs energy(x) = sum(abs2.(x))

@check_allocs function pythag(a, b, c)
    return a^2 + b^2 + c^2
end

const inplace_sum = @check_allocs (x, y) -> x .= x .+ y

TODO:

  • Add allocation check to the pipeline
  • Add tests for all of the different function syntaxes

Resolves #30

@topolarity topolarity added this to the Public MVP milestone Nov 14, 2023
@topolarity topolarity linked an issue Nov 14, 2023 that may be closed by this pull request
This allows a user to enforce that a function will not be called with
any set of arguments that would trigger unbounded allocation in its
body:

```julia
@check_allocs energy(x) = sum(abs2.(x))

@check_allocs function pythag(a, b, c)
    return a^2 + b^2 + c^2
end

const inplace_sum = @check_allocs (x, y) -> x .= x .+ y
```
@topolarity topolarity force-pushed the ct/macro branch 2 times, most recently from 18d53e2 to a26b120 Compare November 15, 2023 18:33
@topolarity topolarity marked this pull request as ready for review November 15, 2023 18:33
@topolarity topolarity requested a review from gbaraldi November 15, 2023 18:34
@topolarity topolarity force-pushed the ct/macro branch 3 times, most recently from cdb0058 to 642e7fd Compare November 15, 2023 18:49
@topolarity topolarity force-pushed the ct/macro branch 2 times, most recently from b74f483 to 969c626 Compare November 15, 2023 21:28
@topolarity topolarity merged commit 4235499 into main Nov 15, 2023
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.

Pipeline discrepancies + Inference instability under recursion
2 participants