Skip to content

Add SGLang MACA runtime preload path handling - #2

Open
ghangz wants to merge 3 commits into
MetaX-MACA:mainfrom
ghangz:mengz/maca-runtime-preload-paths
Open

ghangz wants to merge 3 commits into
MetaX-MACA:mainfrom
ghangz:mengz/maca-runtime-preload-paths

Conversation

@ghangz

@ghangz ghangz commented Jun 25, 2026 •

Copy link
Copy Markdown

Summary

  • This change improves MACA runtime preload path handling for SGLang kernel loading, making missing or duplicate runtime library paths easier to diagnose in MetaX GPU validation containers.
  • The implementation is scoped to diagnostics and runtime setup paths used by MetaX MACA validation, so existing non-MACA behavior remains compatible.
  • Main files: sgl-kernel/python/sgl_kernel/load_utils.py, test/registered/unit/kernels/test_load_utils_maca.py

Validation

  • Verified on Gitee.AI MetaX GPU resources in the SGLang/PyTorch MACA validation batch.
  • Branch validation command: python -m pytest test/registered/unit/kernels/test_load_utils_maca.py
  • Pull request text is ASCII-only to avoid encoding issues on web forms and API clients.

Review notes

  • Source branch: ghangz:mengz/maca-runtime-preload-paths
  • Target branch: MetaX-MACA/sglang:main
  • Maintainers can modify this branch if follow-up adjustments are needed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request cleans up debug log messages by removing unicode checkmarks and crosses, and introduces support for the MACA architecture (via the MACA_PATH environment variable) in CUDA home detection and runtime library preloading. It also adds unit tests to verify these new MACA-specific paths. The review feedback suggests converting cuda_home to a Path object internally within _candidate_runtime_library_dirs for robustness, and avoiding the use of clear=True in patch.dict during unit tests to prevent clearing essential environment variables like PATH and PYTHONPATH.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +220 to 225
