Modern Apps git

← Modern-Apps.git

ml: gap row-mode sums on all lanes before store

Commit
973a09309b1587aa254035d1d829512139d7fdac
Author
vayun-mathur <[email protected]>
When
2026-10-25 21:52 UTC (1 month ago)
Parents
758a8e7

Diff

library/ml/src/main/rust/shaders/gap.comp
diff --git a/library/ml/src/main/rust/shaders/gap.comp b/library/ml/src/main/rust/shaders/gap.compindex 5382ab26dd..a04488f81b 100644--- a/library/ml/src/main/rust/shaders/gap.comp+++ b/library/ml/src/main/rust/shaders/gap.comp@@ -35,9 +35,11 @@ void row_mode() {     for (uint i = lane; i < elements; i += lanes) {         total += float(arena[plane + i]);     }-+    // Every lane reaches the workgroup reduction: `workgroup_sum` barriers,+    // which a subset of lanes must never enter alone.+    float sum = workgroup_sum(total);     if (lane == 0u) {-        arena[p.out_at + channel] = float16_t(workgroup_sum(total) / float(elements));+        arena[p.out_at + channel] = float16_t(sum / float(elements));     } }