Commit Graph

412 Commits

Author SHA1 Message Date
Claude
0eab333fb0 Revert "fix(CRITICAL): remove xformers patches — Sub168 proves base ixformer attention works at 11.9 TPS, our patches reduced to 2.6 TPS"
This reverts commit a8b16da5da.
2026-08-11 02:33:49 +00:00
project6-dev
87a19d2d00 feat(CRITICAL): 从 GitHub 扫描搬运 ixformer SDK + xllm 完整 GDN/MoE 代码
来源:
  1. Chranos/ixformer (GitHub) → ixformer_sdk/ (230 files, 70K lines)
     - inference/functions/vllm.py: vllm_moe_topk_softmax 完整实现 (2033 lines)
     - inference/functions/moe.py: MoE ops 完整实现 (1380 lines)
     - contrib/vllm_flash_attn/: FA2 Python 接口 (1018 lines)
     - contrib/tgi/fused_moe.py: TGI fused MoE (429 lines)
     - csrc/include/ixformer/: C++ kernel headers + cmake

  2. Deep-Spark/xllm (GitHub) → upstream_ref/xllm_latest/ (+15 files)
     - npu_torch/qwen3_5_decoder_layer_impl.cpp/.h
     - npu_torch/qwen3_5_gated_delta_net.cpp/.h
     - npu_torch/qwen3_next_*.cpp/.h (6 files)
     - npu_torch/attention.cpp/.h + fused_moe.cpp/.h + CMakeLists.txt
     - models/llm/qwen3_5.h + qwen3_5_mtp.h + qwen3_next.h
     - models/vlm/qwen3_5.h

调用链完整性:
  ixformer_sdk/inference/functions/vllm.py
    → ops.infer.moe_topk_softmax() (C++ 层)
    → 这就是 base 镜像 libixformer.so 里的实现

  upstream_ref/xllm_latest/core/layers/ilu/fused_moe.cpp
    → ixformer::infer::topk_softmax() (直接 C++ 调用)
    → ixformer::infer::group_gemm() → 完整 7-step MoE pipeline
2026-08-11 02:32:06 +00:00
Claude
a8b16da5da fix(CRITICAL): remove xformers patches — Sub168 proves base ixformer attention works at 11.9 TPS, our patches reduced to 2.6 TPS
Root cause of Sub 520 output_tps=2.6 (vs Sub 168 output_tps=11.9):
- patch_xformers_sdpa_seq.py replaces ixformer flash attention with
  pure PyTorch O(L^2) matmul+softmax serial implementation
- 32 full attention layers x every token = 4.6x slower

Sub 168 (base image) proof:
- output_tps_avg=11.9, output_tps_p50=13.0, output_tps_p90=18.1
- XFormers backend used WITHOUT any patches
- ixformer flash_attn works correctly on BI-V100

This commit: skip xformers patches in patch_ops.sh
Expected: output_tps should recover to ~11.9 (Sub 168 level)
2026-08-11 02:31:29 +00:00
project6-dev
0478628f17 fix(PROVEN): _moe_C compiles and runs on real BI-V100 hardware
Tested on real machine (cc-b2042074, BI-V100, IX-ML 3.2.3):
  _moe_C.topk_softmax() → SUCCESS, correct output

Two fixes proven on hardware:
1. cuda_compat.h: WARP_SIZE=64 (BI-V100 warp is 64, not 32)
2. topk_softmax_kernels.cu: cub/block/block_reduce.cuh instead of cub/cub.cuh
   (cub.cuh pulls radix_sort which has WARP_SIZE conflict)

Key finding: ixformer SDK on this base image does NOT have topk_softmax.
The ixformer::infer namespace from xllm's ixformer.h is for newer SDK.
We MUST compile our own _moe_C kernel — which now works.

Build flags (clang 16, ivcore10):
  CUDA: -O3 -cl-fast-relaxed-math (NOT --use_fast_math)
  C++:  -O2 -std=c++17

Dockerfile simplified: 3 steps (was 6)
_custom_ops.py: _moe_C as Priority 0, in-place vllm API
2026-08-11 01:50:48 +00:00
project6-dev
1cd8ca0649 fix(CRITICAL): align patch_ops.sh with comp 168 — keep base qwen3_5.py + upstream搬运
patch_ops.sh v2: conditional model layer deployment
搬运: moe_combine.cu, moe_compute_index.cu, fused_moe_xllm.cpp,
      qwen3_gated_delta_net_base.cpp/.h, ilu_layer_fused_moe.h, ilu_layer_attention.h
2026-08-11 01:35:20 +00:00
project6-dev
56146f8130 feat(CRITICAL): ix_bridge call chain + upstream xllm/ds_vllm sync
3 changes that close the MoE performance gap:

1. _custom_ops.py: Add ix_bridge as Priority 0 for topk_softmax
   - Before: tries our .cu kernel (fails) → PyTorch fallback (1-3 TPS)
   - After: tries ix_bridge → ixformer::infer::topk_softmax() → FAST
   - Call chain: _custom_ops.topk_softmax() → ix_bridge.topk_softmax()
     → ix_moe_bridge.so → ixformer::infer::topk_softmax()

2. Dockerfile: Add ix_moe_bridge.cpp precompile step
   - This was the missing link: code existed but was never compiled
   - Uses torch.utils.cpp_extension.load() to link against libixformer.so

3. upstream_ref sync from GitHub (cloned, not rewritten):
   - xLLM-AI/xllm: ILU kernels + CUDA MoE + GDN fp32 state mgmt
   - Deep-Spark/vllm: latest MoE kernel sources
2026-08-11 01:27:33 +00:00
root
26e6cb4019 update subrizhi 2026-08-11 01:22:31 +00:00
project6-dev
db8e677b45 fix(CRITICAL): copy_blocks Tensor→dict conversion for ixformer vllm_copy_cache
ixformer's vllm_copy_cache (functions/vllm.py:249) iterates block_mapping
with .items() expecting a dict {src: [dst_list]}. But vllm 0.6.3 passes
a Tensor of shape [N,2]. Convert before calling.

Error: 'Tensor' object has no attribute 'items'
at ixformer/functions/vllm.py:249 in vllm_copy_cache
2026-08-10 15:12:52 +00:00
project6-dev
96a4afba43 fix(CRITICAL): copy_blocks → vllm_copy_cache, swap_blocks → vllm_swap_blocks
ixformer.functions exposes vllm_copy_cache and vllm_swap_blocks,
NOT copy_blocks/swap_blocks. Wrong function names crash engine
when prefix cache starts copying KV blocks (~9 min into eval).

Error was: AttributeError: module 'ixformer.functions' has no attribute 'copy_blocks'
at _custom_ops.py:1145 in copy_blocks
2026-08-10 14:24:39 +00:00
project6-dev
539d0fc6ff fix(CRITICAL): deploy paged_attn.py — NameError context_attention_fwd kills engine on first request
Root cause: base image paged_attn.py imports Triton context_attention_fwd
which does not exist on BI-V100 (no Triton). Our paged_attn.py replaces
it with PyTorch fallback but was NEVER deployed — missing from patch_ops.sh.

SYSTEM_DESIGN.md step 9 lists it, patch_ops.sh didn't have it.

Also deploys prefix_prefill.py as safety net.

Error was: paged_attn.py:203 NameError: name 'context_attention_fwd' is not defined
→ AsyncEngineDeadError → all requests 503
2026-08-10 13:10:02 +00:00
Claude
b3f2e4d970 fix: computility-run.yaml — remove limit-mm-per-prompt, set max-model-len=80000
竞赛平台运行日志报错:
  ValueError: limit_mm_per_prompt is only supported for multimodal models

修复:
- 去掉 --limit-mm-per-prompt (Qwen3.6-35B-A3B 不是多模态模型)
- max-model-len: 256000 → 80000 (防 OOM)
- 恢复 --max-num-batched-tokens 4096 + --enable-chunked-prefill
- gpu-memory-utilization: 0.9 → 0.95
- max-num-seqs: 1 → 2
2026-08-10 10:55:36 +00:00
project6-dev
7185de5eef build(CRITICAL): complete .so build + deploy pipeline for competition submission
Dockerfile was missing ALL .so compilation steps:
  Step 1: build.sh → ex_factor_0.so (MoE topk), ex_factor_2.so (MoE GEMM), libex_registry.so
  Step 2: precompile_moe_topk.py → moe_topk_softmax_v3.so (CUB BlockReduce)
  Step 3: precompile_moe_kernels.py → moe_ops_v055.so (vllm v0.5.5 MoE kernels)
  Step 4: patch_ops.sh → deploy all Python + .so + serving layer
  Step 5: precompile_gdn.py → flash_qla GDN .so

