Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/publish-glm53-admission-reserve.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- w4afp8
- hicache-w4afp8
tag:
description: Docker Hub tag; empty derives the per-variant default (glm53-admission-reserve-v10, glm53-hicache-admission-reserve-v10, glm53-pool-clamp-v1, glm53-hicache-pool-clamp-v1, glm53-w4afp8-pool-clamp-v1, glm53-hicache-w4afp8-v1)
description: Docker Hub tag; empty derives the per-variant default (glm53-admission-reserve-v10, glm53-hicache-admission-reserve-v10, glm53-pool-clamp-v1, glm53-hicache-pool-clamp-v1, glm53-w4afp8-pool-clamp-v1, glm53-hicache-w4afp8-v3)
required: false
type: string
default: ''
Expand Down Expand Up @@ -119,12 +119,12 @@ jobs:
hicache-w4afp8)
echo "BUILD_CONTEXT=docker/sglang-glm53-hicache-w4afp8" >> "$GITHUB_ENV"
echo "BASE_DIGEST=sha256:3eccc30709f5719c81084d1264f03ca5354b3059ec4cff62f0c5ff88c309680c" >> "$GITHUB_ENV"
echo "EXPECTED_DOCKERFILE_SHA256=d910a7a2172219292f6196f20d8232c8573de2f412d8eceea3b1202002f43ebf" >> "$GITHUB_ENV"
echo "EXPECTED_PROVENANCE_SHA256=49c6fd3ef72c0bed3991b325361cd2245ed27a3a946a92b95cd9c562ff45585e" >> "$GITHUB_ENV"
echo "EXPECTED_SHA256SUMS_SHA256=d5b4e05f35ebf3f4c84a676161cb1d22953488d91b8f1d394214710d8225fe8a" >> "$GITHUB_ENV"
echo "EXPECTED_DOCKERFILE_SHA256=f5136afd7b9107ad0ca56a1e9c1b5d76633803f34cfcb338e4223592524bbc96" >> "$GITHUB_ENV"
echo "EXPECTED_PROVENANCE_SHA256=720fd00c13ba60c6f01c1de5009772104da5a44fc8ed0429f01502fab9d17b38" >> "$GITHUB_ENV"
echo "EXPECTED_SHA256SUMS_SHA256=2f74f65b9b27a8ea8e0b479ac44b13d289d8bef9f7cab68e3b30ead0a852c2f3" >> "$GITHUB_ENV"
echo "TEST_SCRIPT=/usr/share/nearai/glm53-hicache-w4afp8/test-cpu.sh" >> "$GITHUB_ENV"
echo "EVIDENCE_PREFIX=glm53-hicache-w4afp8" >> "$GITHUB_ENV"
DEFAULT_TAG=glm53-hicache-w4afp8-v2
DEFAULT_TAG=glm53-hicache-w4afp8-v3
;;
*)
echo "Unknown variant: $VARIANT" >&2
Expand Down
25 changes: 19 additions & 6 deletions docker/sglang-glm53-hicache-w4afp8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM docker.io/nearaidev/sglang@sha256:3eccc30709f5719c81084d1264f03ca5354b3059e

ARG BUILD_SOURCE_REVISION
LABEL org.opencontainers.image.title="GLM-5.3 Flash HiCache W4AFP8 engine"
LABEL org.opencontainers.image.description="HCC-safe HiCache engine with admission reserve v10, the W4AFP8 loader fix, the unconditional chunked-prefill pool clamp and the opt-in DSA indexer query split"
LABEL org.opencontainers.image.description="HCC-safe HiCache engine with admission reserve v10, the W4AFP8 loader fix, the unconditional chunked-prefill pool clamp, the opt-in DSA indexer query split, request preprocessing and the multimodal shared-memory copy moved off the HTTP event loop, and an event-loop stall dump"
LABEL org.opencontainers.image.source="https://github.com/nearai/cvm-compose-files"
LABEL org.opencontainers.image.revision="${BUILD_SOURCE_REVISION}"
LABEL org.opencontainers.image.base.name="docker.io/nearaidev/sglang"
Expand All @@ -21,6 +21,9 @@ LABEL nearai.sglang.hcc_managed_memory="v3-host-prefetch-opt-in"
LABEL nearai.sglang.w4afp8_loader_patch="modules-to-not-convert-v1"
LABEL nearai.sglang.chunked_prefill_pool_clamp="v1"
LABEL nearai.sglang.dsa_indexer_qsplit="v1-opt-in"
LABEL nearai.sglang.request_preprocessing_off_loop="pr30771-60a56aa"
LABEL nearai.sglang.mm_shm_wrap_off_loop="v1"
LABEL nearai.sglang.event_loop_stall_dump="v1-on-30s"

