Skip to content

upstream backports: hicache/SWA picks + #35017 + ports of open PRs #33988/#22615 (reorg 1/9) - #1

Open
mike-char wants to merge 12 commits into
cai-base-v0.5.17from
cai-pr1-upstream-backports
Open

mike-char wants to merge 12 commits into
cai-base-v0.5.17from
cai-pr1-upstream-backports

Conversation

@mike-char

Copy link
Copy Markdown

Stacked reorg of the CAI sglang fork, part 1 of 9 (parts 7-9 are private, in sglang-internal).

All commits carry -x provenance. Upstream status: already upstream or open upstream PRs.

🤖 Generated with Claude Code

mike-char and others added 12 commits August 26, 2026 14:01
Port of upstream PR sgl-project#33988 (gemma4_mm.py hunk only;
the marlin shape-check renames in that PR do not apply to v0.5.17).

compressed-tensors Gemma-4 checkpoints (e.g.
RedHatAI/gemma-4-26B-A4B-it-FP8-dynamic) exclude the whole vision tower
via the quantization ignore list, but the entries carry the checkpoint
wrapper's '.linear' suffix and unfused q/k/v names, which never match
SGLang's fused modules — so the bf16 vision tower was loaded through
fp8 schemes with garbage scales and produced NaN image features.

Observed blast radius on v0.5.17: the default multimodal warmup request
runs the broken vision path, its NaN KV is cached at the shared <bos>
radix prefix, and every subsequent request greedy-decodes to <pad>.
This also makes --skip-server-warmup insufficient protection for a prod
deployment: any real image request re-poisons the cache.

Upstream issue: sgl-project#24927 (closed, but the fix PR is
still unmerged as of 2026-08-14).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 29a730878ae07cd81ae5504c18a5bc2bb1efa6d0)
Port of unmerged upstream PR sgl-project#22615 (issue sgl-project#22277).

Gemma-4 KV-sharing layers call attention with k=None/v=None and the
triton backend reads K/V straight out of the KV cache. With
--kv-cache-dtype fp8_e4m3 those tensors arrive as fp8 and the extend
kernel dies compiling tl.dot(bf16_q, fp8_k) ('Unsupported rhs dtype').
Convert to the query dtype and apply k/v scales, mirroring what the
non-shared path does at store time.

Validated on MI325x with RedHatAI/gemma-4-26B-A4B-it-FP8-dynamic:
fp8 KV doubles the pool (2.20M full + 1.76M SWA tokens vs 1.11M/891k
bf16) and improves the shared-prefix bench to 31.4/33.6 req/s
(NP=512/2048) vs 28.6/29.9 with bf16 KV; greedy quality unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 9294fcc510d41c4e484c8535fd47d8c0b9e230d4)
…project#33580)

(cherry picked from commit 301a8a09c5e8ab6575a76efb0a55881888044118)
…ressure (sgl-project#33777)

(cherry picked from commit f4f91ef254608f64102fb8cddfcc7a55bffc6c13)
(cherry picked from commit bacab43e9a914513a778dc058dd702443d11abe1)
(cherry picked from commit fede84057fcf579620ef6921e01ed4d8cb1eb09d)
(cherry picked from commit 7b0c65f7e5497167855824f639e20d3aea7517e3)
(cherry picked from commit b9c4c16925ca63802a3debc56cb8bc8015c5ca86)
(cherry picked from commit 41d1b33f12cf3f6dd4057d2e19e50be3485e7e1a)
…sgl-project#34644)

(cherry picked from commit 26627e9)
(cherry picked from commit 53668167ff1334028affe0ffe47423fccbed7b59)
…-project#34607)

(cherry picked from commit 3974b00)
(cherry picked from commit 2a7a56d3df71becd7a031a390a6c4502ba34342f)
…ct#35017)

(cherry picked from commit c34e0793a66eda02e87c36a247389c9457ef369f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants