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

Unnecessary allocations in Mooncake #427

Open
yebai opened this issue Dec 18, 2024 · 2 comments
Open

Unnecessary allocations in Mooncake #427

yebai opened this issue Dec 18, 2024 · 2 comments
Labels
enhancement (performance) Would reduce the time it takes to run some bit of the code

Comments

@yebai
Copy link
Contributor

yebai commented Dec 18, 2024

Extra allocations (v.s. primal) are Mooncake's most crucial performance limitation. See, e.g., leftmost models of

https://nsiccha.github.io/StanBlocks.jl/performance.html#visualization

where the primal model has zero allocation, while Mooncake allocates 20.

@willtebbutt Is there any known reason beyond #403?

Ref: nsiccha/StanBlocks.jl#3 (comment)

@yebai
Copy link
Contributor Author

yebai commented Dec 18, 2024

cc @nsiccha

@yebai yebai added the enhancement (performance) Would reduce the time it takes to run some bit of the code label Dec 18, 2024
@willtebbutt
Copy link
Member

Thanks for re-running the benchmarks @nsiccha . Per our discussions offline @yebai , I saw a few additional allocations associated to some code involving small-unions when I was sorting out the original performance problem. These plainly aren't as catastrophic as the original problem.

The other thing to say is that you should still expect Enzyme to beat Mooncake in situations involving loops containing cheap operations at each iteration (see #156) -- I suspect this is where the bulk of the performance difference is coming from in this example. I'll do some profiling when I get some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement (performance) Would reduce the time it takes to run some bit of the code
Projects
None yet
Development

No branches or pull requests

2 participants