* Implement AMDGPU driver info and GPU VRAM attributes in system info.
  section of analysis report.

* Backward compatibility for rocprofiler-sdk avail module path migration

* Fix roofline calculation where AI data points are N/A
This commit is contained in:
vedithal-amd
2025-11-21 10:54:25 -05:00
zatwierdzone przez GitHub
rodzic a2288eb50b
commit 6540155c9d
5 zmienionych plików z 76 dodań i 35 usunięć
@@ -19,6 +19,8 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.
* kernel: Counters are collected in a round robin fashion for unique kernels. * kernel: Counters are collected in a round robin fashion for unique kernels.
* kernel_launch_params: Counters are collected in a round robin fashion for unique kernels having the exact same launch parameters. * kernel_launch_params: Counters are collected in a round robin fashion for unique kernels having the exact same launch parameters.
* Implement AMDGPU driver info and GPU VRAM attributes in system info. section of analysis report.
### Changed ### Changed
* Default output format for the underlying ROCprofiler-SDK tool has been changed from ``csv`` to ``rocpd``. * Default output format for the underlying ROCprofiler-SDK tool has been changed from ``csv`` to ``rocpd``.
@@ -414,13 +414,28 @@ class OmniSoC_Base:
os.environ["ROCPROFILER_METRICS_PATH"] = str( os.environ["ROCPROFILER_METRICS_PATH"] = str(
config.rocprof_compute_home / "rocprof_compute_soc" / "profile_configs" config.rocprof_compute_home / "rocprof_compute_soc" / "profile_configs"
) )
sys.path.append(
str( # Backward compatibility support for sdk avail module moved from
Path(args.rocprofiler_sdk_tool_path).parents[1] # <rocm_path>/bin/rocprofv3_avail_module/avail.py to
/ "python3/site-packages" # <rocm_path>/lib/python3/site-packages/rocprofv3/avail.py
) new_path = str(
Path(args.rocprofiler_sdk_tool_path).parents[1] / "python3/site-packages"
) )
from rocprofv3 import avail old_path = str(Path(args.rocprofiler_sdk_tool_path).parents[2] / "bin")
try:
sys.path.append(new_path)
from rocprofv3 import avail
except ImportError:
console_debug(
f"Could not import rocprofiler-sdk avail module from {new_path}, "
f"trying {old_path}"
)
try:
sys.path.remove(new_path)
sys.path.append(old_path)
from rocprofv3_avail_module import avail
except ImportError:
console_error("Failed to import rocprofiler-sdk avail module.")
avail.loadLibrary.libname = str( avail.loadLibrary.libname = str(
Path(args.rocprofiler_sdk_tool_path).parent / "librocprofv3-list-avail.so" Path(args.rocprofiler_sdk_tool_path).parent / "librocprofv3-list-avail.so"
@@ -134,3 +134,27 @@ def get_gpu_memory_partition() -> str:
except Exception as e: except Exception as e:
console_warning(f"Error getting GPU memory partition: {e}") console_warning(f"Error getting GPU memory partition: {e}")
return "N/A" return "N/A"
def get_amdgpu_driver_version() -> str:
"""Get the AMDGPU driver version."""
try:
driver_info = amdsmi.amdsmi_get_gpu_driver_info(get_device_handle())
driver_version = driver_info["driver_version"]
console_debug(f"AMDGPU Driver Version: {driver_version}")
return driver_version
except Exception as e:
console_warning(f"Error getting AMDGPU driver version: {e}")
return "N/A"
def get_gpu_vram_size() -> int:
"""Get the GPU VRAM size in MB."""
try:
vram_info = amdsmi.amdsmi_get_gpu_vram_info(get_device_handle())
vram_size = str(int(vram_info["vram_size"]) * 1024) # MB -> KB
console_debug(f"GPU VRAM Size: {vram_size} MB")
return vram_size
except Exception as e:
console_warning(f"Error getting GPU VRAM size: {e}")
return 0
@@ -412,13 +412,13 @@ def calc_ai_analyze(
metric = row.get("Metric", "") metric = row.get("Metric", "")
value = row.get("Value", 0) value = row.get("Value", 0)
if metric == "AI HBM": if metric == "AI HBM":
ai_hbm = value if value and value != "" else 0 ai_hbm = value if value and value not in ("", "N/A") else 0
elif metric == "AI L2": elif metric == "AI L2":
ai_l2 = value if value and value != "" else 0 ai_l2 = value if value and value not in ("", "N/A") else 0
elif metric == "AI L1": elif metric == "AI L1":
ai_l1 = value if value and value != "" else 0 ai_l1 = value if value and value not in ("", "N/A") else 0
elif metric == "Performance (GFLOPs)": elif metric == "Performance (GFLOPs)":
performance = value if value and value != "" else 0 performance = value if value and value not in ("", "N/A") else 0
console_debug( console_debug(
"roofline", "roofline",
@@ -43,9 +43,11 @@ import pandas as pd
import config import config
from utils.amdsmi_interface import ( from utils.amdsmi_interface import (
amdsmi_ctx, amdsmi_ctx,
get_amdgpu_driver_version,
get_gpu_compute_partition, get_gpu_compute_partition,
get_gpu_memory_partition, get_gpu_memory_partition,
get_gpu_vbios_part_number, get_gpu_vbios_part_number,
get_gpu_vram_size,
) )
from utils.logger import ( from utils.logger import (
console_debug, console_debug,
@@ -182,25 +184,26 @@ def generate_machine_specs(
soc_info = extract_soc_info() soc_info = extract_soc_info()
# Combine all specifications # Combine all specifications
specs = MachineSpecs( with amdsmi_ctx():
version=specs_version, specs = MachineSpecs(
timestamp=timestamp, version=specs_version,
rocminfo_lines=soc_info["rocminfo_lines"], timestamp=timestamp,
hostname=socket.gethostname(), rocminfo_lines=soc_info["rocminfo_lines"],
cpu_model=machine_info["cpu_model"], hostname=socket.gethostname(),
sbios=machine_info["sbios"], cpu_model=machine_info["cpu_model"],
linux_kernel_version=machine_info["linux_kernel_version"], sbios=machine_info["sbios"],
amd_gpu_kernel_version="", linux_kernel_version=machine_info["linux_kernel_version"],
cpu_memory=machine_info["cpu_memory"], amd_gpu_kernel_version=get_amdgpu_driver_version(),
gpu_memory="", cpu_memory=machine_info["cpu_memory"],
linux_distro=machine_info["linux_distro"], gpu_memory=get_gpu_vram_size(),
rocm_version=get_rocm_ver().strip(), linux_distro=machine_info["linux_distro"],
vbios=gpu_info["vbios"], rocm_version=get_rocm_ver().strip(),
compute_partition=gpu_info["compute_partition"], vbios=gpu_info["vbios"],
memory_partition=gpu_info["memory_partition"], compute_partition=gpu_info["compute_partition"],
gpu_arch=soc_info["gpu_arch"], memory_partition=gpu_info["memory_partition"],
gpu_chip_id=soc_info["gpu_chip_id"], gpu_arch=soc_info["gpu_arch"],
) gpu_chip_id=soc_info["gpu_chip_id"],
)
# Load above SoC specs via module import # Load above SoC specs via module import
try: try:
@@ -436,10 +439,7 @@ class MachineSpecs:
amd_gpu_kernel_version: Optional[str] = field( amd_gpu_kernel_version: Optional[str] = field(
default=None, default=None,
metadata={ metadata={
"doc": ( "doc": ("The version of the AMDGPU driver installed on the machine."),
"[RESERVED] The version of the AMDGPU driver installed on the machine. "
"Unimplemented."
),
"name": "AMD GPU Kernel Version", "name": "AMD GPU Kernel Version",
"show_in_table": True, "show_in_table": True,
}, },
@@ -457,8 +457,8 @@ class MachineSpecs:
default=None, default=None,
metadata={ metadata={
"doc": ( "doc": (
"[RESERVED] The total amount of memory available to accelerators/GPUs " "The total amount of memory available to accelerators/GPUs "
"in the system. Unimplemented." "in the system."
), ),
"unit": "KB", "unit": "KB",
"name": "GPU Memory", "name": "GPU Memory",