@@ -1253,9 +1253,6 @@ def _sdpa_decode_reduce_kernel(
12531253 tl .store (o_out_ptrs , acc .to (tl .bfloat16 ))
12541254
12551255
1256- _splitk_buf_cache : dict = {}
1257-
1258-
12591256def _launch_decode_splitk (
12601257 query : torch .Tensor ,
12611258 key : torch .Tensor ,
@@ -1278,20 +1275,12 @@ def _launch_decode_splitk(
12781275 num_splits = min (max (triton .cdiv (L_kv , 256 ), 1 ), 128 )
12791276 chunk_size = triton .cdiv (L_kv , num_splits )
12801277
1281- # Cache partial buffers to avoid CUDA allocator overhead per call.
1282- # The split kernel fully writes every entry before the reduce kernel
1283- # reads, so stale data from a previous call is harmless.
1284- buf_key = (num_splits , B , H_q , D , query .device .index )
1285- bufs = _splitk_buf_cache .get (buf_key )
1286- if bufs is None :
1287- bufs = (
1288- torch .empty (
1289- (num_splits , B , H_q , D ), device = query .device , dtype = torch .float32
1290- ),
1291- torch .empty ((num_splits , B , H_q ), device = query .device , dtype = torch .float32 ),
1292- )
1293- _splitk_buf_cache [buf_key ] = bufs
1294- O_partial , L_partial = bufs
1278+ O_partial = torch .empty (
1279+ (num_splits , B , H_q , D ), device = query .device , dtype = torch .float32
1280+ )
1281+ L_partial = torch .zeros (
1282+ (num_splits , B , H_q ), device = query .device , dtype = torch .float32
1283+ )
12951284
12961285 stride_qb , stride_qh , stride_qm , stride_qd = query .stride ()
12971286 stride_kb , stride_kh , stride_kn , stride_kd = key .stride ()
0 commit comments