diff --git a/mlir/utils/tuna/tuna-script.sh b/mlir/utils/tuna/tuna-script.sh index cd966654a079..77d420df2f98 100755 --- a/mlir/utils/tuna/tuna-script.sh +++ b/mlir/utils/tuna/tuna-script.sh @@ -158,4 +158,12 @@ if [ "${VIRTUAL_ENV:-}" = "" ]; then source /tuna-venv/bin/activate fi +# Ensure hip-python is importable +if ! python3 -c "from hip import hip" 2>/dev/null; then + HIP_PY_DIR=$(mktemp -d) + python3 -m pip install --index-url https://test.pypi.org/simple/ \ + --target "$HIP_PY_DIR" hip-python + export PYTHONPATH="${HIP_PY_DIR}:${PYTHONPATH:-}" +fi + tuna_run "$OP" "$TUNING_SPACE"