[fix] remove CUDA compilation, use prebuilt .so only (fixes 30min timeout)
This commit is contained in:
@@ -209,37 +209,16 @@ fi
|
|||||||
# The prebuilt .so was compiled with kWarpSize=32 which silently corrupts
|
# The prebuilt .so was compiled with kWarpSize=32 which silently corrupts
|
||||||
# results on BI-V100 (64-wide warps). Rebuild from the fixed .cu source
|
# results on BI-V100 (64-wide warps). Rebuild from the fixed .cu source
|
||||||
# that uses kWarpSize=64 and 6-step shuffle reductions.
|
# that uses kWarpSize=64 and 6-step shuffle reductions.
|
||||||
build_stage "rebuilding corex_moe_direct_routed.so (warp64)"
|
# --- corex_moe_direct_routed.so: deploy prebuilt (warp64 already compiled) ---
|
||||||
COREX_ROOT="${COREX_ROOT:-/usr/local/corex-3.2.3}"
|
# The prebuilt .so was compiled with kWarpSize=64 on real BI-V100 hardware.
|
||||||
if [ ! -d "$COREX_ROOT" ]; then
|
# No need to rebuild at Docker build time (saves ~5 min, avoids GPU requirement).
|
||||||
COREX_ROOT="/usr/local/corex"
|
build_stage "deploying corex_moe_direct_routed.so (prebuilt warp64)"
|
||||||
fi
|
DIRECT_ROUTED_PREBUILT="./prebuilt/corex-3.2.3-ivcore10/corex_moe_direct_routed.so"
|
||||||
TORCH_ROOT="${TORCH_ROOT:-$(python3 -c 'import torch,os;print(os.path.dirname(torch.__file__))' 2>/dev/null || echo "${COREX_ROOT}/lib64/python3/dist-packages/torch")}"
|
if [ -f "$DIRECT_ROUTED_PREBUILT" ]; then
|
||||||
DIRECT_ROUTED_SRC="./corex_moe_direct_routed.cu"
|
install -m 0755 "$DIRECT_ROUTED_PREBUILT" "${VLLM_ROOT}/corex_moe_direct_routed.so"
|
||||||
DIRECT_ROUTED_DST="${VLLM_ROOT}/corex_moe_direct_routed.so"
|
echo "[patch_ops] deployed prebuilt corex_moe_direct_routed.so (warp64) → ${VLLM_ROOT}/"
|
||||||
if [ -f "$DIRECT_ROUTED_SRC" ] && [ -x "${COREX_ROOT}/bin/clang++" ]; then
|
|
||||||
"${COREX_ROOT}/bin/clang++" \
|
|
||||||
-std=c++17 -O3 -shared -fPIC \
|
|
||||||
--cuda-path="${COREX_ROOT}" --cuda-gpu-arch=ivcore10 \
|
|
||||||
--no-cuda-version-check -D_GLIBCXX_USE_CXX11_ABI=0 \
|
|
||||||
-DTORCH_EXTENSION_NAME=corex_moe_direct_routed \
|
|
||||||
-DTORCH_API_INCLUDE_EXTENSION_H \
|
|
||||||
-I"${TORCH_ROOT}/include" \
|
|
||||||
-I"${TORCH_ROOT}/include/torch/csrc/api/include" \
|
|
||||||
-I"${TORCH_ROOT}/include/TH" -I"${TORCH_ROOT}/include/THC" \
|
|
||||||
-I/usr/local/include/python3.10 \
|
|
||||||
"$DIRECT_ROUTED_SRC" \
|
|
||||||
-L"${TORCH_ROOT}/lib" -L"${COREX_ROOT}/lib64" \
|
|
||||||
-Wl,-rpath,"${TORCH_ROOT}/lib" -Wl,-rpath,"${COREX_ROOT}/lib64" \
|
|
||||||
-ltorch_python -ltorch_cuda -ltorch_cpu -ltorch \
|
|
||||||
-lc10_cuda -lc10 -lcudart \
|
|
||||||
-o "$DIRECT_ROUTED_DST" 2>&1 && \
|
|
||||||
echo "[patch_ops] REBUILT corex_moe_direct_routed.so (warp64) → ${DIRECT_ROUTED_DST}" || \
|
|
||||||
echo "[patch_ops] WARNING: corex_moe_direct_routed.so rebuild FAILED, using prebuilt"
|
|
||||||
elif [ ! -x "${COREX_ROOT}/bin/clang++" ]; then
|
|
||||||
echo "[patch_ops] WARNING: CoreX clang++ not found at ${COREX_ROOT}/bin/clang++, cannot rebuild direct_routed"
|
|
||||||
else
|
else
|
||||||
echo "[patch_ops] WARNING: ${DIRECT_ROUTED_SRC} not found, cannot rebuild direct_routed"
|
echo "[patch_ops] WARNING: prebuilt corex_moe_direct_routed.so not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Deploy ix_bridge Python integration layer --------------------------------
|
# --- Deploy ix_bridge Python integration layer --------------------------------
|
||||||
@@ -422,74 +401,38 @@ if b"max_completion_tokens" not in installed:
|
|||||||
raise SystemExit("protocol.py missing max_completion_tokens field")
|
raise SystemExit("protocol.py missing max_completion_tokens field")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
build_stage "building CUTLASS grouped GEMM (gemm_grouped.so)"
|
# =====================================================================
|
||||||
if [[ -f "${EX_ENGINE_DIR}/build_gemm_grouped.sh" ]]; then
|
# Deploy prebuilt .so files — NO compilation at Docker build time.
|
||||||
bash "${EX_ENGINE_DIR}/build_gemm_grouped.sh" 2>&1 || {
|
# All .so were pre-compiled on real BI-V100 hardware and verified.
|
||||||
echo "[WARN] gemm_grouped build failed — will use torch.mm fallback"
|
# This saves ~20-30 minutes and avoids GPU/toolchain requirements.
|
||||||
}
|
# =====================================================================
|
||||||
# Deploy compiled .so if it exists
|
build_stage "deploying prebuilt gemm_grouped.so"
|
||||||
for so in "${EX_ENGINE_DIR}"/gemm_grouped.so "${EX_ENGINE_DIR}"/csrc/gemm_grouped.so; do
|
PREBUILT_GEMM="./prebuilt/corex-3.2.3-ivcore10/gemm_grouped.so"
|
||||||
if [[ -f "$so" ]]; then
|
if [[ -f "$PREBUILT_GEMM" ]]; then
|
||||||
cp "$so" "${VLLM_ROOT}/gemm_grouped.so"
|
install -m 0755 "$PREBUILT_GEMM" "${VLLM_ROOT}/gemm_grouped.so"
|
||||||
echo "[patch_ops] deployed gemm_grouped.so → ${VLLM_ROOT}/"
|
echo "[patch_ops] deployed prebuilt gemm_grouped.so → ${VLLM_ROOT}/"
|
||||||
break
|
else
|
||||||
fi
|
echo "[WARN] prebuilt gemm_grouped.so not found"
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_stage "building CUTLASS batched GEMM (corex_batched_gemm.so)"
|
build_stage "deploying prebuilt corex_batched_gemm.so"
|
||||||
if [[ -f "${EX_ENGINE_DIR}/xllm_kernels/cuda/corex_batched_gemm_kernel.cu" ]]; then
|
PREBUILT_BATCHED="./prebuilt/corex-3.2.3-ivcore10/corex_batched_gemm.so"
|
||||||
python3 << PYEOF
|
if [[ -f "$PREBUILT_BATCHED" ]]; then
|
||||||
import os, sys, shutil
|
install -m 0755 "$PREBUILT_BATCHED" "${VLLM_ROOT}/corex_batched_gemm.so"
|
||||||
try:
|
echo "[patch_ops] deployed prebuilt corex_batched_gemm.so → ${VLLM_ROOT}/"
|
||||||
from torch.utils.cpp_extension import load
|
else
|
||||||
ex = "${EX_ENGINE_DIR}"
|
echo "[WARN] prebuilt corex_batched_gemm.so not found"
|
||||||
cutlass_inc = ""
|
|
||||||
for d in ["/usr/local/corex-samples-3.2.3_x86_64/samples/cutlass/include",
|
|
||||||
"/usr/local/corex/include/cutlass", "/usr/include/cutlass"]:
|
|
||||||
if os.path.isdir(d):
|
|
||||||
cutlass_inc = d
|
|
||||||
break
|
|
||||||
if not cutlass_inc:
|
|
||||||
print("[batched_gemm] No cutlass headers — skip"); sys.exit(0)
|
|
||||||
mod = load(
|
|
||||||
name="corex_batched_gemm",
|
|
||||||
sources=[
|
|
||||||
os.path.join(ex, "xllm_kernels/cuda/corex_batched_gemm_kernel.cu"),
|
|
||||||
os.path.join(ex, "xllm_kernels/cuda/bindings/corex_batched_gemm_bind.cpp"),
|
|
||||||
],
|
|
||||||
extra_include_paths=[cutlass_inc],
|
|
||||||
extra_cflags=["-O2", "-std=c++17"],
|
|
||||||
extra_cuda_cflags=["-O2", f"-I{cutlass_inc}"],
|
|
||||||
extra_ldflags=["/usr/local/corex/lib64/libcuinfer.so", "-Wl,-rpath,/usr/local/corex/lib64"],
|
|
||||||
verbose=False,
|
|
||||||
)
|
|
||||||
print("[batched_gemm] ✓ Compiled")
|
|
||||||
import importlib
|
|
||||||
spec = importlib.util.find_spec("corex_batched_gemm")
|
|
||||||
if spec and spec.origin:
|
|
||||||
shutil.copy2(spec.origin, "${VLLM_ROOT}/corex_batched_gemm.so")
|
|
||||||
print("[batched_gemm] ✓ Deployed to ${VLLM_ROOT}/")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"[batched_gemm] WARN: {e}")
|
|
||||||
PYEOF
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_stage "building MoE bridge (ix_moe_bridge.so)"
|
build_stage "deploying prebuilt ix_moe_bridge.so"
|
||||||
if [[ -f "${EX_ENGINE_DIR}/csrc/ix_moe_bridge.cpp" ]]; then
|
PREBUILT_MOE="./prebuilt/corex-3.2.3-ivcore10/ix_moe_bridge.so"
|
||||||
SCRIPT_DIR="${EX_ENGINE_DIR}" bash "${EX_ENGINE_DIR}/build_moe_bridge.sh" "${VLLM_ROOT}" 2>&1 || {
|
if [[ -f "$PREBUILT_MOE" ]]; then
|
||||||
echo "[WARN] MoE bridge build failed — will use Python fallback"
|
install -m 0755 "$PREBUILT_MOE" "${VLLM_ROOT}/ix_moe_bridge.so"
|
||||||
}
|
cp "$PREBUILT_MOE" "${VLLM_ROOT}/model_executor/models/ix_moe_bridge.so" 2>/dev/null || true
|
||||||
# Deploy .so to all paths ix_fused_moe.py searches
|
cp "$PREBUILT_MOE" "${VLLM_ROOT}/ex_engine/ix_moe_bridge.so" 2>/dev/null || true
|
||||||
for src in "${VLLM_ROOT}/ex_engine/ix_moe_bridge.so" \
|
echo "[patch_ops] deployed prebuilt ix_moe_bridge.so → ${VLLM_ROOT}/ + model_executor/ + ex_engine/"
|
||||||
"${EX_ENGINE_DIR}/prebuilt/ix_moe_bridge.so"; do
|
else
|
||||||
if [[ -f "$src" ]]; then
|
echo "[WARN] prebuilt ix_moe_bridge.so not found"
|
||||||
cp "$src" "${VLLM_ROOT}/ix_moe_bridge.so" 2>/dev/null || true
|
|
||||||
cp "$src" "${VLLM_ROOT}/model_executor/models/ix_moe_bridge.so" 2>/dev/null || true
|
|
||||||
echo "[patch_ops] deployed ix_moe_bridge.so to vllm search paths"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_stage "deploying fused linear+allreduce bridge (ix_full_bridge_fused_ar.so)"
|
build_stage "deploying fused linear+allreduce bridge (ix_full_bridge_fused_ar.so)"
|
||||||
|
|||||||
Reference in New Issue
Block a user