Skip to main content

Module sddmm

Module sddmm 

Source
Expand description

Sampled Dense-Dense Matrix Multiply (SDDMM).

Computes C_ij = alpha * (A @ B)_ij * spy(S)_ij + beta * S_ij where the result is only computed at positions where the sparse matrix S has non-zero entries. This is a key primitive in graph neural networks and sparse attention mechanisms.

§Strategy

Each thread handles one non-zero entry of S. For that entry at position (row, col), the thread computes the dot product A[row, :] . B[:, col] (inner dimension K), scales by alpha, and blends with the existing value via beta.

Functions§

sddmm
Sampled Dense-Dense Matrix Multiply.