JuliaGPU / JuliaGPU/oneAPI.jl

Copying HostBuffer is broken

Open
#458 2 comments 0 reactions 0 assignees View on GitHub
bug needs info upstream
Dominant language
Julia
Stars
215
Forks
37
Avg merge
10h 47m
Merged PRs (30d)
14

Description

Device buffers:

```julia
julia> c = oneVector{Int}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.DeviceBuffer}:
1

julia> d = oneVector{Int}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.DeviceBuffer}:
1

julia> Array(c .+ d)
1-element Vector{Int64}:
2
```

Host buffers:

```julia
julia> c = oneVector{Int,oneL0.HostBuffer}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.HostBuffer}:
1

julia> d = oneVector{Int,oneL0.HostBuffer}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.HostBuffer}:
1

julia> Array(c .+ d)
1-element Vector{Int64}:
0
```

Mixed buffers:

```julia
julia> c = oneVector{Int,oneL0.HostBuffer}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.HostBuffer}:
1

julia> d = oneVector{Int,oneL0.DeviceBuffer}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.DeviceBuffer}:
1

julia> Array(c .+ d)
1-element Vector{Int64}:
1
```

On PVC hardware, this triggers an UNKNOWN_ERROR in subsequent command list submissions:

```julia
julia> c = oneVector{Int,oneL0.HostBuffer}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.HostBuffer}:
1

julia> d = oneVector{Int,oneL0.DeviceBuffer}([1])
1-element oneArray{Int64, 1, oneAPI.oneL0.DeviceBuffer}:
1

julia> Array(c .+ d)
Array(c .+ d) = [1]
1-element Vector{Int64}:
1

# synchronize doesn't trap this error
julia> oneAPI.synchronize()

# new command list submissions does
julia> a = oneVector([1])
ERROR: ZeError: unknown or internal error (code 2147483646, ZE_RESULT_ERROR_UNKNOWN)
Stacktrace:
[1] throw_api_error(res::oneAPI.oneL0._ze_result_t)
@ oneAPI.oneL0 ~/oneAPI/lib/level-zero/libze.jl:8
[2] check
@ ~/oneAPI/lib/level-zero/libze.jl:19 [inlined]
[3] zeCommandQueueExecuteCommandLists
@ ~/oneAPI/lib/utils/call.jl:24 [inlined]
```

It's idiotic that the driver doesn't report this earlier...

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the host-buffer and mixed-buffer reproductions on PVC hardware, including the later command-list submission after oneAPI.synchronize(). Trace the HostBuffer and DeviceBuffer handling implicated by those examples; done means host-buffer addition returns the correct value and subsequent submissions do not raise ZE_RESULT_ERROR_UNKNOWN.

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.