File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -323,6 +323,12 @@ def apply_mask(
323323 col_limit_right = row_idx + local_row_offset_right
324324 else :
325325 col_limit_right = self .tile_n
326+ if const_expr (self .dynamic_causal is not None ):
327+ col_limit_right = (
328+ row_idx + causal_row_offset
329+ if self .dynamic_causal
330+ else col_limit_right
331+ )
326332 if const_expr (mask_seqlen ):
327333 col_limit_right = cutlass .min (col_limit_right , seqlenk_col_limit )
328334 col_limit_left = (
@@ -382,6 +388,17 @@ def mask_gen_fn(s: int) -> Uint32:
382388 else 0
383389 )
384390 )
391+ if const_expr (self .dynamic_causal is not None ):
392+ causal_row_limit_top = (
393+ self .tile_m
394+ if col0 >= seqlenk_col_limit and mask_seqlen
395+ else col0 - causal_row_offset
396+ )
397+ row_limit_top = (
398+ causal_row_limit_top
399+ if self .dynamic_causal
400+ else row_limit_top
401+ )
385402 row_limit_bot = (
386403 col0 - causal_row_offset + self .window_size_left
387404 if const_expr (self .window_size_left is not None )
You can’t perform that action at this time.
0 commit comments