SWDEV-436533 [CLI/Python API] Align Cache Info BM UI to Host
- [CLI] Refactored cache info to display cache flags as "cache_properties" names. Names are displayed as a list of comma-separated cache type strings. Previously, values were shown one by one as ENABLED. ex. CACHE_PROPERTIES = <a,b,c> - [JSON] mirrors CLI fields. No longer display "cache_flags", renamed field as "cache_properties" dictionary. This allows users to better understand the list of names provided. - [Python API] Updated amdsmi_get_gpu_cache_info to mirror Host return. README.md - updated to reflect all changes. Change-Id: Ife2ef5adcef30058937d1376efb01749e45c02fb Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
import ctypes
|
||||
import re
|
||||
from typing import Union, Any, Dict, List, Tuple
|
||||
from enum import IntEnum
|
||||
from enum import IntEnum, Enum
|
||||
from collections.abc import Iterable
|
||||
|
||||
from . import amdsmi_wrapper
|
||||
@@ -357,6 +357,11 @@ class AmdSmiProcessorType(IntEnum):
|
||||
NON_AMD_GPU = amdsmi_wrapper.NON_AMD_GPU
|
||||
NON_AMD_CPU = amdsmi_wrapper.NON_AMD_CPU
|
||||
|
||||
class AmdSmiCacheTypeNames(Enum):
|
||||
DATA_CACHE = 2
|
||||
INST_CACHE = 4
|
||||
CPU_CACHE = 8
|
||||
SIMD_CACHE = 16
|
||||
|
||||
class AmdSmiEventReader:
|
||||
def __init__(
|
||||
@@ -1626,15 +1631,26 @@ def amdsmi_get_gpu_cache_info(
|
||||
inst_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_INST_CACHE)
|
||||
cpu_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_CPU_CACHE)
|
||||
simd_cache = bool(cache_flags & amdsmi_wrapper.CACHE_FLAGS_SIMD_CACHE)
|
||||
cache_info_dict[f"cache {cache_index}"] = {"cache_size": cache_size,
|
||||
cache_flag_list = []
|
||||
if (data_cache):
|
||||
cache_flag_list.append(
|
||||
AmdSmiCacheTypeNames(amdsmi_wrapper.CACHE_FLAGS_DATA_CACHE).name)
|
||||
if (inst_cache):
|
||||
cache_flag_list.append(
|
||||
AmdSmiCacheTypeNames(amdsmi_wrapper.CACHE_FLAGS_INST_CACHE).name)
|
||||
if (cpu_cache):
|
||||
cache_flag_list.append(
|
||||
AmdSmiCacheTypeNames(amdsmi_wrapper.CACHE_FLAGS_CPU_CACHE).name)
|
||||
if (simd_cache):
|
||||
cache_flag_list.append(
|
||||
AmdSmiCacheTypeNames(amdsmi_wrapper.CACHE_FLAGS_SIMD_CACHE).name)
|
||||
cache_info_dict[f"cache {cache_index}"] = {
|
||||
"cache_flags": cache_flag_list,
|
||||
"cache_size": cache_size,
|
||||
"cache_level": cache_level,
|
||||
"max_num_cu_shared": max_num_cu_shared,
|
||||
"num_cache_instance": num_cache_instance}
|
||||
if (data_cache): cache_info_dict[f"cache {cache_index}"]["data_cache"] = data_cache
|
||||
if (inst_cache): cache_info_dict[f"cache {cache_index}"]["inst_cache"] = inst_cache
|
||||
if (cpu_cache): cache_info_dict[f"cache {cache_index}"]["cpu_cache"] = cpu_cache
|
||||
if (simd_cache): cache_info_dict[f"cache {cache_index}"]["simd_cache"] = simd_cache
|
||||
|
||||
"num_cache_instance": num_cache_instance
|
||||
}
|
||||
|
||||
if cache_info_dict == {}:
|
||||
raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NO_DATA)
|
||||
|
||||
Reference in New Issue
Block a user