icarus112 commited on
Commit
6b28ba2
·
verified ·
1 Parent(s): 8bec152

fix: dD_acc sum via axis=0 not scalar.reshape(1)

Browse files
Files changed (1) hide show
  1. mamba3_patches.py +3 -1
mamba3_patches.py CHANGED
@@ -51,7 +51,9 @@ old = """ dD_acc += tl.dot(
51
  tl.full([1, CHUNK_SIZE], 1, dtype=tl.float32),
52
  dQK_dot_block
53
  ).reshape(1)"""
54
- new = """ dD_acc += tl.sum(dQK_dot_block.to(tl.float32)).reshape(1)"""
 
 
55
  assert old in s, "bwd.py pattern B not found"
56
  s = s.replace(old, new)
57
 
 
51
  tl.full([1, CHUNK_SIZE], 1, dtype=tl.float32),
52
  dQK_dot_block
53
  ).reshape(1)"""
54
+ # tl.sum without axis returns scalar which can't .reshape(1) in triton 3.4.
55
+ # Sum over axis=0 on [CHUNK_SIZE, 1] yields [1] directly.
56
+ new = """ dD_acc += tl.sum(dQK_dot_block.to(tl.float32), axis=0)"""
57
  assert old in s, "bwd.py pattern B not found"
58
  s = s.replace(old, new)
59