From bed1fc4d544c0b18a5d5c9fbfa5b157d6b21748d Mon Sep 17 00:00:00 2001 From: project6-dev Date: Thu, 13 Aug 2026 14:41:40 +0000 Subject: [PATCH] =?UTF-8?q?fix(OOM):=20skip=20flash=5Fattn=5Fvarlen=20duri?= =?UTF-8?q?ng=20profiling=20=E2=80=94=20use=20Q-tiling=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit flash_attn_varlen_func allocates O(n²) temp memory for 4096 dummy tokens during profile_run, causing OOM at gpu_memory_utilization=0.80. BI100_IN_STARTUP_PROFILE=1 env var is already set by patch_worker_startup_profile_guard.py during the synthetic forward pass. Real inference requests still use flash_attn_varlen (much faster). --- qwen3_6_scripts/patch_xformers_sdpa_seq.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qwen3_6_scripts/patch_xformers_sdpa_seq.py b/qwen3_6_scripts/patch_xformers_sdpa_seq.py index 8de1565a..af7037c2 100644 --- a/qwen3_6_scripts/patch_xformers_sdpa_seq.py +++ b/qwen3_6_scripts/patch_xformers_sdpa_seq.py @@ -200,6 +200,10 @@ FALLBACK_METHOD = ''' max_seqlen = max(seq_lens_list) try: + # Skip flash_attn during profiling — OOMs on large dummy batch + import os + if os.environ.get("BI100_IN_STARTUP_PROFILE") == "1": + raise RuntimeError("skip flash_attn during profiling") out = _ixf.flash_attn_varlen_func( q_flat.to(torch.float16), k_flat.to(torch.float16),