JuliaGPU / JuliaGPU/KernelAbstractions.jl

Illegal memory access was encountered

Open
#91 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
523
Forks
88
Avg merge
1d 11h
Merged PRs (30d)
25

Description

The following code
```
using KernelAbstractions
using CuArrays

struct S{FT}
dummy1::FT
dummy2::Int
x::FT
end

@kernel function kernel!(s::S, a, b, dummy3, dummy4)
sin(s.x)
@inbounds a[1] = b[1]
end

let
FT = Float32

a = CuArray(zeros(FT, 1))
b = CuArray(ones(FT, 1))

s = S{FT}(FT(1), 1, FT(1))

device = CUDA()
event = kernel!(device, 1, 1)(s, a, b, FT(0), true)
wait(event)
end
```
fails with `CUDA error: an illegal memory access was encountered` on Julia 1.3.1 (seems to work fine on 1.4.1). Further observations that may or may not be helpful when debugging:
- it works with `FT = Float64`
- it matters that `dummy2` is an `Int` and `dummy4` is a `Bool`
- the argument order of `kernel!` is important, if the dummies come before `a` and `b` it also works

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the minimal kernel! reproducer in the issue and compare its behavior on Julia 1.3.1 and 1.4.1. Vary FT, the Int and Bool fields, and the kernel argument order as reported, then trace the generated GPU kernel or launch arguments. Done means the reproducer no longer produces an illegal memory access for the failing combination.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.