JuliaArrays / JuliaArrays/ArraysOfArrays.jl

GPU: segmented broadcast/map for scalar-result element ops over device-resident VectorOfArrays

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
46
Forks
9
Avg merge
2d 23h
Merged PRs (30d)
8

Description

Follow-up to #51.

v1.0 added GPU support for both nested-array types: the flat-data / depth API (innersum, innermapreduce, innerreduce, mapat, bcastat, flatview, vecflattened) runs vectorized on device-resident data (with a segmented reduction kernel for VectorOfArrays), and map / broadcast over the element arrays work under allowscalar(false) when a VectorOfArrays' shape information (elem_ptr / kernel_size) is host-resident.

Remaining gap: scalar-returning per-element operations — map(argmin, V), f.(V) where f returns a scalar — when the shape information is also on the device (adapt(CuArray, V)). These fall back to host-side element iteration and hit allowscalar errors.

Suggested fix: a broadcast style / map specialization that lowers such ops to a segmented device kernel (one work item per part, over the flat data), along the lines of StructArrays' always_struct_broadcast(::AbstractGPUArrayStyle) and the existing GPU segmented reduction used by innersum.

ArrayOfSimilarArrays is unaffected — its equal-size elements broadcast and map on device without this.


Filed by an AI assistant (Claude), on request, to re-scope #51.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing GPU segmented reduction used by innersum, the scope in #51, and StructArrays' always_struct_broadcast(::AbstractGPUArrayStyle) example. Trace how scalar-returning map and broadcast behave when elem_ptr or kernel_size are device-resident. Done means these operations use a segmented device kernel without host iteration or allowscalar errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.