Skip to content

Commit 5d2e6c6

Browse files
Merge pull request #4454 from AI-Hypercomputer:zjiahao/DSA3.2-duplicated-softmax-computation
PiperOrigin-RevId: 949271937
2 parents b46d2af + 359d3e9 commit 5d2e6c6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/maxtext/layers/attention_mla.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,8 @@ def calculate_indexer_loss(
10841084

10851085
# Aggregate heads: [b, h, t, s] -> [b, t, s]
10861086
attention_probs = jnp.sum(attention_probs, axis=1)
1087+
# Force materialization and prevent fusion across this point to reuse the intermediate tensor
1088+
attention_probs = jax.lax.optimization_barrier(attention_probs)
10871089
# L1 normalize aggregated target distribution
10881090
attention_probs = attention_probs / (jnp.sum(attention_probs, axis=-1, keepdims=True) + EPS)
10891091

0 commit comments

Comments
 (0)