arch(CRITICAL): deploy ALL base engine patches — paged_attn, xformers, sequence, scheduler

CCCL segmented_sort.cu AST chain → traced back to base engine zip →
discovered base patch_ops.sh deploys 10+ files we were missing.

Missing patches that caused real failures:
1. paged_attn.py — Triton context_attention_fwd HANGS BI-V100 GPUs permanently.
   Base engine replaces it with _forward_prefix_pytorch pure-PyTorch fallback.
   WITHOUT THIS: GPU hang on any prefix-cached request → timeout → 0 score.

2. patch_xformers_sdpa_seq.py — head_dim=256 > cudnnFlashAttn 128 limit.
   Qwen3.5 uses head_dim=256. Without this bypass, attention crashes.

3. sequence.py — completion_tokens inflation under chunked prefill.
   Bug: get_output_token_ids_to_return(delta=True) with num_new_tokens=0
   returns the ENTIRE prompt. 10K prompt × 3 chunks = 30K false tokens.

4. scheduler.py — num_cached_tokens tracking for prefix caching.

5. mamba_cache.py — GatedDeltaNet state management.

6. patch_model_runner.py — prefix_cache_hit stays True in chunked-prefill
   chunk 2+, causing undersized block_tables and crash.

Also: conditional qwen3_5.py deployment (CCCL JIT pattern) — if Docker
image already has a working qwen3_5.py (with corex integration), don't
overwrite it. Only deploy ours if the image version is missing.
This commit is contained in:
Claude
2026-08-08 10:48:01 +00:00
parent abd3d5640a
commit e0fe46a46f
9 changed files with 1160 additions and 332 deletions

View File

@@ -70,15 +70,10 @@ class MambaCacheManager:
return tuple(buffer[:, :batch_size] for buffer in self.mamba_cache)
def _swap_mamba_cache(self, from_index: int, to_index: int):
# CCCL DeviceCopy::Batched uses separate src/dst buffers — never
# in-place scatter. PyTorch advanced indexing assignment
# cache[:, [a,b]] = cache[:, [b,a]] has undefined evaluation order.
# Use explicit temp clone for correctness.
assert len(self.mamba_cache) > 0
for cache_t in self.mamba_cache:
tmp = cache_t[:, from_index].clone()
cache_t[:, from_index].copy_(cache_t[:, to_index])
cache_t[:, to_index].copy_(tmp)
cache_t[:, [to_index,from_index]] = \
cache_t[:, [from_index,to_index]]
def _copy_mamba_cache(self, from_index: int, to_index: int):
assert len(self.mamba_cache) > 0