COPY Dockerfile \
PROVENANCE \
Expand All @@ -29,18 +32,28 @@ COPY Dockerfile \
apply-patches.py \
chunked-prefill-pool-clamp.diff \
dsa-indexer-qsplit.diff \
event-loop-stall-dump.diff \
modules-to-not-convert.diff \
sglang-pr30771.diff \
shm-off-loop.diff \
source-manifest.json \
test-cpu.sh \
test_stall_dump.py \
/usr/share/nearai/glm53-hicache-w4afp8/
RUN test -n "$BUILD_SOURCE_REVISION" \
&& cd /usr/share/nearai/glm53-hicache-w4afp8 \
&& sha256sum --check --strict SHA256SUMS \
&& python3 apply-patches.py

# The loader and pool-clamp patches are required for the W4AFP8 image and are unconditional. The DSA
# indexer query split is inert unless SGLANG_DSA_INDEXER_QSPLIT=1. Everything inherited from
# the base stays opt-in: admission reserve v10 via SGLANG_CHUNKED_PREFILL_ADMISSION_RESERVE, and
# HiCache via --enable-hierarchical-cache plus SGLANG_HICACHE_*. On an HCC/PPCIe (TEE) host
# SGLANG_HICACHE_CUDA_HOST_MEMORY must stay 1; 0 selects the anonymous-mmap plus cudaHostRegister
# path, which fails with CUDA error 801.
# indexer query split is inert unless SGLANG_DSA_INDEXER_QSPLIT=1. The two event-loop patches are
# unconditional: upstream sglang PR #30771 runs chat template rendering and tokenization in a
# request-preprocessor thread, and shm-off-loop moves the dispatch-time /dev/shm copy of multimodal
# features to its own thread, so /health keeps answering during multi-MB and image-heavy requests.
# The event-loop stall dump is on by default: after 30 s without a loop tick it writes every
# thread's stack to stderr with the prefix [event-loop-stall]. SGLANG_EVENT_LOOP_STALL_DUMP_SECS=0
# disables it; SGLANG_EVENT_LOOP_STALL_DUMP_REPEAT_SECS (default 60) spaces the repeats.
# Everything inherited from the base stays opt-in: admission reserve v10 via
# SGLANG_CHUNKED_PREFILL_ADMISSION_RESERVE, and HiCache via --enable-hierarchical-cache plus
# SGLANG_HICACHE_*. On an HCC/PPCIe (TEE) host SGLANG_HICACHE_CUDA_HOST_MEMORY must stay 1; 0 selects
# the anonymous-mmap plus cudaHostRegister path, which fails with CUDA error 801.
17 changes: 17 additions & 0 deletions docker/sglang-glm53-hicache-w4afp8/PROVENANCE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ patch_3_sha256=37ad31b95511a831038d2ab572656a59d4ba1c9c21348d9fcb0095cba665aad1
patch_3_origin=new in this recipe; lab form validated on gpu31/gpu32 2026-09-24
patch_3_scope=IndexerKPool._get_topk_ragged_kpool_plan only; inert unless SGLANG_DSA_INDEXER_QSPLIT=1 (min rows SGLANG_DSA_INDEXER_QSPLIT_MIN_ROWS, default 1024)
patch_3_evidence=stored long-tier traffic paired TTFT 0.81-0.85x (both island orders), c16384 burst min free 9.5 GB vs 0.65 GB, GSM8K/MMLU/passkey/teacher-forced agreement at the noise floor; gpu31:/data/inference-optimizer-20260913/results/roofline-20260923/fix3
patch_file_4=docker/sglang-glm53-hicache-w4afp8/sglang-pr30771.diff
patch_4_sha256=a102977de7bb02776cee1053ff04979b740526fe99c59d2c63e2f3962df3c95d
patch_4_origin=upstream sgl-project/sglang PR #30771 "fix(frontend): offload blocking request preprocessing" (open, unmerged); byte-identical to the PR diff at head 60a56aa361832a49b771762ecdd1694c9639171b; applies to fc91d24 with line offsets only
patch_4_scope=OpenAIServingBase.handle_request and TokenizerManager._tokenize_texts: request conversion (chat template render + tokenize) and the regular-tokenizer path run in a single-worker request-preprocessor thread instead of on the uvicorn event loop; adds the PR's three CPU tests under test/registered/unit; unconditional, no env var
patch_4_evidence=gpu32 2026-09-25, same source bytes bind-mounted over the fde25985 image: worst /health probe during a 4.7 MB text chat (653,502 prompt tokens) 3,444 ms stock vs 38 ms patched (p95 1.9 ms); prompt_tokens identical on 11 correctness/image cases and 4 large shapes; the PR's tests pass 5/5 patched and fail 3 (2 skipped) on the stock files; gpu32:/data/glm53-dyntok-20260925
patch_file_5=docker/sglang-glm53-hicache-w4afp8/shm-off-loop.diff
patch_5_sha256=4bd4cc65d68deacd1b56b95e32a2242853d20bd3cfa4188e8c1a20777cc79a94
patch_5_origin=new in this recipe (gpu32 lab 2026-09-25)
patch_5_scope=TokenizerManager._send_one_request only: for requests with multimodal inputs, wrap_shm_features (posix_fallocate + copy_ into /dev/shm) runs on its own single-thread executor (sglang-mm-shm) instead of the event loop; a request cancelled during the copy has its segments discarded once the copy finishes; unconditional, no env var
patch_5_stacking=applied after patch 4, whose request-preprocessor setup it extends; tokenizer_manager.py cc4d633d8c609300e095a16ef7fe460e2c3c0e0ad52fcc76e9134d0aee4dff51 (base) -> d32617ee41a0e2e55e8ca6924e45afec4645551b1b87f0171b17818980b78867 (after patch 4) -> 1037bbac2e0183882e3f3c16d6be9492e047ff4b4ce4724f0baba9a3cd46cc4f (after patch 5, the manifest after-hash)
patch_5_evidence=gpu32 2026-09-25. Phase 3a: with patch 4 alone each 64-image request still blocked the event loop once at dispatch, for 3.7 s to over 5.0 s (3.0-4.0 s on the stock arm), in ShmPointerMMData.__init__ (posix_fallocate + copy_ of ~141 MiB per image, 8.8-8.9 GiB per request). Phase 3b, patches 4-6 bind-mounted over the fde25985 image (stall dump at 30 s): worst /health probe 30 / 163 / 551 / 1,258 ms for the 4.7 MB text and the 64 x 9 / 48 / 169 MP requests, 0 of 3,211 probes over 3 s, vs 3,033 / 3,098 / 2,976 / 4,062 ms on the stock arm; the copy runs on sglang-mm-shm_0 while the loop idles; prompt_tokens identical, no /dev/shm leak, no Traceback. The remainder is the GIL-held process_mm_data_async return, untouched here. CPU-only with real ShmPointerMMData (16 x 141 MiB, 32 CPUs): stock inline copy blocks the loop 897 ms, patched longest gap 8.1 ms, a request cancelled mid-copy leaves 0 segments (a plain run_in_executor leaks 16 of 16); test-cpu.sh step 6 checks the executor thread, loop progress during the copy and the discard on cancellation
patch_file_6=docker/sglang-glm53-hicache-w4afp8/event-loop-stall-dump.diff
patch_6_sha256=367dbcdec432586ae4c8ab984c08caafb2f148d62cebf257d12e89c4c32f72ab
patch_6_origin=new in this recipe (gpu32 lab 2026-09-25)
patch_6_scope=new module python/sglang/srt/utils/event_loop_stall_dump.py plus a lifespan hook in entrypoints/http_server.py; diagnostic only, request handling unchanged; on by default: first dump after 30 s without a loop tick (SGLANG_EVENT_LOOP_STALL_DUMP_SECS, 0 disables), repeats every 60 s (SGLANG_EVENT_LOOP_STALL_DUMP_REPEAT_SECS)
patch_6_evidence=CPU-only throwaway containers of the fde25985 image on gpu32: git apply reproduces these after-hashes, import check 6/6, test_stall_dump.py 58/58 (shipped here, test-cpu.sh step 7). Live on GPU engines (gpu32 2026-09-25): at a 2 s threshold, armed at startup, no dump through startup, warmup and 2.5 min idle, and one 64-image request gave 2 dumps naming ShmPointerMMData.__init__ dst.copy_ on the event-loop thread (loop CPU 2.0 s of 2.8 s), then recovered after 5.3 s, about 16 KB per dump; at the 30 s default with patches 4-5, armed and 0 dumps across the text and three 64-image requests. Not yet exercised by the multi-minute hang, which the lab has not reproduced; gpu32:/data/glm53-dyntok-20260925
composition_event_loop=patches 4-6 touch entrypoints/http_server.py, entrypoints/openai/serving_base.py, managers/tokenizer_manager.py, a new utils module and three new test files; none of those is touched by the HiCache patches or patches 1-3. Checked in the real base image 3eccc307 (2026-09-25): serving_base.py=3d0613b92abae51e8566a11ae80a2369a46422b49bd63c4cd6aa593d8a4bdbc2, tokenizer_manager.py=cc4d633d8c609300e095a16ef7fe460e2c3c0e0ad52fcc76e9134d0aee4dff51, http_server.py=553e5d1108dfded05e1693f7a26efd733e297b9ef7b238905e09e52a5e848652 (all equal to fc91d24), the four new paths absent
composition=docker/sglang-glm53-w4afp8 rebased onto the HCC-safe HiCache image instead of the plain admission-reserve image, so a w4afp8 checkpoint and hierarchical caching can run in one engine
composition_safety=all three patch targets are byte-identical in both bases, verified against the real base image rather than assumed: w4afp8.py=21e9c527c9b83e350cdc35ce2bc62891cda1550934b2a5d302f0f807f752f125, schedule_policy.py=02def839ec597d2b141f9d97aace6dc376c047cf670e115e851c86cb875362f0, scheduler.py=6ffd1584f6bcbbd3384f1ec45e3313a7b4b010fd3f900b8f19345d4b02f5d0ba
composition_disjointness=the HiCache patches touch mem_cache/*, disaggregation/* and schedule_batch.py; neither added patch touches any of those files, so source-manifest.json is reused unchanged from docker/sglang-glm53-w4afp8
Expand Down
Loading
Loading