Skip to content

Passing PermutedDimsArray to kernel #47

@AntonOresten

Description

@AntonOresten

The current implementation of the TileArray constructor tries to take the pointer of an AbstractArray, which for a PermutedDimsArray around a CuArray errors:

julia> pointer(PermutedDimsArray(CUDA.rand(2, 3), (2, 1)))
ERROR: ArgumentError: Illegal conversion of a CUDA.DeviceMemory to a Ptr{Float32}
Stacktrace:
 [1] convert(T::Type{Ptr{Float32}}, mem::CUDA.DeviceMemory)
   @ CUDA ~/.julia/packages/CUDA/FJf6p/lib/cudadrv/memory.jl:16
 [2] convert(::Type{Ptr{Float32}}, managed::CUDA.Managed{CUDA.DeviceMemory})
   @ CUDA ~/.julia/packages/CUDA/FJf6p/src/memory.jl:583
 [3] unsafe_convert(typ::Type{Ptr{Float32}}, x::CuArray{Float32, 2, CUDA.DeviceMemory})
   @ CUDA ~/.julia/packages/CUDA/FJf6p/src/array.jl:464
 [4] pointer(x::PermutedDimsArray{Float32, 2, (2, 1), (2, 1), CuArray{Float32, 2, CUDA.DeviceMemory}})
   @ Base ./abstractarray.jl:1255
 [5] top-level scope
   @ REPL[8]:1

Is this intentional, or a missing method in CUDA / GPUArrays? pointer(parent(A)) works as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions