Skip to content

Commit 2fadfe7

Browse files
authored
[Liger-Kernels] Fix Liger-Kernels tests hanging (#5382)
Resolves #5292 There's also refactoring of Liger-Kernels installation to be consistent with sglang, vllm PR depends on: - [x] #5376 Before merging: - [x] Merge #5376 - [x] Test third-party testing CI, there should be no hanging for liger kernels - [x] Test third-party benchmarks CI
1 parent bd13369 commit 2fadfe7

File tree

5 files changed

+44
-24
lines changed

5 files changed

+44
-24
lines changed

.github/workflows/third-party-benchmarks.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,18 @@ jobs:
104104
python transform_results.py $REPORTS/moe-gemm-performance.csv $REPORTS/moe-gemm-fp8-report.csv --tag $TAG --benchmark moe-fp8-benchmark
105105
106106
- name: Run Liger-Kernel benchmarks
107-
if: ${{ steps.install.outcome == 'success' && !cancelled() && (inputs.benchmarks == '' || contains(fromJson(inputs.benchmarks || '[]'), 'liger-kernel')) }}
107+
if: ${{ steps.install.outcome == 'success' && !cancelled() && (inputs.benchmarks == '' || contains(fromJson(inputs.benchmarks || '[]'), 'liger')) }}
108108
run: |
109109
source ./scripts/capture-hw-details.sh
110110
111-
cd benchmarks/third_party/liger_kernels
112-
113-
git clone https://github.com/linkedin/Liger-Kernel
114-
pip install -e Liger-Kernel
111+
./scripts/test-triton.sh --install-liger --skip-pip-install --skip-pytorch-install
115112
116113
# To remember return code, but still copy results
117114
RET_CODE=0
118-
bash ./run_benchmarks.sh || RET_CODE=$?
115+
bash benchmarks/third_party/liger/run_benchmarks.sh || RET_CODE=$?
119116
120117
cp Liger-Kernel/benchmark/data/all_benchmark_data.csv $REPORTS/liger-raw.csv
121-
python transform.py $REPORTS/liger-raw.csv $REPORTS/liger-report.csv --tag $TAG
118+
python benchmarks/third_party/liger/transform.py $REPORTS/liger-raw.csv $REPORTS/liger-report.csv --tag $TAG
122119
123120
# Return the captured return code at the end
124121
exit "$RET_CODE"
File renamed without changes.

scripts/test-triton.sh

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ TEST:
2626
--flex-attention
2727
--instrumentation
2828
--inductor
29-
--sglang
30-
--liger
3129
--vllm
3230
--install-vllm
31+
--sglang
3332
--install-sglang
33+
--liger
34+
--install-liger
3435
3536
OPTION:
3637
--unskip
@@ -72,10 +73,11 @@ TEST_BENCHMARK_FLEX_ATTENTION=false
7273
TEST_INSTRUMENTATION=false
7374
TEST_INDUCTOR=false
7475
TEST_SGLANG=false
76+
INSTALL_SGLANG=false
7577
TEST_LIGER=false
78+
INSTALL_LIGER=false
7679
TEST_VLLM=false
7780
INSTALL_VLLM=false
78-
INSTALL_SGLANG=false
7981
TEST_TRITON_KERNELS=false
8082
VENV=false
8183
TRITON_TEST_REPORTS=false
@@ -192,13 +194,13 @@ while (( $# != 0 )); do
192194
TEST_DEFAULT=false
193195
shift
194196
;;
195-
--install-sglang)
196-
INSTALL_SGLANG=true
197+
--sglang)
198+
TEST_SGLANG=true
197199
TEST_DEFAULT=false
198200
shift
199201
;;
200-
--sglang)
201-
TEST_SGLANG=true
202+
--install-sglang)
203+
INSTALL_SGLANG=true
202204
TEST_DEFAULT=false
203205
shift
204206
;;
@@ -207,6 +209,11 @@ while (( $# != 0 )); do
207209
TEST_DEFAULT=false
208210
shift
209211
;;
212+
--install-liger)
213+
INSTALL_LIGER=true
214+
TEST_DEFAULT=false
215+
shift
216+
;;
210217
--vllm)
211218
TEST_VLLM=true
212219
TEST_DEFAULT=false
@@ -596,6 +603,10 @@ run_inductor_tests() {
596603
grep AlbertForMaskedLM inductor_log.csv | grep -q ,pass,
597604
}
598605

606+
run_test_deps_install() {
607+
pip install pytest pytest-cov pytest-xdist
608+
}
609+
599610
run_sglang_install() {
600611
echo "************************************************"
601612
echo "****** Installing SGLang ****"
@@ -620,8 +631,6 @@ run_sglang_install() {
620631
pip install -e "./python"
621632
cd ..
622633
fi
623-
624-
pip install pytest pytest-cov pytest-xdist
625634
}
626635

627636
run_sglang_tests() {
@@ -630,24 +639,34 @@ run_sglang_tests() {
630639
echo "***************************************************"
631640

632641
run_sglang_install
642+
run_test_deps_install
633643
cd sglang
634644
run_pytest_command -vvv -n ${PYTEST_MAX_PROCESSES:-4} test/srt/test_triton_attention_kernels.py
635645
}
636646

637-
run_liger_tests() {
647+
run_liger_install() {
638648
echo "************************************************"
639-
echo "****** Running Liger Triton tests ******"
649+
echo "****** Installing Liger-Kernel ******"
640650
echo "************************************************"
641651

642652
if ! [ -d "./Liger-Kernel" ]; then
643653
git clone https://github.com/linkedin/Liger-Kernel
644654
fi
645655

646656
if ! pip list | grep "liger_kernel" ; then
647-
pip install pytest pytest-xdist pytest-cov transformers pandas pytest datasets -e Liger-Kernel
657+
pip install transformers pandas datasets -e Liger-Kernel
648658
fi
659+
}
660+
661+
662+
run_liger_tests() {
663+
echo "************************************************"
664+
echo "****** Running Liger-Kernel tests ******"
665+
echo "************************************************"
649666

650-
run_pytest_command -vvv -n ${PYTEST_MAX_PROCESSES:-4} Liger-Kernel/test/
667+
run_liger_install
668+
run_test_deps_install
669+
run_pytest_command -vvv Liger-Kernel/test/
651670
}
652671

653672
run_vllm_install() {
@@ -678,7 +697,7 @@ run_vllm_install() {
678697
VLLM_TARGET_DEVICE=xpu pip install --no-deps --no-build-isolation -e vllm
679698
fi
680699

681-
pip install pytest pytest-cov pytest-xdist cachetools cbor2 blake3 pybase64 openai_harmony tblib
700+
pip install cachetools cbor2 blake3 pybase64 openai_harmony tblib
682701
}
683702

684703

@@ -688,6 +707,7 @@ run_vllm_tests() {
688707
echo "************************************************"
689708

690709
run_vllm_install
710+
run_test_deps_install
691711

692712
cd vllm
693713
run_pytest_command -vvv tests/kernels/moe/test_batched_moe.py tests/kernels/attention/test_triton_unified_attention.py
@@ -774,15 +794,18 @@ test_triton() {
774794
if [ "$TEST_SGLANG" == true ]; then
775795
run_sglang_tests
776796
fi
797+
if [ "$INSTALL_LIGER" == true ]; then
798+
run_liger_install
799+
fi
777800
if [ "$TEST_LIGER" == true ]; then
778801
run_liger_tests
779802
fi
780-
if [ "$TEST_VLLM" == true ]; then
781-
run_vllm_tests
782-
fi
783803
if [ "$INSTALL_VLLM" == true ]; then
784804
run_vllm_install
785805
fi
806+
if [ "$TEST_VLLM" == true ]; then
807+
run_vllm_tests
808+
fi
786809
if [ "$TEST_TRITON_KERNELS" == true ]; then
787810
run_triton_kernels_tests
788811
fi

0 commit comments

Comments
 (0)