-
Notifications
You must be signed in to change notification settings - Fork 30
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
APIs, semantics and strategies for ergonomically reducing allocations #55
Comments
It's a good question -- possibly quite a bit? If everything is on the stack (alloca'd), which immutable things usually are in Julia, then there should be no problem other than having to Using the ManualMemory.j trick, you can even have these stack-allocated objects be mutable (e.g.: https://julialang.zulipchat.com/#narrow/stream/137791-general/topic/StaticCompiler.2Ejl/near/270324640). The only limitation is that they have to be statically-sized (i.e., size, or at least an upper bound on size, known at compile time). In principle, you might be able to get this via other paths as well. The other handy thing, if you really want dynamically-sized arrays, is that it's totally fine to directly |
Oh, looks like this may be slightly moot now! https://julialang.zulipchat.com/#narrow/stream/256674-compiler-plugins/topic/StaticCompiler.2Ejl/near/271385050 (edit: PR #58 ) Eliminating GC allocations is still my passion project though 😆 |
Only slightly moot, because there are still use cases for totally eliminating the runtime, so I morally support your passion project! Also I was misunderstanding the purpose of immutable arrays. Immutability in Julia is conflated with stack allocations, and I assumed the same with arrays. It's more the static sizing that's helpful apparently |
Yeah, the way Julia does things currently definitely leads to the conflation of immutability and stack allocation. In principle you don't really even need things to be statically-sized to be stack-allocated (LLVM itself supports dynamically sized |
@tkf gave an example of a trick to get one, but it involved passing a ccallable Julia function pointer (that takes the alloca as an argument) into an |
From Slack:
https://github.com/aviatesk/EscapeAnalysis.jl Should provide analysis to help reason about allocations. That could be fed to custom compiler plugins with the above APIs to elide allocations. Then JET as in #54 could help users squeeze out the last bits left
Edit:
Also https://github.com/RelationalAI-oss/Blobs.jl and https://github.com/JuliaSIMD/ManualMemory.jl
The text was updated successfully, but these errors were encountered: