[Bugfix][Model] Fix DiffusionGemma silently freezing attention mask under CUDA graph replay (#51994)

Signed-off-by: Fabian Joswig <fjosw@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Fabian Joswig
2026-09-30 05:34:26 +00:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 329e6eee3f
commit 1117140edb
3 changed files with 15 additions and 8 deletions
+5 -1
View File
@@ -987,7 +987,11 @@ class FlashAttentionMetadataBuilder(AttentionMetadataBuilder[FlashAttentionMetad
scheduler_metadata = self._store_scheduler_metadata(scheduler_metadata)
if isinstance(causal, torch.Tensor) and causal.dtype != torch.int32:
causal = causal.to(torch.int32)
raise ValueError(
f"Per-request causal tensor must be int32, got {causal.dtype}. "
"Casting here would allocate a fresh tensor each build() and "
"break FULL CUDA graph replay; allocate the buffer as int32."
)
attn_metadata = FlashAttentionMetadata(
num_actual_tokens=num_actual_tokens,
@@ -217,7 +217,7 @@ def kernel_unified_attention(
SLIDING_WINDOW: tl.constexpr, # int
USE_CAUSAL: tl.constexpr, # bool
USE_PER_SEQ_CAUSAL: tl.constexpr, # bool
per_seq_causal_ptr, # [num_seqs] bool, or None
per_seq_causal_ptr, # [num_seqs] int32, or None
USE_MM_PREFIX: tl.constexpr, # bool
MAX_MM_RANGES: tl.constexpr, # int
mm_prefix_range_ptr,