You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm porting some code to make use of cuda, and we make extensive use of nested base types (ReshapedArrays over possibly Adjointed Views into CuArrays). When I subsequently call axpy!, this results in slow scalar fallbacks.
To reproduce
julia> a =CuArray(rand(10,10));
julia> test =reshape(view(a,2:3,:),10,2);
julia>typeof(test)
Base.ReshapedArray{Float64, 2, SubArray{Float64, 2, CuArray{Float64, 2, CUDA.Mem.DeviceBuffer}, Tuple{UnitRange{Int64}, Base.Slice{Base.OneTo{Int64}}}, false}, Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}
julia>axpy!(true,test,copy(test))
┌ Warning: Performing scalar indexing on task Task (runnable) @0x00007f4ed6614010.
│ Invocation of getindex resulted in scalar indexing of a GPU array.
│ This is typically caused by calling an iterating implementation of a method.
│ Such implementations *do not* execute on the GPU, but very slowly on the CPU,
│ and therefore are only permitted from the REPL for prototyping purposes.
│ If you did intend to index this array, annotate the caller with @allowscalar.
└ @ GPUArraysCore ~/.julia/packages/GPUArraysCore/lojQM/src/GPUArraysCore.jl:90
Expected behavior
No scalar indexing
Version info
Details on Julia:
julia> versioninfo()
Julia Version 1.8.3
Commit 0434deb161 (2022-11-14 20:14 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 12 × Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
Threads: 1 on 12 virtual cores
Common wrappers like Reshape/Reinterpret/SubArray are however so common that we special-case them, by flattening them into CuArray objects. We can however only do that for contiguous views, and your view isn't:
julia> view(a,2:3,:) isa Base.FastContiguousSubArray
false
Describe the bug
I'm porting some code to make use of cuda, and we make extensive use of nested base types (ReshapedArrays over possibly Adjointed Views into CuArrays). When I subsequently call axpy!, this results in slow scalar fallbacks.
To reproduce
Expected behavior
No scalar indexing
Version info
Details on Julia:
Details on CUDA:
The text was updated successfully, but these errors were encountered: