JuliaGPU / JuliaGPU/GPUArrays.jl

`promote_type` on GPU arrays of Float32 and ComplexF32 promotes to UnionAll

Open
#543 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
450
Forks
104
Avg merge
1d 4h
Merged PRs (30d)
10

Description

Hello,

I stumbled over this difference between CPU and GPU arrays:

```julia
julia> using JLArrays

julia> using CUDA

julia> a = rand(Float32, 1); b = rand(ComplexF32, 1);

julia> promote_type(typeof(a), typeof(b))
Vector{ComplexF32} (alias for Array{Complex{Float32}, 1})

julia> promote_type(typeof(JLArray(a)), typeof(JLArray(b)))
JLArray{T, 1} where T

julia> promote_type(typeof(CuArray(a)), typeof(CuArray(b)))
CuArray{T, 1, CUDA.DeviceMemory} where T
```

I've noticed this behaviour originally on CuArrays, but noticed it is also present for JLArrays, so I hope this is the correct repository. I have not been able to test it out on other GPU arrays (yet)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the promote_type results shown for CPU arrays, JLArray, and CuArray, then inspect the GPUArrays.jl array type and promotion entry points. A fix should make Float32 and ComplexF32 GPU array promotion produce a concrete promoted array type rather than a UnionAll, with matching regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.