Skip to content

Remove per-launch heap allocation in CPU __run#716

Merged
vchuravy merged 5 commits into
JuliaGPU:release-0.9from
simone-silvestri:ss/fix-run-allocs
Jun 30, 2026
Merged

Remove per-launch heap allocation in CPU __run#716
vchuravy merged 5 commits into
JuliaGPU:release-0.9from
simone-silvestri:ss/fix-run-allocs

Conversation

@simone-silvestri

@simone-silvestri simone-silvestri commented Jun 29, 2026

Copy link
Copy Markdown

the current __run function leads to heap allocation because it boxes the args.
Apparently the problem is with len and rem that are boxed because of being defined inside an if condition which leads to boxing of the whole args. In Oceananigans, these args are typically very large (we can get easily to MB) which in turn leads to a lot of GC getting called.

MWE:

julia> ci = only(code_lowered(KernelAbstractions.__run, NTuple{6, Any}));

julia> !any(e -> occursin("Box", string(e)), ci.code)
false

This is a backport given that KA main switched to POCL,

cc @giordano

Comment thread src/cpu.jl
Add comment to check for thread iteration limits
@giordano

Copy link
Copy Markdown
Contributor

@simone-silvestri you need to merge on top of the remote target branch to get the buildkite pipeline work (that was fixed by #717)

@vchuravy
vchuravy merged commit 49dee88 into JuliaGPU:release-0.9 Jun 30, 2026
49 of 53 checks passed
@simone-silvestri

simone-silvestri commented Jun 30, 2026

Copy link
Copy Markdown
Author

Thanks @vchuravy, can we release a version 0.9.42?

edit: Ah already done! Thanks

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.

3 participants