JuliaGPU / JuliaGPU/KernelAbstractions.jl
@Const macro raises an error if using `import KernelAbstractions`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 523
- Forks
- 88
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 25
Description
As the title suggests, there is a behaviour discrepancy between import KernelAbstractions and using KernelAbstractions in relation to the @Const macro. The following minimum example demonstrates the issue.
import KernelAbstractions as KA
KA.@kernel function example(KA.@Const(x)) end
# OUTPUT:
# ERROR: LoadError: MethodError: no method matching var"@Const"(::LineNumberNode, ::Module, ::Symbol)
# The function `@Const` exists, but no method is defined for this combination of argument types.
using KernelAbstractions: @Const
KA.@kernel function example(@Const(x)) end
# OUTPUT:
# example (generic function with 4 methods)
A brief search indicates that the issue almost certainly originates from these lines which compare to the literal value Symbol("@Const").
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/macros.jl at the linked lines 21-26 and reproduce the minimal example in Julia using both import KernelAbstractions as KA and using KernelAbstractions: @Const. Trace how the @Const macro is identified in each form; done means the qualified KA.@Const example works without the reported MethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100