Skip to content
Open
Show file tree
Hide file tree
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
100 changes: 97 additions & 3 deletions tests/ep/demo/run_tilexr_ep_dispatch_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ TILEXR_ROOT="$(cd "${EP_DIR}/../.." && pwd)"
INSTALL_DIR="${EP_DIR}/install"

rank_size="${1:-2}"
npu_count="${2:-${rank_size}}"
first_npu="${3:-0}"
if [[ $# -gt 0 ]]; then
shift
fi
npu_count="${1:-${rank_size}}"
if [[ $# -gt 0 ]]; then
shift
fi
first_npu="${1:-0}"
if [[ $# -gt 0 ]]; then
shift
fi

: "${ASCEND_HOME_PATH:=}"
: "${LD_LIBRARY_PATH:=}"
Expand All @@ -19,6 +28,91 @@ export TILEXR_DEMO_NPUS="${npu_count}"
export TILEXR_DEMO_FIRST_NPU="${first_npu}"
export LD_LIBRARY_PATH="${TILEXR_ROOT}/install/lib64:${TILEXR_ROOT}/install/lib:${INSTALL_DIR}/lib64:${INSTALL_DIR}/lib:${LD_LIBRARY_PATH:-}"

demo_args=()
while [[ $# -gt 0 ]]; do
case "$1" in
--mode)
export TILEXR_EP_DEMO_MODE="${2:?missing value for --mode}"
demo_args+=("$1" "$2")
shift 2
;;
--bs)
export TILEXR_EP_DEMO_BS="${2:?missing value for --bs}"
demo_args+=("$1" "$2")
shift 2
;;
--h)
export TILEXR_EP_DEMO_H="${2:?missing value for --h}"
demo_args+=("$1" "$2")
shift 2
;;
--k)
export TILEXR_EP_DEMO_TOPK="${2:?missing value for --k}"
demo_args+=("$1" "$2")
shift 2
;;
--moe-expert-num)
export TILEXR_EP_DEMO_MOE_EXPERT_NUM="${2:?missing value for --moe-expert-num}"
demo_args+=("$1" "$2")
shift 2
;;
--expert-token-nums-type)
export TILEXR_EP_DEMO_EXPERT_TOKEN_NUMS_TYPE="${2:?missing value for --expert-token-nums-type}"
demo_args+=("$1" "$2")
shift 2
;;
--active-mask)
export TILEXR_EP_DEMO_ACTIVE_MASK=1
demo_args+=("$1")
shift
;;
--tp-world-size)
export TILEXR_EP_DEMO_TP_WORLD_SIZE="${2:?missing value for --tp-world-size}"
demo_args+=("$1" "$2")
shift 2
;;
--tp-rank-id)
export TILEXR_EP_DEMO_TP_RANK_ID="${2:?missing value for --tp-rank-id}"
demo_args+=("$1" "$2")
shift 2
;;
--tp-recv-counts)
export TILEXR_EP_DEMO_TP_RECV_COUNTS=1
demo_args+=("$1")
shift
;;
--shared-expert-num)
export TILEXR_EP_DEMO_SHARED_EXPERT_NUM="${2:?missing value for --shared-expert-num}"
demo_args+=("$1" "$2")
shift 2
;;
--shared-expert-rank-num)
export TILEXR_EP_DEMO_SHARED_EXPERT_RANK_NUM="${2:?missing value for --shared-expert-rank-num}"
demo_args+=("$1" "$2")
shift 2
;;
--quant-mode)
export TILEXR_EP_DEMO_QUANT_MODE="${2:?missing value for --quant-mode}"
demo_args+=("$1" "$2")
shift 2
;;
--static-quant-scale)
export TILEXR_EP_DEMO_STATIC_QUANT_SCALE="${2:?missing value for --static-quant-scale}"
demo_args+=("$1" "$2")
shift 2
;;
--dump-window)
export TILEXR_EP_DEMO_DUMP_WINDOW=1
demo_args+=("$1")
shift
;;
*)
demo_args+=("$1")
shift
;;
esac
done

bin="${INSTALL_DIR}/bin/tilexr_ep_dispatch_demo"
if [[ ! -x "${bin}" ]]; then
echo "Missing demo binary: ${bin}" >&2
Expand All @@ -37,7 +131,7 @@ for ((rank = 0; rank < rank_size; ++rank)); do
(
export RANK="${rank}"
export RANK_SIZE="${rank_size}"
exec "${bin}" "${rank_size}" "${rank}" "${npu_count}" "${first_npu}"
exec "${bin}" "${rank_size}" "${rank}" "${npu_count}" "${first_npu}" "${demo_args[@]}"
) >"${log}" 2>&1 &
pids+=("$!")
done
Expand Down
Loading