[FR] Mixed eltype dot products
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 1.4k
- Forks
- 281
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 30
Description
These don't seem to currently work (CUDA 3.3):
CuVector{Float32}(undef,10) ⋅ CuVector{Complex{Float32}}(undef,10)
CuVector{Float32}(undef,10) ⋅ CuVector{Float64}(undef,10)
# other mixed eltypes, etc...
as they fall back to a generic which triggers scalar indexing. It would be nice to have these implemented, even with a simple sum(conj.(x) .* y) or something, which at least works on GPU.
Maybe worth mentioning, but I didn't really care about these until upgrading Zygote 0.6.11 -> 0.6.12, since a recent change (bisected down to https://github.com/FluxML/Zygote.jl/pull/973) seems to make it so Zygote emits such dot products where previously it wasn't. Here's an example which triggers scalar indexing after that commit but not before:
using CUDA, Zygote, LinearAlgebra
CUDA.allowscalar(false)
x = cu(rand(10))
y = complex(cu(rand(10)))
Zygote.gradient(1) do A
norm(Diagonal(A .* x) * y)
end
Anyway, this isn't really relevant for CUDA.jl, but figured might provide some context.
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 by tracing the dot-product dispatch for mixed-eltype CuVector operands, using the Float32/Complex{Float32} and Float32/Float64 examples in the issue. Run the provided Zygote gradient example with CUDA.allowscalar(false); done means these mixed dot products execute on the GPU without triggering scalar indexing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- hpc
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100