JuliaDiff / JuliaDiff/ChainRules.jl
Pullback for `tr` produces a CPU `Diagonal` causing downstream scalar indexing on GPUs
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 475
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
Functions like tr(A * B) will throw scalar indexing issues in the pullback for * when A and B are CuArrays. This is because the pullback for tr creates a Diagonal which will cause downstream matrix multiplies to hit the LinearAlgebra definition.
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 in src/rulesets/LinearAlgebra/dense.jl at the pullback for tr, then reproduce tr(A * B) with CuArray inputs to observe the scalar-indexing failure. Trace how the returned Diagonal reaches downstream matrix multiplication; done means the pullback works for GPU arrays without producing a CPU Diagonal or triggering scalar indexing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100