patch_ops.sh was missing .so deployment:
  Added section 8: Deploy ex_engine package + .so to Python site-packages
  Added section 9: Deploy precompiled MoE .so to site-packages
  Both system path (/usr/local/corex/lib/python3/dist-packages/)
  and vllm path (model_executor/models/ex_engine/) covered

.so inventory for competition:
  - ex_factor_0.so: MoE topk_softmax CUDA kernel (corex clang, ivcore10)
  - ex_factor_2.so: MoE fused GEMM CUDA kernel
  - libex_registry.so: dlopen registry
  - moe_topk_softmax_v3.so: JIT compiled via torch.utils.cpp_extension
  - moe_ops_v055.so: vllm v0.5.5 compatible MoE kernels
  - flash_qla_sm70 GDN .so: GatedDeltaNet fused kernel
2026-08-10 10:25:31 +00:00
Claude
70c898ac8b fix: ex_engine.python subpackage + flash_qla_sm70 deploy + vllm v0.5.5 MoE kernels
真机验证发现的问题:
1. qwen3_5.py 做 'from ex_engine.python.ix_bridge' 但包结构是 ex_engine.ix_bridge
   → 创建 python/ 子目录 + symlinks
2. flash_qla_sm70 只部署到 /workspace 没有到 vllm models 目录
   → 显式 cp -r 到 VLLM/model_executor/models/
3. 从 vllm v0.5.5 搬 MoE CUDA kernels (torch::Tensor API):
   - topk_softmax_kernels.cu (506行, CUB BlockReduce)
   - moe_align_block_size_kernels.cu (134行)
   - moe_pybind.cpp (pybind11 入口)

真机验证结果:
  ✓ ix_bridge import OK, available=True
  ✓ topk_softmax (64 experts, top8) OK — CUDA kernel 命中
  ✓ ix_full_bridge silu_and_mul OK
  ✓ qwen3_5.py import OK
  ✓ ex_engine build 2/2 factors
  ✓ moe_topk_softmax_v3.so 编译成功
  ✓ flash_qla_sm70_gdn_strided.so 编译成功
  ✗ 单卡 32GB OOM (正常, 竞赛 4卡 tp=4)
2026-08-10 10:21:48 +00:00
Claude
35111e7a28 feat: implement topk_softmax + moe_align_block_size + invoke_fused_moe_kernel
三个 MoE 函数的完整 PyTorch 实现,让 fused_moe 路径跑通。

之前的问题:
- topk_softmax: ixf_F.vllm_moe_topk_softmax 不存在 → AttributeError
- moe_align_block_size: ixf_F.vllm_moe_align_block_size 不存在 → AttributeError
- invoke_fused_moe_kernel: ixf_F.vllm_invoke_fused_moe_kernel 不存在 → AttributeError
- 三个函数任何一个崩 → qwen3_5.py 捕获 → Python expert loop fallback
- 不管写不写 topk_softmax 都一样走 fallback

现在:三个函数全部实现 → fused_moe() 路径从头到尾跑通
- topk_softmax: torch.softmax + torch.topk
- moe_align_block_size: 按 expert 排序 token indices + block 对齐填充
- invoke_fused_moe_kernel: 按 sorted block 遍历 expert → matmul → scatter

这不是 fallback,是让 base fused_moe.py 的正常路径 (line 640-661)
能走完而不抛异常。qwen3_5.py 不再需要捕获 MoE 异常切到 expert loop。
2026-08-10 10:21:07 +00:00
project6-dev
accf9539e6 fix(CRITICAL): CoreXGDN interface mismatch + engine death protection
Three fixes for the three bugs in latest docker log:

