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
34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# build.sh — Compile all .so libraries for ex_engine
|
|
#
|
|
# Produces:
|
|
# build/ix_moe_bridge.*.so — dlopen bridge to libixformer.so (12 functions)
|
|
#
|
|
# Run inside Docker where libixformer.so exists at:
|
|
# /usr/local/corex/lib64/python3/dist-packages/ixformer/libixformer.so
|
|
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
echo "[build.sh] START"
|
|
|
|
mkdir -p build
|
|
|
|
# ============================================================================
|
|
# 1. ix_moe_bridge.so — THE KEY DELIVERABLE
|
|
# Links to libixformer.so → exposes topk_softmax etc to Python
|
|
# ============================================================================
|
|
echo "[build.sh] Compiling ix_moe_bridge..."
|
|
python3 precompile_ix_bridge.py 2>&1 || {
|
|
echo "[build.sh] WARNING: ix_moe_bridge compile failed (expected outside Docker)"
|
|
}
|
|
|
|
# Check result
|
|
if ls build/ix_moe_bridge*.so 1>/dev/null 2>&1; then
|
|
echo "[build.sh] SUCCESS: $(ls build/ix_moe_bridge*.so)"
|
|
else
|
|
echo "[build.sh] WARNING: no ix_moe_bridge.so produced"
|
|
fi
|
|
|
|
echo "[build.sh] DONE"
|
|
ls -la build/*.so 2>/dev/null || echo "[build.sh] No .so files in build/"
|