Skip to content
Merged
Show file tree
Hide file tree
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
27 changes: 24 additions & 3 deletions script/get-mlperf-single-node-system-info/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
},
"accelerator_memory_type": {
"source": "env",
"candidates": ["MLC_CUDA_DEVICE_PROP_MEMORY_TYPE", "MLC_XPU_DEVICE_PROP_MEMORY_TYPE", "MLC_TPU_DEVICE_PROP_MEMORY_TYPE"],
"candidates": ["MLC_CUDA_DEVICE_PROP_MEMORY_TYPE", "MLC_ROCM_DEVICE_PROP_MEMORY_TYPE", "MLC_XPU_DEVICE_PROP_MEMORY_TYPE", "MLC_TPU_DEVICE_PROP_MEMORY_TYPE"],
},
"accelerator_interconnect": {
"source": "env",
Expand Down Expand Up @@ -211,6 +211,22 @@ def _pip_version(package):
return None


def _rocm_runtime_version():
"""ROCm major.minor from get-rocm-devices' HIP runtime version.

hipRuntimeGetVersion() encodes the version as
major * 10000000 + minor * 100000 + build (e.g. 70226015 for 7.2), which
is what current get-rocm-devices exports. A value that is already dotted
is passed through as is.
"""
raw = os.environ.get(
"MLC_ROCM_DEVICE_PROP_ROCM_RUNTIME_VERSION", "").strip()
if not raw.isdigit() or int(raw) < 10000000:
return raw
encoded = int(raw)
return f"{encoded // 10000000}.{encoded // 100000 % 100}"


def detect_inference_backend():
"""Build inference backend string from CUDA/ROCm/TPU + cuDNN versions."""
parts = []
Expand All @@ -221,7 +237,8 @@ def detect_inference_backend():
parts.append(f"CUDA {cuda_runtime}")

rocm_version = (os.environ.get("MLC_ROCM_VERSION", "")
or os.environ.get("MLC_ROCM_DEVICE_PROP_ROCM_VERSION", ""))
or os.environ.get("MLC_ROCM_DEVICE_PROP_ROCM_VERSION", "")
or _rocm_runtime_version())
if rocm_version:
parts.append(f"ROCm {rocm_version}")

Expand Down Expand Up @@ -266,10 +283,13 @@ def extract_value(rule, field_key):
elif field_key == "accelerator_memory_configuration":
mem_bytes_str = (
os.environ.get("MLC_CUDA_DEVICE_PROP_GLOBAL_MEMORY", "")
or os.environ.get(
"MLC_ROCM_DEVICE_PROP_GLOBAL_MEMORY_IN_GIB", "")
or os.environ.get("MLC_TPU_DEVICE_PROP_GLOBAL_MEMORY", "")
).strip()
mem_type = (
os.environ.get("MLC_CUDA_DEVICE_PROP_MEMORY_TYPE", "")
or os.environ.get("MLC_ROCM_DEVICE_PROP_MEMORY_TYPE", "")
or os.environ.get("MLC_TPU_DEVICE_PROP_MEMORY_TYPE", "")
).strip()
parts = []
Expand All @@ -280,7 +300,8 @@ def extract_value(rule, field_key):
parts.append(
f"{math.ceil(mem_bytes / (1024 ** 3))} GiB")
else:
# Already in GiB (e.g. "95 GiB" from get-tpu-devices)
# Already in GiB (ROCm, or e.g. "95 GiB" from
# get-tpu-devices)
parts.append(f"{math.ceil(mem_bytes)} GiB")
except (ValueError, IndexError):
pass
Expand Down
7 changes: 7 additions & 0 deletions script/get-rocm-devices/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def get_gpu_info():
gpu_name = ""
host_interconnect_result = ""
gpu_interconnect_result = ""
memory_type = ""
try:
gpu_result = subprocess.run(
["amd-smi", "static", "--gpu", str(i), "--json"], capture_output=True, text=True)
Expand All @@ -51,6 +52,11 @@ def get_gpu_info():
"market_name",
"") or "")
gpu_name = gpu_name.replace("™", "").replace("®", "").strip()
# VRAM type, e.g. "GDDR6" or "HBM3"; amd-smi reports "N/A" when
# it cannot tell.
memory_type = (gpu_static.get("vram", {}).get("type", "") or "")
if memory_type.upper() == "N/A":
memory_type = ""
except Exception as e:
print(f"Error occurred while fetching info for GPU {i}: {str(e)}")

Expand All @@ -72,6 +78,7 @@ def get_gpu_info():
"ROCM driver version": f"{hip.hipDriverGetVersion()[1]}",
"ROCM runtime version": hip.hipRuntimeGetVersion()[1],
"Global memory in GiB": hip.hipDeviceTotalMem(i)[1] / 1_073_741_824,
"Memory Type": memory_type,
"Max clock rate": f"{hip.hipDeviceGetAttribute(hip.hipDeviceAttribute_t(hipDeviceAttributeClockRate), i)[1] / 1000} MHz",
"Total amount of shared memory per block in bytes": f"{hip.hipDeviceGetAttribute(hip.hipDeviceAttribute_t(hipDeviceAttributeMaxSharedMemoryPerBlock), i)[1]}",
"Total number of registers available per block in bytes": f"{hip.hipDeviceGetAttribute(hip.hipDeviceAttribute_t(hipDeviceAttributeMaxRegistersPerBlock), i)[1]}",
Expand Down
Loading