Conversation
`@localmem` and `@spawn` expanded to `$KI.localmemory(...)` etc., with the module object in the expression. Expressions containing a module can't be copied with `deepcopy`, which `@kernel` does with its definition, so tools that expand `@localmem` before `@kernel` sees it (e.g. ParallelStencil.jl) failed with "deepcopy of Modules not supported". Interpolate the functions instead, like the other macros do. Assisted-by: Claude Code (Opus 5.5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #840 +/- ##
=======================================
Coverage 79.34% 79.34%
=======================================
Files 24 24
Lines 2091 2091
=======================================
Hits 1659 1659
Misses 432 432 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@localmemexpanded to$KI.localmemory(T, Val(dims)), with theKernelInterfacemodule object in the expression.@spawndid the same forKI.device!,KI.wait_event,KI.synchronize,KI.deviceandKI.record_event.Expressions that contain a module can't be copied with
deepcopy, and@kerneldeepcopies its definition. A kernel whose@localmemwas expanded before@kernelsaw it therefore failed withdeepcopy of Modules not supported. Tools that generate kernels expand macros first: ParallelStencil.jl's@sharedMemdoes, see omlins/ParallelStencil.jl#221.This interpolates the functions instead (
$(KI.localmemory)(...)), as the other kernel-language macros already do (e.g.$__synchronize()).Tests:
@localmemand run on the CPU backend; this failed to load without the fix.deepcopyof an@spawnexpansion.convert.jl's "signed i1 to float". That also fails onmainin my local environment, so it's unrelated.🤖 Generated with Claude Code