def _candidate_runtime_library_dirs(cuda_home: Path):
maca_home = os.environ.get("MACA_PATH")
candidate_dirs = [
cuda_home / "lib",
cuda_home / "lib64",
Path("/usr/lib/x86_64-linux-gnu"),
Path("/usr/lib/aarch64-linux-gnu"),
Path("/usr/lib64"),
Path("/usr/lib"),
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the function more robust and adhere to defensive programming practices, convert cuda_home to a Path object internally. This prevents potential runtime TypeErrors if a string is passed instead of a Path object.

def _candidate_runtime_library_dirs(cuda_home: Path):
    maca_home = os.environ.get("MACA_PATH")
    cuda_home = Path(cuda_home)
    candidate_dirs = [
        cuda_home / "lib",
        cuda_home / "lib64",
    ]

def test_find_cuda_home_uses_maca_cu_bridge(self):
with TemporaryDirectory() as tmp_dir:
maca_path = Path(tmp_dir) / "maca"
with patch.dict(os.environ, {"MACA_PATH": str(maca_path)}, clear=True):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using clear=True in patch.dict clears the entire environment, including essential variables like PATH and PYTHONPATH. This can cause unexpected side effects or failures in some test environments. A safer approach is to copy os.environ, explicitly remove CUDA_HOME and CUDA_PATH, set MACA_PATH, and then patch with clear=True using this complete dictionary.

Suggested change
with patch.dict(os.environ, {"MACA_PATH": str(maca_path)}, clear=True):
test_env = os.environ.copy()
test_env.pop("CUDA_HOME", None)
test_env.pop("CUDA_PATH", None)
test_env["MACA_PATH"] = str(maca_path)
with patch.dict(os.environ, test_env, clear=True):

with TemporaryDirectory() as tmp_dir:
maca_path = Path(tmp_dir) / "maca"
cuda_home = maca_path / "tools" / "cu-bridge"
with patch.dict(os.environ, {"MACA_PATH": str(maca_path)}, clear=True):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using clear=True in patch.dict clears the entire environment, including essential variables like PATH and PYTHONPATH. This can cause unexpected side effects or failures in some test environments. A safer approach is to copy os.environ, explicitly remove CUDA_HOME and CUDA_PATH, set MACA_PATH, and then patch with clear=True using this complete dictionary.

Suggested change
with patch.dict(os.environ, {"MACA_PATH": str(maca_path)}, clear=True):
test_env = os.environ.copy()
test_env.pop("CUDA_HOME", None)
test_env.pop("CUDA_PATH", None)
test_env["MACA_PATH"] = str(maca_path)
with patch.dict(os.environ, test_env, clear=True):

@ghangz ghangz changed the title 支持配置 MACA 运行时预加载路径 ?? MACA ?????????? Jun 26, 2026
@ghangz ghangz changed the title ?? MACA ?????????? 强化 MACA 运行时预加载路径解析 Jun 26, 2026
@ghangz ghangz changed the title 强化 MACA 运行时预加载路径解析 Add SGLang MACA runtime preload path handling Jul 1, 2026
- Support MACA runtime preload paths
- harden MACA runtime preload helpers
- Preserve environment in MACA load utils tests
- Isolate MACA load utils environment tests
yangxin-mx pushed a commit that referenced this pull request Dec 2, 2026
将 mx/dev-0.5.19 中与 GLM5Next 相关的迁移及必要修复合并到一个提交,
基于 mx/dev-0.5.21 的 9b491a645e,保留 target 新 CP/API 架构。
按原迁移表顺序核对62条:35条迁移/适配/必要依赖,27条已有覆盖或按表跳过。

迁移/适配明细(编号为原表序号;Source 为真实 source commit):

- #1 Source: 90fc47afb93b52ee2e17db94ff81c70ca355c510
  内容:为 DSA/MHA 分支补 idle 守卫,避免 DP idle batch 误入 MHA 路径。

- #7 Source: ede708204940def467c753ab97f22b098104c8d8
  内容:移植 prefill attention 的 FA2 在线 softmax 归一化和 MACA 非因果128x32调度;按实测
    将大 head_dim 的 MACA tile 缩为32x32,保留非MACA调度。

- #8 Source: 251667008296ead929e477c3d31acfcaaea3822d
  内容:MACA 非因果 attention 的 num_stages 从2降为1,与 FA2 tile 调度配套,降低共享内存需
    求。

- #9 Source: 04827865d580a1bb9b64815fab861e03f2eb2666
  内容:迁移 Hadamard/INT8 GEMM 自定义算子注册;修正 fake out_shape、C 写入声明及 Optional
    bias,保留平台守卫。

- #13 Source: f9d0b9622970734bba00fd3a44aff1a0394bb060
  内容:为 GLM5Next CUDA/XPU 路径补默认模型 dtype;使用 target config view 读取 hf_config
    ,保留用户显式 dtype。

- sgl-project#26 Source: 8a6ae864a3cebad6e272fd2541459a8510eb12f4
  内容:补齐 INT8 MQA 的 triton/tilelang/maca_c 后端选择器及校验,接入 paged、ragged、
    chunked prefill 和 CP 调用;补 GEMM_BF16 开关。

- sgl-project#27 Source: 7b58f8233d38e5469ae211cbf1176e4721817c47
  内容:迁移 W8A8 fused RMSNorm tuple 输入兼容,按 tuple 首项区分旧元数据;保留三维输入支
    持及 MQA 后端校验。

- sgl-project#28 Source: 74505cf936776c09f0786d4b301e1467b031a3d6
  内容:修正 MLA/q_lora 的 fused tuple 元数据识别,补 BF16 passthrough 解包,避免 tuple 进
    入 Tensor 投影路径。

- sgl-project#30 Source: 150bc2fdd022abf7684fc848043f2f0c7d4d45da
  内容:适配 GLM5Next W8A8 ignore mapper 与主模型/vision/NextN prefix;移植 KDA CP×
    attention-TP head 分片和 Mooncake 状态范围/stride/PP-layer 映射。修复新版 KPool
    full-key/local-query 接线、padding、FP8 dtype 及未初始化变量,保留复制状态 CP0 去重。

- sgl-project#31 Source: daf920081d8f65ca1925ccbefc39b6708fcdae02
  内容:迁移 GLM5Next/NextN fused RMSNorm、packed quant 与 mHC input 守卫;packed mHC 无
    residual 时补零并保留返回契约。

- sgl-project#32 Source: 3b81f1f4bc7ae595076ac31c777838ceaa14fc65
  内容:迁移 C500/C550 SplitKV、MACA smem 调度、mcoplib DSA/KDA、CPU token count、ln/log2
    转换、grouped_topk/fake 与 varlen SiLU;适配新增 track_state/inplace_update,修复
    SplitKV 三参数调用兼容。

- sgl-project#33 Source: e24ab0bb93eac50f134466c309b18a76108e8efb
  内容:迁移 FP8 fused norm/activation quant;修复 column_major_scales 传递与 TMA 对齐守卫
    、MLP 融合资格门控和 FP8 consumer tuple 选择,保留目标回退。

- sgl-project#35 Source: 126685db6e84f81eb337df29a06ae47efcb4ab0c
  内容:核验 KPool mcoplib 特性使用模块级 torch 导入,不引入 source 的局部 import 作用域错
    误。

- sgl-project#37 Source: c47a8a23daa1e5779a81ca5172021e582450f7f6
  内容:迁移 logits 显存预算刷新和 empty_cache;补 CUDA graph capture 守卫,避免捕获期间执
    行主机同步/缓存清理,保留 HIP 上限。

- sgl-project#38 Source: 891b2eda664e3a4dbae0f81ffa028087caf0be29
  内容:迁移 mcoplib AOT KPool 路径到 target kernels 目录,完整保留参数;用 EnvBool 处理开
    关,避免值0仍启用。

- sgl-project#39 Source: 9e74fa0504e402507671b703ec6e365728ee3f41
  内容:迁移 MTP metadata glue/seed merge,缺失行补零;保留 DSA/KPool/page/topk 等资格限制
    、静态图输入、eager fallback 及 target future_indices 接口。

- sgl-project#40 Source: 049fc02d18940d4c021281b1b54d4843b3ea0d57
  内容:迁移 MoE sum-add 从 shared_output 到 dispatch/runner/kernel 的接线及 INT8
    quant-once;保留 EP/TP/LoRA/no_combine/graph 回退,修正 shared_experts 属性守卫。

- sgl-project#41 Source: 8f5580f02634c1e6536e6925559f8a2a8f7b9b75
  内容:迁移 KDA BF16 投影融合资格、local N 对齐、加载后 padding 清零及 forward slice;初
    始化非融合分支属性,避免权重加载崩溃。

- sgl-project#43 Source: 1297d124af95d1df6f8c28ee20ee8b7c40177a26
  内容:迁移 optimized FP8 KV QDQ 及 STORE 开关;对 INT8、NoPE、非标准行宽和 rope=None 保
    留通用算子回退,避免全局别名误路由。

- sgl-project#45 Source: b48329742ca890d6d00692d4ea03160db56b661e
  内容:补齐 ragged/prefix-hit selected dequant:新增 GPU mark_selected_kv_rows 和 helper
    ;非法索引置-1,保持静态 shape、row mask、INT8/FP8 支持且无 host sync。

- sgl-project#46 Source: 033598e00ca324e084cdff89a4107f4d3e8e009e
  内容:迁移 TileLang FP8 KV 的 selected-dequant→BF16-kernel 路径,以 pool dtype 判断并保
    留 INT8/TopK 对齐;补显式 MACA FP8 反量化参数例外,保留 NVIDIA/HIP/sink 限制。

- sgl-project#47 Source: 78d6a6d53bf52d938bea469f658be8c561addc6b
  内容:补齐 optimized QDQ 必需的 NoPE 依赖:rope=None/空 rope、528B/656B 行宽派生及
    DIM_ROPE 条件;保留 INT8/其他布局通用回退。

- sgl-project#49 Source: bcca3bc2a68e0e7fab28f826652d14be0118ffd7
  内容:补迁 MX_USE_INDEXER_LOGITS_OPT(默认True)及 MACA FP8 logits 的 maca_c/triton 路由
    ,覆盖 paged、ragged、chunked prefill/CP,保留 INT8 和非MACA行为。

- sgl-project#50 Source: e15a1dd543c0d724b5af3221bde8465d95dfacf1
  内容:迁移 alt-stream 开关、MLA norm consumer 门控和 BF16 passthrough;补齐
    _weights_proj/x_for_gate 旁路,避免多余 FP8 反量化。

- sgl-project#51 Source: 24824a0a86f8e0036ea770377a4a4068b9dbf23e
  内容:按原表移植上游5733bcaad32的 HiCache host-pool 声明,保留 target
    StackStrategy/unified 扩展;补实际 index buffer dtype/宽度探测,修正 BF16 元素/字节
    stride。

- sgl-project#52 Source: caa3b73f5fbd061f19db5d01b422fe727299413e
  内容:迁移 hybrid KV+INDEXER+MAMBA host 栈、owned-layer/PP stage-local 映射、packed draft/sidecar 登记和声明覆盖校验,适配 target controller API。

- sgl-project#53 Source: 69b77095f7141e60070bfe7e53180ab82163574c
  内容:迁移六个 C500 KDA/conv kernel 及包装器;对 target 新
    track_state/inplace_update/beta 语义设置资格守卫与回退,保留 mcoplib 互斥。

- sgl-project#54 Source: 30bedf83aaa4c7127a6caa454cc859bf14d7805e
  内容:迁移 request-shared selected dequant;修正同请求所有 query 共用相同槽的假设,相同
    槽复用、不同 KPool tail 保留独立行,以静态容量/row mask 保证正确性。

- sgl-project#55 Source: eaf4cf1ab6e050e57b1601ba9c81b83ddaede089
  内容:延迟导入 KDA,仅在 Kimi 非NPU或 GLM5Next 路径加载,保留 Ascend 及其他
    linear-attention 后端。

- sgl-project#56 Source: 3687cf0cca0dcb84e031b3ab9565eb71eacaa6c0
  内容:抽出 C500 KDA 轻量配置和延迟导入开关;配套 optional-import 验证材料独立保存在仓库外。

- sgl-project#57 Source: fc708361eee03357f665bc09836a5477d218e2e8
  内容:迁移 mcoplib per_token_cast AOT 注册和 MLP SiLU 列主序 FP8 scale;与#33合并修复列
    主序/TMA 守卫,保留动态/融合/UE8M0 回退。

- sgl-project#58 Source: 9a8d3013dbfce88b219661d8798c7486a8a03a3a
  内容:迁移 MACA 3.10 的 FP8-MMA 能力判定(sm87/88/89 与80/86区分);非原生设备使用
    selected dequant 并补齐 page64,限制在 MACA FlashMLA 路径。

- sgl-project#59 Source: 49b8de76fbdc929bda5c03869c29bdfe37f97cdc
  内容:补迁 config-driven W4A8 QuaRot:主干末端/NextN shared_head 先完成 residual stream
    归约与清理,再 rotation→norm;登记两套 NextN rotation 权重,复用已有算子。

- sgl-project#61 Source: 039732e9a01ad42eba7c04c06c731d344708da1d
  内容:迁移 masked SiLU FP8 mcoplib 算子、FP32 scales 和列主序选项;保留特殊 activation、
    UE8M0 及目标 JIT 回退。

- sgl-project#62 Source: cada5f0f72e860376168544b3ce33ea660317147
  内容:迁移两个 GLM/KPool alt-stream kill-switch;旧 draft handoff wait 已无落点,保留
    target verify plan-stream 的正确性等待,不删除有效同步。

已核验但不重复迁移的条目(不计为新增移植):

- #2 Source: 22cf8d913ac1483bf6fa4b422b4a324b8aacc27a
  处理:target 已有 INT8/FP8/BF16 index cache dtype 配置、存储映射和环境变量,不重复移植。

- #3 Source: 24fd61059835d20f9e0dcd9d1a1cd454c76fe726
  处理:target 新 CP 的 world_group 广播统一解包已覆盖旧 scheduler 修复。

- #4 Source: 18771c6405169ba6a7d0b25f28c467bb47b1321b
  处理:target 通过 extend_seq_lens/input_ids 构建 CP metadata,不恢复旧 global
    token-count 逻辑。

- #5 Source: 2a209dffdd6d19466fb01428c541ab5fff513576
  处理:保留 target GDN chunk-H num_stages 默认2;C550 部署脚本设置为1,避免共享内存超限。

- #6 Source: c54a1a09ebe3f6e025f665a22e1ab6a78053bc05
  处理:target 已有 DSA update_verify_buffers_to_fill_after_draft 钩子。

- #10 Source: 68bfa76e0edbaf39b095e4271ba5d92faa2fe0e7
  处理:target 已有正规 MACA/mcoplib AOT 注册,跳过 source 的临时 sampling 导入注释。

- #11 Source: 385411126ba4a03c28a4c543184374b817fa5bc9
  处理:原表禁止迁移的 bring-up hack 不迁入;保留真实量化、layernorm 和正规 MACA 支持。

- #12 Source: 19061bd747bdb716f750b7fcf293decc915a30bf
  处理:target 已重放 W8A8/KPool dtype 及模型 prefix 基础支持;后续 mapper 兼容修复计入sgl-project#30
    。

- #14 Source: 6e5cf1875bbba5f7bc37118a990f6d60a9ab6146
  处理:target 已有 GLM5.3 主模型/NextN 架构识别、层名与 prefix 适配。

- #15 Source: bb18010c11efdc38c52f14030d1bdd3a11e5592f
  处理:target 已有 INT8 ragged KPool logits 和 dtype 分派,保留新版 CP 实现。

- #16 Source: 0bbba0f8d9261f83f56e901b67be5a0fa9906aa9
  处理:target 已覆盖 MACA head_tile=16 及 INT8/FP8 CP/paged/ragged 分派。

- sgl-project#17 Source: 3ff8eca05fb3830e3fafa7c49ae9a63c03b1dd49
  处理:target 已完成相关 API 重构、KPool dtype 修复与 grouped_topk fallback,不迁回旧接口
    。

- sgl-project#18 Source: 97bac43d8cb9f21f660ea8eb89f5a63edbe597c4
  处理:target 已直接读取 enable_dp_lm_head,消除旧 get_parallel().config 访问。

- sgl-project#19 Source: d5833f123353343c2204d8c0f9953859906c2392
  处理:target 已有 mamba_chunk_size 懒读取,并去除重复 initial_state_indices 参数。

- sgl-project#20 Source: a59e91e76a4207566de6ecf4594de1139364e920
  处理:按原表明确不迁移图像预处理提交;本次 CP 多模态边界修复独立列在适配说明中。

- sgl-project#21 Source: ec70e92a479ea8f1f2ce4bfc32c7f31bf045fd5a
  处理:target 已有 norm_weight=None 时的 mhc_pre_vllm 回退。

- sgl-project#22 Source: 4deb87b34229438f0382687e2ed22f6f8c875227
  处理:target 已覆盖 layernorm AOT bytes、残差别名和 fake 注册,保留其 MACA metadata 守卫
    。

- sgl-project#23 Source: 5feccf7f43420e3db9c40599b8eabc7fed3f0e38
  处理:target W8A8 已支持三维 VLM 输入展平及输出形状恢复。

- sgl-project#24 Source: fb8a2c30228735ce68ba8a90feaefddddad96ee0
  处理:target 已有 INT8 KV 量化/反量化、packed layout、memory pool 及 rope0/64 全栈支持。

- sgl-project#25 Source: 705896cb9e098ecf4778b5d5d2850a9e5e7442fe
  处理:保留 target 更精细的 MACA flashmla_kv 默认选择及 GLM5.3 INT8 例外。

- sgl-project#29 Source: b2bc0c0a198bd7b4eaac14b1d3071a305986f0ac
  处理:target 已有 INT8 属性保护,旧 mamba_branching_seqlen 清理落点已删除。

- sgl-project#34 Source: e9ce0de76ecacb6c3d867b90f9bf1120d2c3d974
  处理:target 不再向只读 logical_size/logical_page_size 赋值,已覆盖 source 修复。

- sgl-project#36 Source: 9e2d4fa7b9657dc8c5bb24e0bfbd302456885d10
  处理:target 已在访问 dtype 前判断 tuple,覆盖 FP8 MoE 崩溃;原表 full hash 有误,本列表
    使用唯一前缀解析后的真实 source commit。

- sgl-project#42 Source: a1a845df4b8f281b243d542ab39b46e754463cc2
  处理:保留 target 新 CP/prefix-cache 框架,不恢复旧 CP-V2/radix bypass;缺口随#30修复并
    验证前缀命中。

- sgl-project#44 Source: 2b20e9a0312dadc751b14ffe4bba7736750bd5b1
  处理:target 新 CP 仅在 context-parallel extend 生效,verify/draft 不进入 CP;保留现有
    padding 框架。

- sgl-project#48 Source: 18b3a7260ed85c95c1a6be87f652b7f89a75c91b
  处理:target 已由 hybrid_kda_config 和 cache_params.is_kda 覆盖模型识别、state
    ring/intermediate_ssm,保留 ReplaySSM。

- sgl-project#60 Source: 7c37c8ed18e9cea67e4a3f7eb564571226d0583b
  处理:target 已重放 GLM5.3 INT8 架构、528B/rope0/64、ragged/paged 和 selected-dequant 支
    持,保留新 metadata/HiCache 接口。

0.5.21 接口适配补充:
- 补 GLM prepare_cp_inputs:CP分片前复用完整多模态embedding,
  runner使用hook返回的positions并保留kwargs,后续PP stage消费proxy。

Change-Id: I5bda468525cc09d9f74598fcdd69d07764b6ecf3
yangxin-mx pushed a commit that referenced this pull request Dec 2, 2026
基于 mx/dev-0.5.21 的 380c6f2474,将 mx/dev-0.5.19 清单中的九项
GLM5Next 功能合并为一个提交,补齐 LM-head TP 子组及运行时修复。
以下编号对应原迁移清单。

逐项移植与目标分支适配

#1  3d1ed14ccf455000a851920afe89c73c288e78c2
FlashMLA 在 MACA 上消费 KPool 尾部时,非 packed KV 索引宽度为
topk + kpool - 1。将支持判断接入目标版 DSA KPool mixin。

#2  2f74b9be043a6e8b4fdc8fd800d3eb18c80bedc0
在目标版 DSV4.1 的 Mega mHC 接口增加 GLM 的 pre=None 模式,融合
attention 输出到 FFN 输入。按 DeepGEMM 实际提供的 INT8、scale 及
pack 接口选择原生打包或软件打包。

#3  773a14a24ed1c34ac66a1e5de1e74a20c23c70ad
将 TileLang mHC pre 与 RMSNorm 融合接到 MHCState。MACA 上在开关开启、
norm 权重为 BF16 且 norm 自身未融合量化时传入权重与 epsilon。

#4  58ff186b6302b76f59567dc631c11c2ae34fb0e1
在 MACA MoE 的 gated SiLU 路径合并激活、乘法及 per-token INT8 量化。
按 W8A8 权重格式、激活 dtype、形状和路由条件选择融合算子。

#6  47d05747a828633e68f31ab9d353e482fb8bc388
按原始投影名判断 KDA W8A8 融合资格。六个量化输入合并投影,
f_b_proj、g_b_proj 使用 BF16;补齐行的权重置零、量化 scale 置一。

#7  ea4320505ad6137485f4f05b48cbe8ea949d66ee
将 GLM 的 LM head 接入词表并行子组。必要前置来自
6da7a53a221dbf738731bd640a59e402a3439ab4:补齐 lm_head_tp_size、
通信组、权重切分、logits、NEXTN 和图捕获缓冲,让 TP16 的 Decode
可以使用 LM-head TP8。

#8  81b0a2c1a0b2fca58741ac5f8235b3481a42fafc
在 MACA 的 FP8 KV + KPool FlashMLA 路径上,将选中行反量化为 BF16,
使用含尾部 token 的索引表。packed 标志按实际输入布局传给内核。

#9  240ccce41f053e1b1fcd490aad0abce7c0c70e55
将 FFN 到下一层 attention 的 Mega mHC 融合接在 ffn_exit.finish()
完成通信的位置。下一层仅在 residual 仍为同一张量时消费预计算结果,
避免行布局变化后误用。空批次及内核无法融合时使用已有边界计算。

#10  dbd4c3c5e90ad3ab2bba6c31e58c1969a31e12e7
接入独立视觉 Encoder。按请求分组视频、切分元数据和 embedding;
Prefill 根据 Encoder 的 grid 与时间信息恢复图像占位区间、逐帧
视频 token 及 M-RoPE 位置。

0.5.21 运行时修复

- NEXTN eager 草稿在 DP/MLP 补齐批次前创建 DSA 元数据。首批 GSM8K
  请求在 kpool_fp8_index.py 触发 assert seq_lens.shape[0] >= batch。
  允许多步 DSA 在形状变化时按步重建,并从 ForwardContext 选取当前
  草稿步的真实后端。
- 独立 Encoder 已返回 embedding 后,Decode 上的 GPU JPEG 解码仍反复
  报 mxkwCreateQueueBlock timeout,单图在 180 秒超时。让 MACA 的
  GLM processor 使用已有 PIL 解码路径,同一题经 E → P → D 返回 A。
- GLM5Next 内置 NEXTN(EAGLE top-k 1)与 Decode radix cache 同开。
  参考 0.5.19 的 0b8f4d829319f45092d5a460fe1402a7b13f85da 和
  fc5b1fa70a7a7d84469f3c58e904587fa0ee895b,按目标版统一 radix tree
  的组件划分实现。树复用页对齐的主模型和草稿 KV,P/D 从命中前缀末尾
  传输缺失的 DSA 索引页。KDA recurrent state 及尚未成页的 DSA 尾部
  按请求从 Prefill 传输;运行和预分配请求分别持有单独状态槽。

C550 验收(11 月 26 日,NEXTN 与 Decode radix cache 同开)

89 单机 Prefill TP8/CP8;90、91 双机 Decode TP16/DP16/EP16,
LM-head TP8。使用原版 Decode 启动脚本及同一份 GSM8K 数据。
- FP8 KV 普通 PD:198/200。全量首轮 1272/1314,同一热服务复跑
  1277/1314(PS1 全量为 1279/1314)。相同 1106-token 请求在
  同一 Decode rank 4 上冷、热运行,每个传输样本的 P→D 平均数据量
  从 230.99 MB 降至 73.71 MB,返回文本一致。
- BF16 KV 双 Mega mHC EPD:198/200;全量 1276/1314。在同一 Decode
  rank 10 上,冷、热传输从 444.24 MB 降至 141.75 MB。MMBench 单图
  第 242 题经 Encoder、Prefill 和 Decode 返回 A,与标签一致,耗时 6.43 秒。
- 两组全量评测均从 1319 条数据中取前 5 条作 few-shot,1314 条计分。

Change-Id: I582b8026c9abf894ce20cfc7abf1e3f8ed56c2a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant