Skip to content

Commit 8a3058d

Browse files
authored
Merge pull request #2232 from mhalk/mhalk/amd/dev/mhalkenh/feat/ci-llama-returncode-propagation
[CI] run_llama.sh: Add returncode propagation of llama-bench
2 parents 6d34ae9 + eaaa6cc commit 8a3058d

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

bin/run_llama.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ if [ "${DoCTest}" == "yes" ]; then
121121
ctest --output-on-failure 2>&1 | tee "${LLAMA_TESTS_LOG_LOCATION}/ctest.log"
122122
fi
123123

124+
run_llama_bench() {
125+
./bin/llama-bench "$@" 2>&1 | tee -a "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
126+
BenchStatus=${PIPESTATUS[0]}
127+
128+
if [ "${BenchStatus}" -ne 0 ]; then
129+
echo "ERROR: llama-bench failed with exit code ${BenchStatus}" | tee -a "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
130+
return "${BenchStatus}"
131+
fi
132+
}
133+
124134
if [ "${DoBenchmark}" == "yes" ]; then
125135
echo "Running benchmark..."
126136
cd "${LLAMA_BUILD_DIR}" || exit
@@ -148,8 +158,7 @@ if [ "${DoBenchmark}" == "yes" ]; then
148158
if [ ${#ModelPaths[@]} -eq 0 ] && ./bin/llama-bench --help 2>&1 | grep -q -- "--hf-repo"; then
149159
# Let llama-bench resolve/download the HF model directly. Using llama-cli as
150160
# a prefetch step can hang in ROCm/KFD waits on cold cache.
151-
./bin/llama-bench -hf "${LLAMA_BENCH_HF_ID}" -ngl 999 -fa 1 -ub 2048 \
152-
2>&1 | tee -a "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
161+
run_llama_bench -hf "${LLAMA_BENCH_HF_ID}" -ngl 999 -fa 1 -ub 2048 || exit $?
153162
else
154163
if [ ${#ModelPaths[@]} -eq 0 ]; then
155164
echo "ERROR: No model files found in cache directory: ${CacheDir}"
@@ -159,7 +168,7 @@ if [ "${DoBenchmark}" == "yes" ]; then
159168
# Run benchmark for each model
160169
for LlamaModelPath in "${ModelPaths[@]}"; do
161170
echo "Benchmarking: ${LlamaModelPath}" | tee -a "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
162-
./bin/llama-bench -ngl 999 -fa 1 -ub 2048 -m "${LlamaModelPath}" 2>&1 | tee -a "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
171+
run_llama_bench -ngl 999 -fa 1 -ub 2048 -m "${LlamaModelPath}" || exit $?
163172
done
164173
fi
165174
fi

0 commit comments

Comments
 (0)