2026-07-30 15:33:44 +00:00
|
|
|
FROM git.modelhub.org.cn:9443/enginex-iluvatar/bi100-3.2.3-x86-ubuntu20.04-py3.10-poc-llm-infer:v1.2.3
|
|
|
|
|
|
2026-08-11 07:58:05 +00:00
|
|
|
RUN mkdir -p /workspace
|
feat(CRITICAL): import wudixzy/competition complete corex stack — 12 prebuilt .so + 13 CUDA kernels + 2615-line qwen3_5.py
Source: github.com/wudixzy/competition (1527 files, BI-V100 competition reference)
Imported assets:
- 12 prebuilt CoreX .so extensions (corex-3.2.3-ivcore10):
corex_gdn_{beta_decay,causal_conv,gated_norm,packed_decode,qk_map}.so
corex_moe_{direct_routed,exact_reduce,weight_gather}.so
corex_attn_head_rms_norm.so, corex_paged_kv_gather.so
corex_block_major_kv_transfer.so, corex_fused_paged_prefill.so
- 13 CUDA kernel sources (.cu) for above extensions
- 11 build scripts (build_corex_*.sh)
- install_prebuilt_corex.sh (SHA256-verified .so deployment)
- qwen3_5.py (2615 lines) with FULL corex kernel integration
- 9 vllm vendor override files (block manager, sampler, etc)
- 19 patch scripts (model_runner, xformers, block_major, etc)
- Complete serving layer (serving_chat, protocol, api_server, etc)
- bi100_env.py, bi100_profile.py, gdn_prefix.py, block_major_kv_cache.py
- Dockerfile aligned with reference build chain
- computility-run.yaml with BI100_MOE_COREX_DIRECT_ROUTED=1
Call chain verified:
Dockerfile COPY → patch_ops.sh → install_prebuilt_corex.sh → 12 .so to $VLLM_ROOT
qwen3_5.py imports: from vllm import corex_gdn_* / corex_moe_* / corex_attn_*
2026-08-11 03:55:38 +00:00
|
|
|
WORKDIR /workspace/
|
2026-08-11 07:58:05 +00:00
|
|
|
|
|
|
|
|
# Copy all sources — ex_engine for build-time .so compilation,
|
|
|
|
|
# qwen3_6_scripts for patches+prebuilt, vllm_overrides for core fixes
|
2026-07-30 15:33:44 +00:00
|
|
|
COPY ./qwen3_6_scripts /workspace/qwen3_6_scripts
|
2026-08-11 07:58:05 +00:00
|
|
|
COPY ./computility-run.yaml /workspace/computility-run.yaml
|
|
|
|
|
COPY ./ex_engine /workspace/ex_engine
|
|
|
|
|
COPY ./vllm_overrides /workspace/vllm_overrides
|
|
|
|
|
|
|
|
|
|
# Step 1: Build EX Engine .so libraries (tolerant of compile failures)
|
|
|
|
|
RUN chmod +x /workspace/ex_engine/build.sh && \
|
|
|
|
|
bash /workspace/ex_engine/build.sh --corex 2>&1 | tee /workspace/ex_build.log ; \
|
|
|
|
|
echo "[Dockerfile] ex_engine build exit code: $?"
|
|
|
|
|
|
|
|
|
|
# Step 2: Precompile MoE CUDA kernels (tolerant)
|
|
|
|
|
RUN python3 /workspace/ex_engine/precompile_moe_topk.py 2>&1 | tee -a /workspace/ex_build.log ; \
|
|
|
|
|
echo "[Dockerfile] moe_topk precompile exit code: $?"
|
|
|
|
|
|
|
|
|
|
# Step 3: Precompile vllm v0.5.5 MoE kernels (tolerant)
|
|
|
|
|
RUN python3 /workspace/ex_engine/precompile_moe_kernels.py 2>&1 | tee -a /workspace/ex_build.log ; \
|
|
|
|
|
echo "[Dockerfile] moe_v055 precompile exit code: $?"
|
|
|
|
|
|
|
|
|
|
# Step 4: Stage vendor_overrides into qwen3_6_scripts/ so patch_ops.sh finds them
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
RUN mkdir -p /workspace/qwen3_6_scripts/vendor_overrides/vllm/core/block \
|
|
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/model_executor/layers && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/core/evictor_v2.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/core/evictor_v2.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/core/block/cpu_kv_content_cache.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/core/block/cpu_kv_content_cache.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/core/block/cpu_gpu_block_allocator.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/core/block/cpu_gpu_block_allocator.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/core/block/prefix_caching_block.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/core/block/prefix_caching_block.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/core/block/block_table.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/core/block/block_table.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/core/block_manager_v2.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/core/block_manager_v2.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/sampling_params.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/sampling_params.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/model_executor/sampling_metadata.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/model_executor/sampling_metadata.py 2>/dev/null || true && \
|
2026-08-11 07:58:05 +00:00
|
|
|
cp /workspace/vllm_overrides/model_executor/layers/sampler.py \
|
fix: GDN NaN clamp (7 sites) + Dockerfile Step 4 tolerance
qwen3_5.py (2642 lines, 12 prebuilt .so, no fallback):
- decay_mask: g_diff.clamp(-20,20) before exp()
- Neumann row: .clamp(-65504,65504) on iterative update
- k_cumdecay: g.clamp(-20,20).exp()
- state loop attn_inter: g.clamp(-20,20).exp()
- state loop g_exp_term: .clamp(-20,20)
- state loop g_last: .clamp(-20,20)
- state loop last_state: .clamp(-65504,65504) after update
Dockerfile Step 4: each cp gets 2>/dev/null || true
(matches tolerance pattern of Steps 1-3, 5-8)
2026-08-11 09:20:14 +00:00
|
|
|
/workspace/qwen3_6_scripts/vendor_overrides/vllm/model_executor/layers/sampler.py 2>/dev/null || true ; \
|
|
|
|
|
echo "[Dockerfile] vendor_overrides staged"
|
2026-08-11 07:58:05 +00:00
|
|
|
|
|
|
|
|
# Step 5: Deploy patches (serving + engine fixes + prebuilt .so)
|
|
|
|
|
RUN chmod +x /workspace/qwen3_6_scripts/patch_ops.sh && \
|
|
|
|
|
cd /workspace/qwen3_6_scripts && \
|
|
|
|
|
bash ./patch_ops.sh 2>&1 | tee /workspace/patch_ops.log ; \
|
2026-08-11 07:01:51 +00:00
|
|
|
echo "[Dockerfile] patch_ops exit code: $?"
|
2026-08-11 07:58:05 +00:00
|
|
|
|
|
|
|
|
# Step 6: Build ix_unified_bridge.so (links against base image ixformer at runtime)
|
|
|
|
|
RUN chmod +x /workspace/ex_engine/build_unified_bridge.sh && \
|
|
|
|
|
bash /workspace/ex_engine/build_unified_bridge.sh 2>&1 | tee -a /workspace/ex_build.log ; \
|
|
|
|
|
echo "[Dockerfile] ix_unified_bridge build exit code: $?"
|
|
|
|
|
|
|
|
|
|
# Step 7: Deploy ix_unified and ex_engine Python modules to vllm path
|
|
|
|
|
RUN VLLM_ROOT=$(python3 -c "import vllm; print(vllm.__path__[0])" 2>/dev/null || echo "/usr/local/corex/lib/python3/dist-packages/vllm") && \
|
|
|
|
|
cp /workspace/ex_engine/python/ix_unified.py "${VLLM_ROOT}/ix_unified.py" 2>/dev/null || true && \
|
|
|
|
|
cp /workspace/ex_engine/python/corex_so_loader.py "${VLLM_ROOT}/corex_so_loader.py" 2>/dev/null || true && \
|
|
|
|
|
cp /workspace/ex_engine/python/moe_fused_dispatch.py "${VLLM_ROOT}/moe_fused_dispatch.py" 2>/dev/null || true && \
|
|
|
|
|
if [ -f /workspace/ex_engine/build/ix_unified_bridge*.so ]; then \
|
|
|
|
|
cp /workspace/ex_engine/build/ix_unified_bridge*.so "${VLLM_ROOT}/" 2>/dev/null || true ; \
|
|
|
|
|
fi ; \
|
|
|
|
|
echo "[Dockerfile] ex_engine Python modules deployed"
|
|
|
|
|
|
|
|
|
|
# Step 8: Precompile GDN kernel (needs vllm in path, so after patch_ops)
|
|
|
|
|
RUN python3 /workspace/qwen3_6_scripts/precompile_gdn.py \
|
|
|
|
|
/workspace/qwen3_6_scripts/flash_qla_sm70 2>&1 | tee -a /workspace/ex_build.log ; \
|
|
|
|
|
echo "[Dockerfile] gdn precompile exit code: $?"
|