Skip to content

Add scatter_mul#650

Merged
akihironitta merged 1 commit into
masterfrom
port/scatter-02-mul
May 18, 2026
Merged

Add scatter_mul#650
akihironitta merged 1 commit into
masterfrom
port/scatter-02-mul

Conversation

@akihironitta
Copy link
Copy Markdown
Member

Mul reduction. out=None initializes to ones (multiplicative identity);
out= multiplies into the caller's buffer. CUDA atomicMul lands as a
CAS-loop family in atomics.cuh covering all AT_DISPATCH_ALL_TYPES_AND2
dtypes (int8/16/32/64, Half, BFloat16, float, double). Backward is
(grad_out * out).gather(dim, index) / src, masked with where(src != 0)
to keep gradients zero where src == 0 (mirrors upstream: when one bucket
contributor is 0, the bucket product is 0 so every contributor's gradient
is 0).

@github-actions github-actions Bot added the ops label May 18, 2026
Base automatically changed from port/scatter-01-sum to master May 18, 2026 05:59
Mul reduction. `out=None` initializes to ones (multiplicative identity);
`out=` multiplies into the caller's buffer. CUDA `atomicMul` lands as a
CAS-loop family in `atomics.cuh` covering all `AT_DISPATCH_ALL_TYPES_AND2`
dtypes (int8/16/32/64, Half, BFloat16, float, double). Backward is
`(grad_out * out).gather(dim, index) / src`, masked with `where(src != 0)`
to keep gradients zero where `src == 0` (mirrors upstream: when one bucket
contributor is 0, the bucket product is 0 so every contributor's gradient
is 0).
@akihironitta akihironitta force-pushed the port/scatter-02-mul branch from 0e1d6d2 to 33d92f1 Compare May 18, 2026 06:00
@akihironitta akihironitta marked this pull request as ready for review May 18, 2026 06:00
@akihironitta akihironitta merged commit 884a091 into master May 18, 2026
10 of 11 checks passed
@akihironitta akihironitta deleted the port/scatter-02-mul branch May 18, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant