Skip to content
Open
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
19 changes: 18 additions & 1 deletion cutile-rs/scripts/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ while [[ $# -gt 0 ]]; do
esac
done

# reference-cpu pulls in candle, whose gemm-f16 kernels use FP16 arithmetic
# instructions that the generic aarch64 target does not enable. Turn on just
# that extension when this CPU has it (asimdhp); otherwise build without
# reference-cpu and skip the examples that require it.
SKIP_EXAMPLES=()
if [[ "$(uname -m)" == "aarch64" && "$EXTRA_FEATURES" == *reference-cpu* ]]; then
if grep -qw asimdhp /proc/cpuinfo; then
export RUSTFLAGS="${RUSTFLAGS:+$RUSTFLAGS }-C target-feature=+fp16"
else
features="${EXTRA_FEATURES#--features }"
features=$(tr ',' '\n' <<< "$features" | grep -vx 'reference-cpu' | paste -sd, -)
EXTRA_FEATURES="${features:+--features $features}"
SKIP_EXAMPLES=(async_gemm flash_attention)
echo "No FP16 arithmetic on this aarch64 CPU: skipping the reference-cpu examples"
fi
fi

if [[ -n "$EXTRA_FEATURES" ]]; then
print_header "Running examples ($EXTRA_FEATURES)"
else
Expand All @@ -28,7 +45,7 @@ run_step \

echo -e "${YELLOW}>>> Running cutile-examples (GPU)${NC}"
cd "$REPO_ROOT/cutile-examples" || exit 1
run_examples "$REPO_ROOT/cutile-examples/examples" $EXTRA_FEATURES
run_examples "$REPO_ROOT/cutile-examples/examples" $EXTRA_FEATURES "${SKIP_EXAMPLES[@]}"

print_summary_and_exit \
"All supported examples passed (see skipped examples above)." \
Expand Down