In this article
Optimization flags assert properties of the supplied indices; they do not establish those properties or define the intended accumulation policy.
Establish whether every contribution should count
A graph-feature calculation sends several neighbor contributions to the same destination. The JAX array-at reference explains that repeated indexed updates are all applied, while conflicting update order can be implementation-dependent. Choose the intended operator before optimizing it. Adding all neighbor contributions is different from replacing the destination with one neighbor’s value, even if unique-index examples happen to produce the same result.
Choose a CPU reference with matching semantics
The NumPy ufunc-at reference distinguishes unbuffered repeated-index accumulation from ordinary buffered indexed updates. Use the operation that expresses the intended algorithm when preparing a reference. A mismatch between JAX and an incorrectly chosen CPU expression is not evidence of a GPU error. Include repeated destinations in the reference dataset so the test can distinguish inclusion of all contributions from accidental single-write behavior.
Treat optimization flags as assertions
The scatter_add reference documents promises about sorted indices and non-overlapping updates, and warns that the uniqueness promise is not checked. These options do not sort the data or remove duplicates. Only enable a promise when the upstream construction guarantees it. Preserve the proof boundary in the wrapper, especially after filtering or reshaping, where a formerly unique source key may map to the same normalized destination as another entry.
Separate deterministic inclusion from arithmetic order
For floating-point accumulation, including every contribution does not imply identical summation order or bitwise results on all execution paths. Establish an appropriate numerical tolerance and evaluate the consequences for the task. If the operator is replacement rather than accumulation, define how collisions are resolved before using the GPU operation. Nondeterministic choice among conflicting writes is not an acceptable substitute for a business rule that requires a particular record to win.
Verify promises on adversarial index sets
A pilot should include repeated, unsorted and normalized boundary indices with distinguishable update values. Check invariants before launch and verify the final logical result. The guides on parallel reduction order and array memory layout provide related context. An efficient scatter is useful when its input promises are true and its collision policy matches the intended algorithm; a fast launch does not validate either of those conditions by itself.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.