diff --git a/dsv4/kernels/attention/fmha.py b/dsv4/kernels/attention/fmha.py index 4f2cde17..bd2afa7d 100644 --- a/dsv4/kernels/attention/fmha.py +++ b/dsv4/kernels/attention/fmha.py @@ -199,10 +199,13 @@ class FmhaKernel: # and the rest dims become outer modes. Then we index the outer modes with block_idx. q_tiler = cute.slice_(self.qk_mma_tiler, (None, 0, None)) # (128, hd) tC_gQ = cute.flat_divide(mQ, q_tiler) - gQ = tC_gQ[head_cta_idx, None, None] # index head dim, take first M/K tile + print(f"D2 DEBUG: tC_gQ shape={cute.shape(tC_gQ)}") + # tC_gQ has modes: (128, hd, rest...). Rest modes include n_h and trailing dims. + # Need to figure out correct coordinate for head indexing. + gQ = tC_gQ[None, None, head_cta_idx, None] # try different coordinate order c_tiler = cute.slice_(self.pv_mma_tiler, (None, None, 0)) # (128, hd) tC_gC = cute.flat_divide(mC, c_tiler) - gC = tC_gC[head_cta_idx, None, None] + gC = tC_gC[None, None, head_cta_idx, None] else: gQ = cute.local_tile(mQ,cute.slice_(self.qk_mma_tiler,(None,0,None)),(None,None,None)) gC = cute.local_tile(mC,cute.slice_(self.pv_mma_tiler,(None,None,0)),(None,None,None))