Skip to content

Assertion failure due to illegal implicit addrspacecast #608

@maleadt

Description

@maleadt

With JuliaLang/julia#53687, ExaTron.jl tests run into an assertion failure due to what I think is a bug in AMDGPU.jl. The problem lies with free!(AMDGPU.Device.HostCallHolder), which compiles the following ccall:

Expr(:foreigncall, Expr(:call, Core.tuple, :(:hipHostFree), AMDGPU.HIP.libhip), AMDGPU.HIP.hipError_t, svec(Ptr{Nothing}), 0, :(:ccall), SSAValue(7), SSAValue(7))

Here, hipHostFree is invoked with a Ptr{Nothing}) (i.e. addrspace(0)) pointer, however, HostCallHolder contains HostCall which results in passing a LLVMPtr{UInt8, AS.Global} (i.e. addrspace(1)) pointer. This kind of implicit address space conversion is illegal, and only happened to work because of the implicit ptrtoint/inttoptr that happened at the ccall boundary because of Julia storing pointers as i64. That is changing in JuliaLang/julia#53687.

It seems like the HostCall struct shouldn't be used as such on the CPU, where it should simply use a Ptr instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghostcall

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions