Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions custom_ops/xpu_ops/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,28 @@ SYSTEM_VERSION=`${python} -c "import platform; print(platform.system().lower())"
PROCESSOR_VERSION=`${python} -c "import platform; print(platform.processor())"`
WHEEL_NAME="fastdeploy_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"

# Add compatibility for modern python packaging methods
WHEEL_MODERN_NAME="fastdeploy_ops"

${python} setup_ops.py install --install-lib ${OPS_TMP_DIR}
mkdir -p ${OPS_TMP_DIR}/${WHEEL_NAME}/libs
cp ${XVLLM_PATH}/xft_blocks/so/libxft_blocks.so ${OPS_TMP_DIR}/${WHEEL_NAME}/libs/
cp ${XVLLM_PATH}/infer_ops/so/libapiinfer.so ${OPS_TMP_DIR}/${WHEEL_NAME}/libs/
patchelf --set-rpath '$ORIGIN/libs' ${OPS_TMP_DIR}/${WHEEL_NAME}/fastdeploy_ops_pd_.so

# Handle directory compatibility between modern and legacy naming
if [ -d "./${OPS_TMP_DIR}/${WHEEL_MODERN_NAME}" ]; then
echo -e "${GREEN}[Info]${NONE} Ready to use ops from modern directory ${WHEEL_MODERN_NAME}"
# Use modern directory name
TARGET_DIR="${OPS_TMP_DIR}/${WHEEL_MODERN_NAME}"
else
# If modern directory doesn't exist, check for legacy directory
if [ -d "./${OPS_TMP_DIR}/${WHEEL_NAME}" ]; then
echo -e "${YELLOW}[Warning]${NONE} ${WHEEL_NAME} directory exists. This is a deprecated packaging and distribution method."
else
echo -e "${RED}[Error]${NONE} Neither modern nor legacy directory found in ${OPS_TMP_DIR}"
fi
# Use legacy directory name
TARGET_DIR="${OPS_TMP_DIR}/${WHEEL_NAME}"
fi

mkdir -p ${TARGET_DIR}/libs
cp ${XVLLM_PATH}/xft_blocks/so/libxft_blocks.so ${TARGET_DIR}/libs/
cp ${XVLLM_PATH}/infer_ops/so/libapiinfer.so ${TARGET_DIR}/libs/
patchelf --set-rpath '$ORIGIN/libs' ${TARGET_DIR}/fastdeploy_ops_pd_.so
Loading