THE CORE .so: ix_moe_bridge.cpp compiles to ix_moe_bridge.so which:
- Links against base image's libixformer.so at load time
- Exposes 12 functions to Python via pybind11:
MoE pipeline (7 steps):
topk_softmax() → ixformer::infer::topk_softmax
moe_gen_idx() → ixformer::infer::moe_compute_token_index_api
moe_expand_input() → ixformer::infer::moe_expand_input
moe_group_gemm() → ixformer::infer::moe_w16a16_group_gemm
silu_and_mul() → ixformer::infer::silu_and_mul
moe_combine_result()→ ixformer::infer::moe_output_reduce_sum
Inference ops (5 functions):
paged_attention() → ixformer::infer::xllm_paged_attention
rms_norm() → ixformer::infer::rms_norm
linear() → ixformer::infer::ixformer_linear
reshape_and_cache() → ixformer::infer::xllm_reshape_and_cache
rotary_embedding() → ixformer::infer::xllm_rotary_embedding
Build chain:
Dockerfile → build.sh → precompile_ix_bridge.py
→ torch.utils.cpp_extension.load(ix_moe_bridge.cpp, -lixformer)
→ ix_moe_bridge.cpython-310.so
Load chain:
Python: from ex_engine.python.ix_bridge import topk_softmax
→ ix_bridge.py loads ix_moe_bridge.so
→ dlopen links to libixformer.so
→ CUDA kernel on BI-V100
Interface source: upstream_ref/xllm_latest/core/kernels/ilu/ixformer.h
28 lines
1.2 KiB
Docker
28 lines
1.2 KiB
Docker
FROM git.modelhub.org.cn:9443/enginex-iluvatar/bi100-3.2.3-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.3
|
|
|
|
RUN mkdir -p /workspace
|
|
WORKDIR /workspace/
|
|
|
|
# Copy sources
|
|
COPY ./qwen3_6_scripts /workspace/qwen3_6_scripts
|
|
COPY ./computility-run.yaml /workspace/computility-run.yaml
|
|
COPY ./ex_engine /workspace/ex_engine
|
|
|
|
# Step 1: Compile ix_moe_bridge.so — dlopen bridge to libixformer.so
|
|
# This is THE critical .so: it exposes topk_softmax + 11 other ixformer::infer
|
|
# functions that the base image's Python binding doesn't expose.
|
|
RUN chmod +x /workspace/ex_engine/build.sh && \
|
|
bash /workspace/ex_engine/build.sh 2>&1 | tee /workspace/build.log ; \
|
|
echo "[Docker] build exit code: $?"
|
|
|
|
# Step 2: Deploy patches (serving layer + conditional model layer)
|
|
# patch_ops.sh v2: does NOT overwrite base qwen3_5.py (comp 168 strategy)
|
|
RUN chmod +x /workspace/qwen3_6_scripts/patch_ops.sh && \
|
|
bash /workspace/qwen3_6_scripts/patch_ops.sh 2>&1 | tee /workspace/patch_ops.log ; \
|
|
echo "[Docker] patch_ops exit code: $?"
|
|
|
|
# Step 3: Precompile GDN kernel (needs vllm in path)
|
|
RUN python3 /workspace/qwen3_6_scripts/precompile_gdn.py \
|
|
/workspace/qwen3_6_scripts/flash_qla_sm70 2>&1 | tee -a /workspace/build.log ; \
|
|
echo "[Docker] gdn precompile exit code: $?"
|