Assertion failure due to illegal implicit addrspacecast
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 344
- Forks
- 79
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 27
Description
With https://github.com/JuliaLang/julia/pull/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 https://github.com/JuliaLang/julia/pull/53687.
It seems like the HostCall struct shouldn't be used as such on the CPU, where it should simply use a Ptr instead.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with free!(AMDGPU.Device.HostCallHolder), the HostCall type, and the ccall expression shown in the issue; compare the pointer address spaces used on CPU and GPU paths. Reproduce the assertion with the ExaTron.jl tests and use the linked failure log to confirm the illegal implicit addrspacecast is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- hpc
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100