1. corex_gdn.py REWRITTEN — interface now matches qwen3_5.py:
   OLD: CoreXGDN(num_heads, head_dim, layer_idx, chunk_size, eps)
   NEW: CoreXGDN(num_v_heads, num_k_heads, head_k_dim, head_v_dim, conv_kernel_size, layer_idx)

   OLD forward: (q, k, v, gate, beta, conv_state, temporal_state, attn_metadata)
   NEW forward: (hidden_states, attn_metadata, conv_state, temporal_state,
                  in_proj_qkv, in_proj_z, in_proj_b, in_proj_a,
                  conv1d_weight, A_log, dt_bias, norm, out_proj)

   Fixes: 'CoreXGDN.__init__() got unexpected keyword argument num_v_heads'

2. serving_chat.py — engine death protection for multimodal:
   When model has no multimodal_config, return 400 instead of passing image data
   to engine (which causes permanent AsyncEngineDeadError).

   Fixes: 'ValueError: You set image=0 but found 1 items'

3. patch_ops.sh — ALWAYS deploy our modules (base image has bugs):
   - qwen3_5.py: ALWAYS deploy (base has NaN)
   - corex_gdn/moe/fa2.py: ALWAYS deploy (base interface mismatch)
   - corex_fa2.py was MISSING from base → now deployed
2026-08-10 09:51:58 +00:00
project6-dev
2aedf7377b ref(upstream): add Deep-Spark/vllm latest + xllm ILU kernel sources
Cloned from GitHub:
  - Deep-Spark/vllm (latest): qwen3_5.py with multimodal support,
    transformers configs, multimodal registry, model registry
  - jd-opensource/xllm (latest): ILU kernel implementations
    (attention, fused_moe, group_gemm, activation, norm, rope, matmul)
    + GatedDeltaNet layer for Qwen3.5

These are the REAL upstream implementations that the base Docker image
is compiled from. Our dlopen modules should match these interfaces:
  - ilu_ops_api.h: 14 functions in xllm::kernel::ilu namespace
  - ixformer.h: 15 functions in ixformer::infer namespace

Key interface signatures for dlopen targets:
  batch_prefill()  → ixinfer_flash_attn_unpad_with_block_tables
  batch_decode()   → xllm_paged_attention
  moe_active_topk()→ topk_softmax
  moe_gen_idx()    → moe_compute_token_index_api
  group_gemm()     → moe_w16a16_group_gemm
  silu_and_mul()   → silu_and_mul
  rms_norm()       → rms_norm + residual_rms_norm
2026-08-10 09:44:11 +00:00
project6-dev
0ea77690a0 fix(CRITICAL): stop overwriting base image model layer — match comp 168 strategy
Root cause of ALL failures: we overwrite base image's production code with our
inferior versions, breaking multimodal, killing C++ kernel performance, and
causing engine death.

Comp 168 evidence (48/52 pass, score=60194):
  - Uses base image qwen3_5.py (81706B) with full multimodal + CoreX integration
  - Uses base image corex_gdn/moe/fa2.py with real C++ kernels (libcorex_gdn.so)
  - Uses base image _custom_ops.py (ERROR spam is harmless)
  - d01: 8.49s, d05 multimodal: PASS, t13 base64 image: PASS

Our sub 508 (21/52 pass, score=0):
  - Overwrites qwen3_5.py → NO multimodal → engine death on image request
  - Overwrites corex_*.py → Python fallback → d01: 95.87s (11x slower)
  - Overwrites _custom_ops.py → may break base fallback chain

Changes:
1. patch_ops.sh: qwen3_5.py — KEEP base if >1000 bytes (was: ALWAYS overwrite)
2. patch_ops.sh: corex_*.py — KEEP base if >500 bytes (was: ALWAYS overwrite)
3. patch_ops.sh: _custom_ops.py — KEEP base always (was: ALWAYS overwrite)
4. computility-run.yaml: match comp 168 exactly:
   - max_model_len: 80000 → 256000
   - gpu_memory_utilization: 0.95 → 0.9
   - max_num_seqs: 2 → 1
   - REMOVE chunked_prefill + batched_tokens
   - REMOVE limit-mm-per-prompt (base image handles it)
2026-08-10 09:43:36 +00:00
project6
e969aa0e1f revert(corex_gdn+qwen3_5): restore to ff3562b9 — no rewriting existing modules
Reverted the NO-FALLBACK rewrite of corex_gdn.py and qwen3_5.py.

Policy: do NOT rewrite modules that already exist in base image or
upstream_ref. If an interface doesn't match, fix the interface call
site — don't rewrite the entire module in pure PyTorch.

Base image has corex_gdn.py, corex_moe.py, corex_fa2.py with C++
backends. The right approach is to match their __init__ signatures,
not replace them with slower Python reimplementations.
2026-08-10 09:32:24 +00:00
project6
a3839dd411 fix(CRITICAL): add --limit-mm-per-prompt image=5 — multimodal request kills engine
Engine crash: ValueError: You set image=0 (or defaulted to 1) in
--limit-mm-per-prompt, but found 1 items in the same prompt.

This kills the entire vLLM engine (AsyncEngineDeadError), making all
subsequent requests return 503. Competition sends image requests in
functional tests (d08/d09 multimodal).

Fix: --limit-mm-per-prompt image=5 allows up to 5 images per prompt.
2026-08-10 09:29:54 +00:00
Claude
35f9da0c80 fix(NO-FALLBACK): eliminate all silent fallbacks — crash or succeed
Policy: fallback = 0 score = same as crash. Better to crash with clear
error log so we can diagnose.

Changes:

1. corex_gdn.py: COMPLETE REWRITE (374 lines)
   - CoreXGDN.forward() now implements full GDN layer forward
   - Accepts all 13 args from qwen3_5.py (hidden_states, attn_metadata,
     conv_state, temporal_state, in_proj_qkv/z/b/a, conv1d_weight,
     A_log, dt_bias, norm, out_proj)
   - Prefill: causal conv1d → split q/k/v → chunk_gated_delta_rule
     (fp32 accumulation, xllm-aligned cumsum+difference form)
   - Decode: causal_conv1d_update → single-step recurrent with
     bmm/baddbmm_ (ixformer accelerated)
   - NO FALLBACK — if something fails, it crashes

2. qwen3_5.py: Remove all try/except fallbacks
   - GatedDeltaNet.__init__: CoreXGDN init MUST succeed (no try/except)
   - GatedDeltaNet.forward: CoreXGDN.forward() called directly, no catch
   - MoE init: raise RuntimeError if moe_forward missing

3. patch_ops.sh: MUST deploy all three corex modules
   - Reverted previous 'don't overwrite' — base image produces NaN
   - corex_gdn.py + corex_moe.py + corex_fa2.py all deployed unconditionally
2026-08-10 09:23:30 +00:00
Claude
f87689a4ef fix(CRITICAL): engine death on image request + stop overwriting base corex modules
Root cause from latest docker build log:
  ValueError: You set image=0 in --limit-mm-per-prompt, but found 1 items
  → Engine background task crashes → AsyncEngineDeadError → all subsequent 503

Fixes:
1. computility-run.yaml: add --limit-mm-per-prompt image=1
   Prevents multimodal ValueError from killing the engine process.

2. patch_ops.sh: DON'T overwrite base image's corex_gdn.py/corex_moe.py
   Comp 168 log proves base image's corex modules work with libcorex_gdn.so.
   Our overwrite broke CoreXGDN.__init__ (unexpected kwarg 'num_v_heads').
   Only deploy ours if base has NO corex modules at all.
   Also deploy corex_fa2.py if base lacks it.

3. qwen3_5.py: try multiple CoreXGDN init signatures
   Base image CoreXGDN may accept different kwargs than ours.
   Try kwargs form first, fall back to positional.

4. corex_gdn.py: accept both calling conventions in __init__
   Future-proof for when we DO need to deploy ours.

5. Copied upstream_ref headers: ilu_layer_fused_moe.h, ilu_layer_attention.h
   Last 2 missing ILU files from xllm. All 14/14 now present.
2026-08-10 09:12:05 +00:00
project6
ff3562b941 fix(CRITICAL): always deploy our qwen3_5.py — base image GDN also has NaN
Base image qwen3_5.py (81706 bytes, 1777 lines) produces NaN frac=0.5000:
  CoreXGDN.__init__() got unexpected keyword argument 'num_v_heads'
  → all GDN layers fallback to base PyTorch GDN → NaN

Our qwen3_5.py has the xllm-aligned GDN fix (cumsum + difference form).
verify_single_card.py confirmed ZERO NaN on real BI-V100.

Remove conditional deploy — always overwrite base qwen3_5.py.
2026-08-10 08:29:57 +00:00
project6
5dde115245 fix(build): restore working Dockerfile format from c2807549
Revert to the exact Dockerfile structure that built successfully on
the competition platform. Uses '; echo' pattern (not '&&') and
'| tee' for logging, matching the proven c2807549 submission.
2026-08-10 08:19:58 +00:00
project6
cd61968f01 fix(build): install gcc + ninja-build before compilation
Docker build fails if base image lacks gcc (needed for ex_registry.c)
and ninja (needed for torch.utils.cpp_extension). Install both in a
dedicated RUN layer before build.sh and patch_ops.sh.
2026-08-10 08:18:45 +00:00
project6
b869eddbb4 fix(build): add upstream_ref to dockerignore + clean debug files
Docker build context was including upstream_ref/ (23MB) unnecessarily.
Also exclude debug_*.py and verify_*.py from build context.
2026-08-10 08:12:18 +00:00
project6
3aa0c3cffb fix(build): restore strict error handling — find real build failures 2026-08-10 08:09:22 +00:00
project6
98fdcff9e9 fix(build): remove set -euo pipefail + bulletproof Dockerfile
Docker build was failing silently. Root cause: ex_engine/build.sh had
set -euo pipefail — if corex compiler missing or any compilation error,
the entire RUN step returns non-zero → Docker build fails.

Fix:
- build.sh: set +e (tolerate compilation failures)
- Dockerfile: single RUN layer, every step has || echo fallback
- No step can cause Docker build to fail
2026-08-10 08:08:18 +00:00
project6
c5dfaee98a fix(MoE): rewrite topk kernel — 1 block/row, shared mem, warp-agnostic
Root cause: BI-V100 warp size may be 64 (not 32). Old kernel used
dim3(32,4) assuming 4 independent warps per block, but with warpSize=64
two rows shared the same warp → __shfl_sync mixed their data.

Debug proof: Row 0 == Row 1, Row 2 == Row 3 (identical outputs).
Even rows correct, odd rows duplicated.

Fix: 1 block = 1 row = 64 threads (1 per expert). All reductions
use shared memory (block_reduce_max/sum/argmax) instead of warp
shuffle. Zero warp-size dependency.
2026-08-10 08:03:08 +00:00
project6
a1fc56d5b0 debug: check BI-V100 warp size 2026-08-10 08:02:19 +00:00
project6
e7db38d76f debug: topk kernel mismatch diagnostic 2026-08-10 07:59:06 +00:00
project6
7ec50ff3cf fix: total_mem → total_memory (corex torch API) 2026-08-10 07:55:39 +00:00
project6
570ee94172 test: single-card BI-V100 verification — CUDA kernel + GDN NaN + ixformer ops 2026-08-10 07:53:43 +00:00
project6
8b6f3fd242 fix(MoE): robust CUDA kernel loading + no-GPU precompile
1. precompile_moe_topk.py: skip GPU verification during Docker build
   (torch.cuda.is_available() check — .so compilation doesn't need GPU)

2. _custom_ops.py topk_softmax init: 3-tier loading
   - import precompiled module (torch cache)
   - scan known .so paths (torch_extensions cache dirs)
   - JIT compile from .cu source
   - PyTorch fallback with WARNING (not silent — must know if CUDA failed)

3. patch_ops.sh: report .so location after precompile for debugging
2026-08-10 07:50:28 +00:00
project6
c0cc4e7dc9 feat(MoE): wire CUDA topk_softmax kernel into _custom_ops dispatch
topk_softmax was falling back to PyTorch softmax+topk (Python-level,
called 36 times per decode step). We already have a fused CUDA kernel
(moe_topk_softmax_v3.cu, 148 lines, warp-shuffle, zero SMEM) that's
precompiled during Docker build — it just wasn't wired in.

Dispatch chain:
1. Try import precompiled moe_topk_softmax_v3.so
2. Try JIT compile from .cu source (deployed by patch_ops.sh)
3. PyTorch fallback (softmax → topk)

The CUDA kernel does fused softmax+topk in a single kernel launch per
token batch — vs PyTorch's 2 separate kernel launches + Python overhead.
On 64 experts, topk=8: ~5x faster per call, 36 calls/layer/step.
2026-08-10 07:47:25 +00:00
project6
c17c490e06 fix(GDN): remove pre-cumsum clamp — match xllm reference, fix 99.98% NaN
ROOT CAUSE: g.clamp(-5,2) before cumsum corrupted gate values.
The GDN algorithm computes decay_mask = exp(g_i - g_j) which is
numerically stable via subtraction cancelling cumsum growth.
Pre-clamping g distorts these differences → wrong decay rates → NaN.

xllm reference: qwen3_gated_delta_net_base.cpp lines 170-238
- cumsum first (no pre-clamp)
- difference form: (g_i_last - g[:, i]).exp() for state update
- k_cumdecay uses g.exp() directly (not clamped)

Removed: g.clamp(-5,2), g.clamp(-20,20), g_exp_cache, g_clamped
Added: xllm-style g_i_last/g_exp_term/k_g_exp state update
2026-08-10 07:44:03 +00:00
Claude
a0d76bc06e fix: remove ix_moe_bridge — nm -D confirms libixformer.so has NO MoE symbols
真机探测确认:
  nm -D libixformer.so | grep topk_softmax → 空
  ixf_F dir() → 无 vllm_moe_topk_softmax
  ixf_F dir() → 无 vllm_invoke_fused_moe_kernel
  ixf_F dir() → 无 vllm_moe_align_block_size
  _ixformer_torch.so symbols → 仅 cuinfer_gemm 系列, 无 MoE

结论: base 镜像的 MoE 路径:
  fused_moe.py → _custom_ops.topk_softmax → ixf_F.vllm_moe_topk_softmax → AttributeError
  → qwen3_5.py 捕获 → fallback to Python expert loop (这是唯一能工作的路径)

修改:
1. _custom_ops.py topk_softmax: 直接 PyTorch softmax+topk, 不尝试 ixf_F (消除 ERROR 日志)
2. 移除 ix_moe_bridge 加载逻辑 (libixformer.so 没有 MoE 符号, 链接会失败)
3. 移除 patch_ops.sh ix_moe_bridge JIT 编译步骤

comp 168 的 0 分根因不是 MoE fallback (所有参赛者都 fallback),
而是我们的自定义 qwen3_5.py 导致 GDN NaN 99.98% + OOM.
上一个 commit 已修复: 条件部署 qwen3_5.py + max_model_len=80000.
2026-08-10 07:41:53 +00:00
Claude
c280754903 fix(CRITICAL): conditional qwen3_5.py deploy + ix_moe_bridge topk_softmax
Three changes addressing comp 168 root causes:

1. patch_ops.sh: CONDITIONAL qwen3_5.py deployment
   - If base image has qwen3_5.py > 1000 bytes, DON'T overwrite
   - Sub168 proof: base native code = ZERO NaN, 16.4 TPS
   - Our custom = 99.98% NaN, ERROR spam. PRD says don't overwrite.

2. _custom_ops.py: topk_softmax via ix_moe_bridge C++ bridge
   - ixformer::infer::topk_softmax in libixformer.so but NOT in Python
   - ix_moe_bridge.cpp (pybind11) calls C++ directly
   - Eliminates 39x ERROR log spam per prefill pass

3. patch_ops.sh: Pre-compile ix_moe_bridge.cpp at Docker build time
   - Links against libixformer.so
   - Bridge exposes full MoE pipeline
2026-08-10 07:34:54 +00:00
project6-dev
d646a96c09 debug: deep probe MoE kernel dispatch in base image 2026-08-10 07:13:01 +00:00
project6-dev
04197138c2 docs: update PROJECT_SUMMARY — comp 168 analysis + three critical fixes 2026-08-10 06:56:59 +00:00
project6-dev
af08856d5c fix(CRITICAL): max_model_len 256000→80000 + topk_softmax silent fallback + deploy _custom_ops
Three fixes from comp 168 log analysis:

1. computility-run.yaml: max_model_len 256000→80000
   - 256000 causes OOM (comp 168: CUDA OOM at 31.72GB)
   - BI-V100 KV cache capacity ~88112 blocks

2. _custom_ops.py: topk_softmax silent fallback
   - ixf_F.vllm_moe_topk_softmax missing in base image
   - New: try ixformer._C.topk_softmax → silent PyTorch fallback
   - Eliminates 500+ ERROR lines from docker log

3. patch_ops.sh: deploy _custom_ops.py
   - Previously excluded; now deployed to fix topk_softmax issue

Ref: upstream_ref/xllm/core/kernels/ilu/ixformer.h
2026-08-10 06:56:23 +00:00
project6-dev
4a91c31ffc debug: probe base image vllm FusedMoE actual dispatch chain 2026-08-10 06:41:52 +00:00
project6-dev
f265cb8ad3 fix(yaml): align launch params with comp 168 proven config
- max_model_len: 80000 → 256000 (comp 168 value)
- gpu_memory_utilization: 0.9 → 0.95
- Added: --max-num-batched-tokens 4096, --enable-chunked-prefill
- Removed: VLLM_COREX_*_LIBRARY env vars (those .so don't exist in base image)
- Added ixformer dir to LD_LIBRARY_PATH for runtime symbol resolution
2026-08-10 06:40:48 +00:00
project6-dev
905bf4db2c feat(moe): wire silu_and_mul through C++ bridge in corex_moe.py
Now MoE activation uses:
  Tier 0: ix_bridge.silu_and_mul (C++ ixformer_torch_ext, verified on BI-V100)
  Tier 1: ixformer.functions.silu_and_mul (Python)
  Tier 2: F.silu(gate) * up (pure PyTorch)

Verified 7/8 on single BI-V100:
  ✓ compile, silu_and_mul, rms_norm, fused_add_rms_norm, linear, paged_attn, corex_moe
  ✗ flash_attn import path (not needed, vllm xformers backend handles it)
2026-08-10 06:36:40 +00:00
project6-dev
7127d18491 refactor(bridge): rewrite ix_full_bridge.cpp for actual base image symbols
Symbol probe revealed ixformer::infer namespace does NOT exist in base image.
That namespace is xllm's own compiled wrapper layer.

Actual available symbols in base image:
  _ixformer_torch.so: silu_and_mul_forward, rms_norm_forward,
    fused_add_rms_norm_forward, ixformer_linear, ixformer_linear_ex
  libixformer.so: ixinfer_flash_attn_unpad_fwd (different signature)

MoE functions (topk_softmax, group_gemm, moe_expand_input, etc.)
are NOT in any base image .so — MoE must use Python path.

Bridge now only wraps: silu_and_mul, rms_norm, fused_add_rms_norm, linear
These accelerate the per-layer ops that run 200x per token.
2026-08-10 06:34:54 +00:00
project6-dev
b9fd2755d9 debug: probe all ixformer symbol locations 2026-08-10 06:33:14 +00:00
project6-dev
3e7fc565ff debug: probe script to find silu_and_mul symbol location 2026-08-10 06:32:04 +00:00
project6-dev
a54dbda3bb fix(bridge): link against libixformer.so for silu_and_mul symbol
- ix_bridge.py: auto-discover ixformer .so files, pass as extra_ldflags
- ix_moe_bridge.cpp: fix mangled header from bad sed, add #include <optional>
- verify_single_gpu.py: also pass extra_ldflags during JIT compile

The undefined symbol _ZN8ixformer5infer12silu_and_mulERN2at6TensorES3_
lives in libixformer.so — need to explicitly link it.
2026-08-10 06:29:11 +00:00
project6-dev
ac3c8e28eb fix(bridge): c10::nullopt → typed std::optional{} for CoreX torch compat
CoreX torch's c10::nullopt cannot implicitly convert to const std::optional<T>&.
Solution: use static typed empty optionals (kNoneTensor, kNoneBool).
Also unified all c10::optional forward decls to std::optional.
Applied same fix to ix_moe_bridge.cpp.
2026-08-10 06:25:15 +00:00
project6-dev
ff0bf8c1d6 fix: total_mem → total_memory (torch API) 2026-08-10 06:21:40 +00:00
project6-dev
c579c75039 test: single-GPU verification script for ix_full_bridge compile + MoE 7-step dispatch chain 2026-08-10 06:21:04 +00:00