Skip to content

Revise failure with KernelAbstractions #111

@leios

Description

@leios

I have been playing around with the following code:

module revise_tests
    export vadd

    using KernelAbstractions, CUDA
    if has_cuda_gpu()
        CUDA.allowscalar(false)
    end

    @kernel function vadd_kernel(c, a, b)

        cI = @index(Global)

        c[cI] = a[cI] + b[cI]
    end

    function vadd(c, a, b)
        if isa(c, Array)
            kernel! = vadd_kernel(CPU(), 8) 
        else
            kernel! = vadd_kernel(CUDADevice(),256)
        end
        kernel!(c, a, b, ndrange=size(c)) 
    end

end # module

If I do

julia> a = ones(100)
julia> c = zeros(100)
julia> revise_tests.vadd(c, a, a)
KernelAbstractions.CPUEvent(Task (done) @0x00007f673bfd2710)

c is correctly a set of 100 2s. If I modify the line above such that c[cI] = a[cI] + b[cI] is now c[cI] = a[cI] + 2*b[cI] (or somethign similar, I get the following error:

julia> revise_tests.vadd(c, a, a)
ERROR: MethodError: no method matching vadd_kernel(::KernelAbstractions.CPU, ::Int64)
Stacktrace:
 [1] vadd(::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}) at /home/leios/projects/revise_tests/src/revise_tests.jl:18
 [2] top-level scope at REPL[7]:1
 [3] run_backend(::REPL.REPLBackend) at /home/leios/.julia/packages/Revise/BqeJF/src/Revise.jl:1184
 [4] top-level scope at REPL[2]:0

As a note, changing the kernel names seems to be fine. If we %s/vadd_kernel/check/g, Revise does know the code is changed.

I don't mind poking around a bit, but do not really know where to look.

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