-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create PencilFFTPlan using ROCArray #74
Comments
Without the stack trace, I'm guessing the error comes from this line: in the PencilArrays.jl package. The easy solution would be to remove the |
I did a simple modification: function unsafe_as_array(::Type{T}, x::AbstractVector{UInt8}, dims) where {T}
p = typeof_ptr(x){T}(pointer(x))
unsafe_wrap(typeof_array(x), p, dims, lock=false)
end At least the error message is now different, here's the stack trace:
And this error comes from multiplication |
Thanks for testing. So the More precisely, for in-place transforms, we reuse a single One reason for this failure would be that AMDGPU.jl is missing a definition of You can also try the following script (replacing data = Array{Float64}(undef, 200)
u = reshape(view(data, 1:100), 20, 5)
v = reshape(view(data, 1:40), 10, 4)
Base.mightalias(u, v) # true
Base.dataids(u) == Base.dataids(v) # true If the last line gives You might also get away with removing the failing |
I used test script: using AMDGPU
function test(SomeArray)
data = SomeArray{Float64}(undef, 200)
u = reshape(view(data, 1:100), 20, 5)
v = reshape(view(data, 1:40), 10, 4)
@show Base.mightalias(u, v)
@show Base.dataids(u) == Base.dataids(v)
end
test(Array)
test(ROCArray) Results:
Yes, it seems that AMDGPU.jl is missing the definition found from [CUDA.jl}(https://github.com/JuliaGPU/CUDA.jl/blob/e1e5be2b6bf17f03a367cebeb18c4645e593f80d/src/array.jl#L99): Base.dataids(A::CuArray) = (UInt(pointer(A)),) A modified test script using AMDGPU
Base.dataids(A::ROCArray) = (UInt(pointer(A)),)
function test(SomeArray)
data = SomeArray{Float64}(undef, 200)
u = reshape(view(data, 1:100), 20, 5)
v = reshape(view(data, 1:40), 10, 4)
@show Base.mightalias(u, v)
@show Base.dataids(u) == Base.dataids(v)
end
test(Array)
test(ROCArray) Will now show true, but unfortunately using plan is still not working:
Again, line 26 being |
Thanks, it looks like the Could you try replacing your first modification to function unsafe_as_array(::Type{T}, x::ROCVector{UInt8}, dims::Tuple) where {T}
p = typeof_ptr(x){T}(pointer(x))
unsafe_wrap(typeof_array(x), p, dims, lock=false)
end
unsafe_as_array(::Type{T}, x::ROCVector{UInt8}, N::Integer) where {T} = unsafe_as_array(T, x, (N,)) |
# Reinterpret UInt8 vector as a different type of array.
# The input array should have enough space for the reinterpreted array with the
# given dimensions.
# This is a workaround to the performance issues when using `reinterpret`.
# See for instance:
# - https://discourse.julialang.org/t/big-overhead-with-the-new-lazy-reshape-reinterpret/7635
# - https://github.com/JuliaLang/julia/issues/28980
#=
function unsafe_as_array(::Type{T}, x::AbstractVector{UInt8}, dims) where {T}
p = typeof_ptr(x){T}(pointer(x))
unsafe_wrap(typeof_array(x), p, dims, lock=false)
end
=#
using AMDGPU
function unsafe_as_array(::Type{T}, x::ROCVector{UInt8}, dims::Tuple) where {T}
p = typeof_ptr(x){T}(pointer(x))
unsafe_wrap(typeof_array(x), p, dims, lock=false)
end
unsafe_as_array(::Type{T}, x::ROCVector{UInt8}, N::Integer) where {T} = unsafe_as_array(T, x, (N,)) And the modification Base.dataids(A::ROCArray) = (UInt(pointer(A)),) Now:
So these changes are enough to make things work. |
Awesome! I think it would make sense to contribute the As for the |
There's a version conflict preventing me trying this
|
It's likely a compatibility issue between MPI.jl and AMDGPU.jl. It may be fixed by adding Besides I think AMDGPU.jl needs a version bump to include your |
Any tips on where should I start to fix this...?
The text was updated successfully, but these errors were encountered: