Skip to content

Copying HostBuffer is broken #458

@maleadt

Description

@maleadt

Device buffers:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds infoFurther information is requestedupstreamOut of our hands.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions