Commit Graph

3 Commits

Author SHA1 Message Date
claude
051b02d3cd feat: ix_moe_bridge + ix_attn_bridge — dlopen bridges for full ixformer::infer API
Bridge architecture (from xllm/core/kernels/ilu/ixformer.h):

ix_moe_bridge.so (MoE 7-step fused pipeline):
  - topk_softmax → moe_compute_token_index_api → moe_expand_input
  - moe_w16a16_group_gemm (x2) → silu_and_mul → moe_output_reduce_sum
  - fused_moe_forward(): replaces entire Python expert loop
  - Fix: group_gemm format NT→TN (match xllm trans_b=true)

ix_attn_bridge.so (attention + linear):
  - ixinfer_flash_attn_unpad_with_block_tables (fused prefill)
  - xllm_paged_attention (fused paged decode)
  - ixformer_linear (matmul + activation)
  - residual_rms_norm (fused residual + norm)

Integration:
  - ix_fused_moe.py: Python loader (prebuilt .so → JIT → unavailable)
  - qwen3_5.py: Tier 0 dispatch in _pure_pytorch_experts()
  - patch_ops.sh: deploys ix_fused_moe.py + all prebuilt/*.so

Source: jd-opensource/xllm (fresh clone, all ILU kernels verified SAME)
Sync: upstream_ref/xllm_latest/models/llm/qwen3_next_hybrid_base.h (+32 lines)

Build on real machine:
  bash qwen3_6_scripts/build_ix_moe_bridge.sh
  bash qwen3_6_scripts/build_ix_attn_bridge.sh
2026-08-14 07:32:31 +00:00
Claude
56fe58ada3 fix(build): c10::optional for CoreX CUDA 10.2 — std::optional incompatible
CoreX PyTorch uses c10::optional, not std::optional. The forward-declared
ixformer::infer signatures must match the actual .so ABI.
2026-08-14 01:49:25 +00:00
Claude
c8a982c4e8 feat: ix_full_bridge.so — dlopen bridge for ixformer::infer C++ API
Ported from ex_engine/csrc/ix_full_bridge_v2.cpp + ix_moe_bridge.cpp.
Source: upstream_ref/xllm_latest/core/kernels/ilu/ixformer.h

Exposes 14 ixformer::infer functions as Python-callable torch extension:
  Attention: paged_attention, flash_attn_prefill, reshape_and_cache
  MoE: topk_softmax, moe_gen_idx, moe_expand_input, group_gemm,
       moe_combine_result, fused_moe_forward
  Activation: silu_and_mul
  Norm: rms_norm, fused_add_rms_norm
  Linear: linear
  RoPE: rotary_embedding

Build: torch.utils.cpp_extension.load() in docker build (patch_ops.sh)
Links against libixformer.so from base image at runtime.

This replaces PyTorch MoE fallback (the #1 performance bottleneck).
Without bridge: MoE loops over experts in Python → ~3 TPS decode
With bridge: fused 7-step pipeline in C++ → ~16 TPS decode (sub168 level)
2026-08-14 01:25:16 +00:00