Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 5 additions & 11 deletions install_npuir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,17 @@ normalize_cann_version() {
echo "9.0.0.beta2"
;;
*)
return 1
echo "8.5.0"
;;
Comment thread
buaazhangs marked this conversation as resolved.
esac
}

infer_cann_version_from_env() {
local current_home="${ASCEND_HOME_PATH}"
if [ -z "$current_home" ]; then
echo "Error: neither --cann-version nor ASCEND_HOME_PATH is set." >&2
echo "Please choose one of the following before re-running:" >&2
echo " 1. Pass --cann-version=<${SUPPORTED_CANN_VERSIONS[*]}>" >&2
echo " 2. Export ASCEND_HOME_PATH to a supported CANN install, then re-run" >&2
return 1
echo "Warning: neither --cann-version nor ASCEND_HOME_PATH is set; defaulting to 8.5.0." >&2
echo "8.5.0"
return 0
fi
normalize_cann_version "$current_home"
}
Expand Down Expand Up @@ -119,11 +117,7 @@ while [[ $# -gt 0 ]]; do
done

if [ -n "$CANN_VERSION" ]; then
CANN_VERSION="$(normalize_cann_version "$CANN_VERSION")" || {
echo "Error: Unsupported CANN version '$CANN_VERSION'." >&2
print_usage
exit 1
}
CANN_VERSION="$(normalize_cann_version "$CANN_VERSION")"
else
CANN_VERSION="$(infer_cann_version_from_env)" || {
print_usage
Expand Down
14 changes: 2 additions & 12 deletions tilelang/utils/npu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ def get_device_num(self):

def _normalize_cann_version(value: str) -> str:
Comment thread
buaazhangs marked this conversation as resolved.
Outdated
if not value:
raise ValueError(
"Unsupported CANN version: "
f"{value!r}. Supported versions: {', '.join(_SUPPORTED_CANN_TO_HIVMC)}"
)
return "8.5.0"

normalized = os.path.basename(value.rstrip("/").strip().lower())
if normalized.startswith("cann-"):
Expand All @@ -137,10 +134,7 @@ def _normalize_cann_version(value: str) -> str:
if re.fullmatch(r"9\.0\.0(?:[.-]?beta(?:[.-]?2)?)", normalized):
return "9.0.0.beta2"

raise ValueError(
"Unsupported CANN version: "
f"{value!r}. Supported versions: {', '.join(_SUPPORTED_CANN_TO_HIVMC)}"
)
return "8.5.0"
Comment thread
buaazhangs marked this conversation as resolved.


def get_configured_hivmc_version() -> str:
Expand All @@ -151,10 +145,6 @@ def get_configured_hivmc_version() -> str:
ascend_home = os.environ.get("ASCEND_HOME_PATH") or os.environ.get(
"ASCEND_HOME"
)
if not ascend_home:
raise ValueError(
"ASCEND_HOME_PATH is not set; unable to infer the target CANN version."
)
cann_version = _normalize_cann_version(ascend_home)
return _SUPPORTED_CANN_TO_HIVMC[cann_version]

Expand Down
Loading