Skip to content
Closed
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
17 changes: 16 additions & 1 deletion transformer_engine/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,22 @@ def _load_core_library():
build_rocm_version = list(filter(lambda f: f.startswith("ROCM_VERSION:"), build_info))
if build_rocm_version:
build_rocm_version = build_rocm_version[0].split(":")[1].strip().split('.')[:2]
assert (rocm_version == build_rocm_version), f"ROCm {'.'.join(rocm_version)} is detected but the library is built for {'.'.join(build_rocm_version)}"
# Strict by default. Set NVTE_ALLOW_ROCM_MISMATCH=1 to bypass.
allow_rocm_mismatch = os.getenv("NVTE_ALLOW_ROCM_MISMATCH", "0").strip().lower() in ("1", "true", "yes")
mismatch_detected = rocm_version != build_rocm_version
if allow_rocm_mismatch and mismatch_detected:
_logger.warning(
"NVTE_ALLOW_ROCM_MISMATCH is enabled. Proceeding despite ROCm runtime/build "
"version mismatch (runtime=%s, build=%s).",
".".join(rocm_version),
".".join(build_rocm_version),
)
elif mismatch_detected:
raise RuntimeError(
f"ROCm {'.'.join(rocm_version)} is detected but the library is built for "
f"{'.'.join(build_rocm_version)}. Set NVTE_ALLOW_ROCM_MISMATCH=1 to bypass "
"this check at your own risk."
)
except FileNotFoundError:
pass

Loading