### What this PR does / why we need it? 1. Fixes the environment path used to locate custom op shared libraries. 2. Uses empty tensor initialization for op outputs instead of zero-initialization for better efficiency. - vLLM version: v0.11.2 - vLLM main: https://github.com/vllm-project/vllm/commit/v0.11.2 --------- Signed-off-by: QianChenxi <chenxi.qian.cq@outlook.com>
34 lines
934 B
Bash
34 lines
934 B
Bash
#!/bin/bash
|
|
|
|
ROOT_DIR=$1
|
|
SOC_VERSION=$2
|
|
|
|
if [[ "$SOC_VERSION" =~ ^ascend310 ]]; then
|
|
# ASCEND310P series
|
|
# currently, no custom aclnn ops for ASCEND310 series
|
|
# CUSTOM_OPS=""
|
|
# SOC_ARG="ascend310p"
|
|
exit 0
|
|
elif [[ "$SOC_VERSION" =~ ^ascend910b ]]; then
|
|
# ASCEND910B (A2) series
|
|
CUSTOM_OPS="grouped_matmul_swiglu_quant_weight_nz_tensor_list"
|
|
SOC_ARG="ascend910b"
|
|
elif [[ "$SOC_VERSION" =~ ^ascend910_93 ]]; then
|
|
# ASCEND910C (A3) series
|
|
CUSTOM_OPS="grouped_matmul_swiglu_quant_weight_nz_tensor_list"
|
|
SOC_ARG="ascend910_93"
|
|
else
|
|
# others
|
|
# currently, no custom aclnn ops for other series
|
|
exit 0
|
|
fi
|
|
|
|
# build custom ops
|
|
cd csrc
|
|
rm -rf build output
|
|
echo "building custom ops $CUSTOM_OPS for $SOC_VERSION"
|
|
bash build.sh -n $CUSTOM_OPS -c $SOC_ARG
|
|
|
|
# install custom ops to vllm_ascend/_cann_ops_custom
|
|
./output/CANN-custom_ops*.run --install-path=$ROOT_DIR/vllm_ascend/_cann_ops_custom
|