Skip to content

Hardware-accelerated linear KA index is wrong #346

@simeonschaub

Description

@simeonschaub

Perhaps I'm misunderstanding something, but I would have expected @index(Global) to always be a valid linear index into indices between 1 and 1856400:

julia> using OpenCL, KernelAbstractions

julia> @kernel function foo(count, indices)
           i = @index(Global)
           k = Atomix.@atomic count[] += 1
           indices[k] = i
       end

julia> count, indices = OpenCL.zeros(Int32), CLArray{Int}(undef, 2000000);

julia> foo(OpenCLBackend())(count, indices; ndrange = (18564, 100))

julia> count
0-dimensional CLArray{Int32, 0, OpenCL.cl.UnifiedDeviceMemory}:
1856400

julia> maximum(indices[OpenCL.@allowscalar 1:count[]])
2046084

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions