Skip to content

@Const macro raises an error if using import KernelAbstractions #616

@Hamiltonian-Action

Description

@Hamiltonian-Action

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").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions