diff --git a/amdsmi_cli/README.md b/amdsmi_cli/README.md index 7978cd66c2..75059eb8bd 100644 --- a/amdsmi_cli/README.md +++ b/amdsmi_cli/README.md @@ -656,25 +656,25 @@ VRAM: VRAM_VENDOR: HYNIX VRAM_SIZE_MB: 96432 MB CACHE: - CACHE 0: + CACHE_0: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 464 - CACHE 1: + CACHE_1: CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE CACHE_SIZE: 64 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 160 - CACHE 2: + CACHE_2: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32768 KB CACHE_LEVEL: 2 MAX_NUM_CU_SHARED: 304 NUM_CACHE_INSTANCE: 1 - CACHE 3: + CACHE_3: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 262144 KB CACHE_LEVEL: 3 @@ -768,25 +768,25 @@ VRAM: VRAM_SIZE_MB: 96432 MB CACHE: CACHE: - CACHE 0: + CACHE_0: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 464 - CACHE 1: + CACHE_1: CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE CACHE_SIZE: 64 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 160 - CACHE 2: + CACHE_2: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32768 KB CACHE_LEVEL: 2 MAX_NUM_CU_SHARED: 304 NUM_CACHE_INSTANCE: 1 - CACHE 3: + CACHE_3: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 262144 KB CACHE_LEVEL: 3 @@ -879,25 +879,25 @@ VRAM: VRAM_SIZE_MB: 96432 MB CACHE: CACHE: - CACHE 0: + CACHE_0: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 464 - CACHE 1: + CACHE_1: CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE CACHE_SIZE: 64 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 160 - CACHE 2: + CACHE_2: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32768 KB CACHE_LEVEL: 2 MAX_NUM_CU_SHARED: 304 NUM_CACHE_INSTANCE: 1 - CACHE 3: + CACHE_3: CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE CACHE_SIZE: 262144 KB CACHE_LEVEL: 3 @@ -989,27 +989,27 @@ VRAM: VRAM_VENDOR: HYNIX VRAM_SIZE_MB: 96432 MB CACHE: - CACHE 0: + CACHE_0: CACHE: - CACHE 0: + CACHE_0: CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE CACHE_SIZE: 32 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 464 - CACHE 1: + CACHE_1: CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE CACHE_SIZE: 64 KB CACHE_LEVEL: 1 MAX_NUM_CU_SHARED: 2 NUM_CACHE_INSTANCE: 160 - CACHE 2: + CACHE_2: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 32768 KB CACHE_LEVEL: 2 MAX_NUM_CU_SHARED: 304 NUM_CACHE_INSTANCE: 1 - CACHE 3: + CACHE_3: CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE CACHE_SIZE: 262144 KB CACHE_LEVEL: 3 diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index d70e9b7c6a..610e54285c 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -1969,6 +1969,18 @@ class AMDSMICommands(): if (args.cpu_metrics_table): static_dict["metrics_table"] = {} + try: + cpu_fam = amdsmi_interface.amdsmi_get_cpu_family() + static_dict["metrics_table"]["cpu_family"] = cpu_fam + except amdsmi_exception.AmdSmiLibraryException as e: + static_dict["metrics_table"]["cpu_family"] = "N/A" + logging.debug("Failed to get cpu family | %s", e.get_error_info()) + try: + cpu_mod = amdsmi_interface.amdsmi_get_cpu_model() + static_dict["metrics_table"]["cpu_model"] = cpu_mod + except amdsmi_exception.AmdSmiLibraryException as e: + static_dict["metrics_table"]["cpu_model"] = "N/A" + logging.debug("Failed to get cpu model | %s", e.get_error_info()) try: metrics_table = amdsmi_interface.amdsmi_get_metrics_table(args.cpu) static_dict["metrics_table"]["response"] = metrics_table diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 6dd40c36be..0b2949737d 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -2681,4 +2681,4 @@ GENERATE_LEGEND = YES DOT_CLEANUP = YES -ALIASES += usecase{1}="\xrefitem usecase \"Use cases\" \"Use cases\" \1" +ALIASES += platform{1}="\xrefitem platform \"Platform\" \"Platforms\" \1" diff --git a/example/amd_smi_drm_example.cc b/example/amd_smi_drm_example.cc index 65eb6b100a..076aeb3942 100644 --- a/example/amd_smi_drm_example.cc +++ b/example/amd_smi_drm_example.cc @@ -314,8 +314,8 @@ int main() { for (unsigned int i = 0 ; i < cache_info.num_cache_types; i++) { printf("\tCache Level: %d, Cache Size: %d KB, Cache type: 0x%x\n", cache_info.cache[i].cache_level, - cache_info.cache[i].cache_size_kb, - cache_info.cache[i].flags); + cache_info.cache[i].cache_size, + cache_info.cache[i].properties); printf("\tMax number CU shared: %d, Number of instances: %d\n", cache_info.cache[i].max_num_cu_shared, cache_info.cache[i].num_cache_instance); diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index e30de16825..58c7b818c8 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -538,22 +538,22 @@ typedef struct { } amdsmi_vbios_info_t; /** - * @brief cache flags + * @brief cache properties */ typedef enum { - CACHE_FLAGS_ENABLED = 0x00000001, - CACHE_FLAGS_DATA_CACHE = 0x00000002, - CACHE_FLAGS_INST_CACHE = 0x00000004, - CACHE_FLAGS_CPU_CACHE = 0x00000008, - CACHE_FLAGS_SIMD_CACHE = 0x00000010, -} amdsmi_cache_flags_type_t; + CACHE_PROPERTIES_ENABLED = 0x00000001, + CACHE_PROPERTIES_DATA_CACHE = 0x00000002, + CACHE_PROPERTIES_INST_CACHE = 0x00000004, + CACHE_PROPERTIES_CPU_CACHE = 0x00000008, + CACHE_PROPERTIES_SIMD_CACHE = 0x00000010, +} amdsmi_cache_properties_type_t; typedef struct { uint32_t num_cache_types; struct cache_ { - uint32_t cache_size_kb; /* In KB */ + uint32_t cache_size; /* In KB */ uint32_t cache_level; - uint32_t flags; // amdsmi_cache_flags_type_t which is a bitmask + uint32_t properties; // amdsmi_cache_properties_type_t which is a bitmask uint32_t max_num_cu_shared; /* Indicates how many Compute Units share this cache instance */ uint32_t num_cache_instance; /* total number of instance of this cache type */ uint32_t reserved[3]; @@ -1619,6 +1619,9 @@ typedef struct __attribute__((__packed__)){ /** * @brief Initialize the AMD SMI library * + * @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details This function initializes the library and the internal data structures, * including those corresponding to sources of information that SMI provides. * @@ -1639,6 +1642,9 @@ amdsmi_status_t amdsmi_init(uint64_t init_flags); /** * @brief Shutdown the AMD SMI library * + * @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details This function shuts down the library and internal data structures and * performs any necessary clean ups. * @@ -1657,6 +1663,9 @@ amdsmi_status_t amdsmi_shut_down(void); /** * @brief Get the list of socket handles in the system. * + * @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details Depends on what flag is passed to ::amdsmi_init. AMDSMI_INIT_AMD_GPUS * returns sockets with AMD GPUS, and AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS returns * sockets with either AMD GPUS or CPUS. @@ -1687,6 +1696,8 @@ amdsmi_status_t amdsmi_get_socket_handles(uint32_t *socket_count, /** * @brief Get the list of cpu socket handles in the system. * + * @platform{cpu_bm} + * * @details Depends on AMDSMI_INIT_AMD_CPUS flag passed to ::amdsmi_init. * The socket handles can be used to query the processor handles in that socket, which * will be used in other APIs to get processor detail information. @@ -1715,6 +1726,9 @@ amdsmi_status_t amdsmi_get_cpusocket_handles(uint32_t *socket_count, /** * @brief Get information about the given socket * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details This function retrieves socket information. The @p socket_handle must * be provided to retrieve the Socket ID. * @@ -1734,6 +1748,8 @@ amdsmi_status_t amdsmi_get_socket_info( /** * @brief Get information about the given processor * + * @platform{cpu_bm} + * * @details This function retrieves processor information. The @p processor_handle must * be provided to retrieve the processor ID. * @@ -1752,6 +1768,8 @@ amdsmi_status_t amdsmi_get_processor_info( /** * @brief Get respective processor counts from the processor handles * + * @platform{cpu_bm} + * * @details This function retrieves respective processor counts information. * The @p processor_handle must be provided to retrieve the processor ID. * @@ -1775,6 +1793,8 @@ amdsmi_status_t amdsmi_get_processor_count_from_handles(amdsmi_processor_handle* /** * @brief Get processor list as per processor type * + * @platform{cpu_bm} + * * @details This function retrieves processor list as per the processor type * from the total processor handles list. * The @p list of processor_handles and processor type must be provided. @@ -1798,6 +1818,9 @@ amdsmi_status_t amdsmi_get_processor_handles_by_type(amdsmi_socket_handle socket /** * @brief Get the list of the processor handles associated to a socket. * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details This function retrieves the processor handles of a socket. The * @p socket_handle must be provided for the processor. A socket may have mulitple different * type processors: An APU on a socket have both CPUs and GPUs. @@ -1834,6 +1857,8 @@ amdsmi_status_t amdsmi_get_processor_handles(amdsmi_socket_handle socket_handle, /** * @brief Get the list of the cpu core handles associated to a cpu socket. * + * @platform{cpu_bm} + * * @details This function retrieves the cpu core handles of a cpu socket. * @param[in] socket_handle The cpu socket to query * @param[in,out] processor_count As input, the value passed @@ -1861,6 +1886,9 @@ amdsmi_status_t amdsmi_get_cpucore_handles(amdsmi_cpusocket_handle socket_handle /** * @brief Get the processor type of the processor_handle * + * @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details This function retrieves the processor type. A processor_handle must be provided * for that processor. * @@ -1878,6 +1906,9 @@ amdsmi_status_t amdsmi_get_processor_type(amdsmi_processor_handle processor_hand /** * @brief Get processor handle with the matching bdf. * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} + * @platform{guest_mvf} @platform{guest_windows} + * * @details Given bdf info @p bdf, this function will get * the processor handle with the matching bdf. * @@ -1902,6 +1933,8 @@ amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf, * @brief Get the device id associated with the device with provided device * handler. * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p id, * this function will write the device id value to the uint64_t pointed to by * @p id. This ID is an identification of the type of device, so calling this @@ -1926,6 +1959,8 @@ amdsmi_status_t amdsmi_get_gpu_id(amdsmi_processor_handle processor_handle, uint /** * @brief Get the device revision associated with the device * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details Given a processor handle @p processor_handle and a pointer to a * uint16_t @p revision to which the revision id will be written * @@ -1941,6 +1976,8 @@ amdsmi_status_t amdsmi_get_gpu_revision(amdsmi_processor_handle processor_handle /** * @brief Get the name string for a give vendor ID * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details Given a processor handle @p processor_handle, a pointer to a caller provided * char buffer @p name, and a length of this buffer @p len, this function will * write the name of the vendor (up to @p len characters) buffer @p name. The @@ -1975,6 +2012,8 @@ amdsmi_status_t amdsmi_get_gpu_vendor_name(amdsmi_processor_handle processor_han /** * @brief Get the vram vendor string of a device. * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details This function retrieves the vram vendor name given a processor handle * @p processor_handle, a pointer to a caller provided * char buffer @p brand, and a length of this buffer @p len, this function @@ -2001,6 +2040,8 @@ amdsmi_status_t amdsmi_get_gpu_vram_vendor(amdsmi_processor_handle processor_han * @brief Get the subsystem device id associated with the device with * provided processor handle. * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p id, * this function will write the subsystem device id value to the uint64_t * pointed to by @p id. @@ -2021,6 +2062,8 @@ amdsmi_status_t amdsmi_get_gpu_subsystem_id(amdsmi_processor_handle processor_ha /** * @brief Get the name string for the device subsytem * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details Given a processor handle @p processor_handle, a pointer to a caller provided * char buffer @p name, and a length of this buffer @p len, this function * will write the name of the device subsystem (up to @p len characters) @@ -2064,6 +2107,8 @@ amdsmi_get_gpu_subsystem_name(amdsmi_processor_handle processor_handle, char *na * @brief Get the list of possible PCIe bandwidths that are available. It is not * supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a to an * ::amdsmi_pcie_bandwidth_t structure @p bandwidth, this function will fill in * @p bandwidth with the possible T/s values and associated number of lanes, @@ -2084,6 +2129,8 @@ amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, /** * @brief Get the unique PCI device identifier associated for a device * + * @platform{gpu_bm_linux} @platform{guest_1vf} + * * @details Give a processor handle @p processor_handle and a pointer to a uint64_t @p * bdfid, this function will write the Bus/Device/Function PCI identifier * (BDFID) associated with device @p processor_handle to the value pointed to by @@ -2118,6 +2165,8 @@ amdsmi_status_t amdsmi_get_gpu_bdf_id(amdsmi_processor_handle processor_handle, /** * @brief Get the NUMA node associated with a device * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a int32_t @p * numa_node, this function will retrieve the NUMA node value associated * with device @p processor_handle and store the value at location pointed to by @@ -2140,6 +2189,8 @@ amdsmi_status_t amdsmi_get_gpu_topo_numa_affinity(amdsmi_processor_handle proces /** * @brief Get PCIe traffic information. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Give a processor handle @p processor_handle and pointers to a uint64_t's, @p * sent, @p received and @p max_pkt_sz, this function will write the number * of bytes sent and received in 1 second to @p sent and @p received, @@ -2165,6 +2216,8 @@ amdsmi_status_t amdsmi_get_gpu_pci_throughput(amdsmi_processor_handle processor_ /** * @brief Get PCIe replay counter * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a uint64_t @p * counter, this function will write the sum of the number of NAK's received * by the GPU and the NAK's generated by the GPU to memory pointed to by @p @@ -2196,6 +2249,8 @@ amdsmi_status_t amdsmi_get_gpu_pci_replay_counter(amdsmi_processor_handle proces * @brief Control the set of allowed PCIe bandwidths that can be used. It is not * supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a 64 bit bitmask @p bw_bitmask, * this function will limit the set of allowable bandwidths. If a bit in @p * bw_bitmask has a value of 1, then the frequency (as ordered in an @@ -2237,6 +2292,8 @@ amdsmi_status_t amdsmi_set_gpu_pci_bandwidth(amdsmi_processor_handle processor_h * @brief Get the energy accumulator counter of the processor with provided * processor handle. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a pointer to a uint64_t * @p power, and a pointer to a uint64_t @p timestamp, this function will write * amount of energy consumed to the uint64_t pointed to by @p power, @@ -2275,6 +2332,8 @@ amdsmi_get_energy_count(amdsmi_processor_handle processor_handle, uint64_t *powe * @brief Set the maximum gpu power cap value. It is not supported on virtual * machine guest * + * @platform{gpu_bm_linux} + * * @details This function will set the power cap to the provided value @p cap. * @p cap must be between the minimum and maximum power cap values set by the * system, which can be obtained from ::amdsmi_dev_power_cap_range_get. @@ -2295,6 +2354,8 @@ amdsmi_status_t /** * @brief Set the power performance profile. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details This function will attempt to set the current profile to the provided * profile, given a processor handle @p processor_handle and a @p profile. The provided * profile must be one of the currently supported profiles, as indicated by a @@ -2324,6 +2385,8 @@ amdsmi_status_t /** * @brief Get the total amount of memory that exists * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details Given a processor handle @p processor_handle, a type of memory @p mem_type, and * a pointer to a uint64_t @p total, this function will write the total amount * of @p mem_type memory that exists to the location pointed to by @p total. @@ -2349,6 +2412,8 @@ amdsmi_get_gpu_memory_total(amdsmi_processor_handle processor_handle, amdsmi_mem /** * @brief Get the current memory usage * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} + * * @details This function will write the amount of @p mem_type memory that * that is currently being used to the location pointed to by @p used. * @@ -2373,6 +2438,9 @@ amdsmi_get_gpu_memory_usage(amdsmi_processor_handle processor_handle, amdsmi_mem /** * @brief Get the bad pages of a processor. It is not supported on virtual * machine guest + * + * @platform{gpu_bm_linux} @platform{host} + * * @details This call will query the device @p processor_handle for the * number of bad pages (written to @p num_pages address). The results are * written to address held by the @p info pointer. @@ -2393,6 +2461,8 @@ amdsmi_get_gpu_bad_page_info(amdsmi_processor_handle processor_handle, uint32_t /** * @brief Returns RAS features info. * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle Device handle which to query * * @param[out] ras_feature RAS features that are currently enabled and supported on @@ -2408,6 +2478,8 @@ amdsmi_status_t amdsmi_get_gpu_ras_feature_info( * @brief Returns if RAS features are enabled or disabled for given block. It is not * supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, this function queries the * state of RAS features for a specific block @p block. Result will be written * to address held by pointer @p state. @@ -2434,6 +2506,8 @@ amdsmi_get_gpu_ras_block_features_enabled(amdsmi_processor_handle processor_hand * @brief Get information about reserved ("retired") memory pages. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, this function returns retired page * information @p records corresponding to the device with the provided processor * handle @p processor_handle. The number of retired page records is returned through @p @@ -2478,6 +2552,8 @@ amdsmi_get_gpu_memory_reserved_pages(amdsmi_processor_handle processor_handle, * @brief Get the fan speed in RPMs of the device with the specified processor * handle and 0-based sensor index. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a uint32_t * @p speed, this function will write the current fan speed in RPMs to the * uint32_t pointed to by @p speed @@ -2503,6 +2579,8 @@ amdsmi_status_t amdsmi_get_gpu_fan_rpms(amdsmi_processor_handle processor_handle * @brief Get the fan speed for the specified device as a value relative to * ::AMDSMI_MAX_FAN_SPEED. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a uint32_t * @p speed, this function will write the current fan speed (a value * between 0 and the maximum fan speed, ::AMDSMI_MAX_FAN_SPEED) to the uint32_t @@ -2529,6 +2607,8 @@ amdsmi_status_t amdsmi_get_gpu_fan_speed(amdsmi_processor_handle processor_handl * @brief Get the max. fan speed of the device with provided processor handle. It is * not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a uint32_t * @p max_speed, this function will write the maximum fan speed possible to * the uint32_t pointed to by @p max_speed @@ -2555,6 +2635,8 @@ amdsmi_status_t amdsmi_get_gpu_fan_speed_max(amdsmi_processor_handle processor_h * specified temperature sensor on the specified device. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @details Given a processor handle @p processor_handle, a sensor type @p sensor_type, a * ::amdsmi_temperature_metric_t @p metric and a pointer to an int64_t @p * temperature, this function will write the value of the metric indicated by @@ -2584,6 +2666,8 @@ amdsmi_status_t amdsmi_get_temp_metric(amdsmi_processor_handle processor_handle, /** * @brief Returns gpu cache info. * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle PF of a processor for which to query * * @param[out] info reference to the cache info struct. @@ -2599,6 +2683,8 @@ amdsmi_status_t amdsmi_get_gpu_cache_info( * specified voltage sensor on the specified device. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a sensor type @p sensor_type, a * ::amdsmi_voltage_metric_t @p metric and a pointer to an int64_t @p * voltage, this function will write the value of the metric indicated by @@ -2637,6 +2723,8 @@ amdsmi_status_t amdsmi_get_gpu_volt_metric(amdsmi_processor_handle processor_han * @brief Reset the fan to automatic driver control. It is not supported on virtual * machine guest * + * @platform{gpu_bm_linux} + * * @details This function returns control of the fan to the system * * @param[in] processor_handle a processor handle @@ -2652,6 +2740,8 @@ amdsmi_status_t amdsmi_reset_gpu_fan(amdsmi_processor_handle processor_handle, u * @brief Set the fan speed for the specified device with the provided speed, * in RPMs. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a integer value indicating * speed @p speed, this function will attempt to set the fan speed to @p speed. * An error will be returned if the specified speed is outside the allowable @@ -2683,6 +2773,8 @@ amdsmi_status_t amdsmi_set_gpu_fan_speed(amdsmi_processor_handle processor_handl /** * @brief Get coarse grain utilization counter of the specified device * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, the array of the utilization counters, * the size of the array, this function returns the coarse grain utilization counters * and timestamp. @@ -2714,6 +2806,8 @@ amdsmi_get_utilization_count(amdsmi_processor_handle processor_handle, * @brief Get the performance level of the device. It is not supported on virtual * machine guest * + * @platform{gpu_bm_linux} + * * @details This function will write the ::amdsmi_dev_perf_level_t to the uint32_t * pointed to by @p perf, for a given processor handle @p processor_handle and a pointer * to a uint32_t @p perf. @@ -2736,6 +2830,8 @@ amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_hand * @brief Enter performance determinism mode with provided processor handle. It is * not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and @p clkvalue this function * will enable performance determinism mode, which enforces a GFXCLK frequency * SoftMax limit per GPU set by the user. This prevents the GFXCLK PLL from @@ -2757,6 +2853,8 @@ amdsmi_set_gpu_perf_determinism_mode(amdsmi_processor_handle processor_handle, u * @brief Get the overdrive percent associated with the device with provided * processor handle. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p od, * this function will write the overdrive percentage to the uint32_t pointed * to by @p od @@ -2780,6 +2878,8 @@ amdsmi_status_t amdsmi_get_gpu_overdrive_level(amdsmi_processor_handle processor * @brief Get the list of possible system clock speeds of device for a * specified clock type. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} @platform{guest_1vf} + * * @details Given a processor handle @p processor_handle, a clock type @p clk_type, and a * pointer to a to an ::amdsmi_frequencies_t structure @p f, this function will * fill in @p f with the possible clock speeds, and indication of the current @@ -2802,6 +2902,8 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle, * @brief Reset the gpu associated with the device with provided processor handle. It is not * supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, this function will reset the GPU * * @param[in] processor_handle a processor handle @@ -2814,6 +2916,8 @@ amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle); * @brief This function retrieves the voltage/frequency curve information. It is * not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a * ::amdsmi_od_volt_freq_data_t structure @p odv, this function will populate @p * odv. See ::amdsmi_od_volt_freq_data_t for more details. @@ -2835,6 +2939,8 @@ amdsmi_status_t amdsmi_get_gpu_od_volt_info(amdsmi_processor_handle processor_ha * @brief This function retrieves the gpu metrics information. It is not supported * on virtual machine guest * + * @platform{gpu_bm_linux} @platform{guest_1vf} + * * @details Given a processor handle @p processor_handle and a pointer to a * ::amdsmi_gpu_metrics_t structure @p pgpu_metrics, this function will populate * @p pgpu_metrics. See ::amdsmi_gpu_metrics_t for more details. @@ -2855,6 +2961,8 @@ amdsmi_status_t amdsmi_get_gpu_metrics_info(amdsmi_processor_handle processor_ha /** * @brief Get the pm metrics table with provided device index. * + * @platform{gpu_bm_linux} + * * @details Given a device handle @p processor_handle, @p pm_metrics pointer, * and @p num_of_metrics pointer, * this function will write the pm metrics name value pair @@ -2889,6 +2997,8 @@ amdsmi_status_t amdsmi_get_gpu_pm_metrics_info( /** * @brief Get the register metrics table with provided device index and register type. * + * @platform{gpu_bm_linux} + * * @details Given a device handle @p processor_handle, @p reg_type, @p reg_metrics pointer, * and @p num_of_metrics pointer, * this function will write the register metrics name value pair @@ -2927,6 +3037,8 @@ amdsmi_status_t amdsmi_get_gpu_reg_table_info( * @brief This function sets the clock range information. It is not supported on virtual * machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a minimum clock value @p minclkvalue, * a maximum clock value @p maxclkvalue and a clock type @p clkType this function * will set the sclk|mclk range @@ -2952,6 +3064,8 @@ amdsmi_status_t amdsmi_set_gpu_clk_range(amdsmi_processor_handle processor_handl * @brief This function sets the clock frequency information. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a frequency level @p level, * a clock value @p clkvalue and a clock type @p clkType this function * will set the sclk|mclk range @@ -2977,6 +3091,8 @@ amdsmi_status_t amdsmi_set_gpu_od_clk_info(amdsmi_processor_handle processor_han * @brief This function sets 1 of the 3 voltage curve points. It is not supported * on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a voltage point @p vpoint * and a voltage value @p voltvalue this function will set voltage curve point * @@ -3001,6 +3117,8 @@ amdsmi_status_t amdsmi_set_gpu_od_volt_info(amdsmi_processor_handle processor_ha * @brief This function will retrieve the current valid regions in the * frequency/voltage space. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a pointer to an unsigned integer * @p num_regions and a buffer of ::amdsmi_freq_volt_region_t structures, @p * buffer, this function will populate @p buffer with the current @@ -3039,6 +3157,8 @@ amdsmi_status_t amdsmi_get_gpu_od_volt_curve_regions(amdsmi_processor_handle pro * @brief Get the list of available preset power profiles and an indication of * which profile is currently active. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a pointer to a * ::amdsmi_power_profile_status_t @p status, this function will set the bits of * the ::amdsmi_power_profile_status_t.available_profiles bit field of @p status to @@ -3084,6 +3204,8 @@ amdsmi_status_t * provided processor handle with the provided value. It is not supported * on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and an ::amdsmi_dev_perf_level_t @p * perf_level, this function will set the PowerPlay performance level for the * device to the value @p perf_lvl. @@ -3104,6 +3226,7 @@ amdsmi_status_t * processor handle with the provided value. See details for WARNING. It is * not supported on virtual machine guest * + * @platform{gpu_bm_linux} * * @details Given a processor handle @p processor_handle and an overdrive level @p od, * this function will set the overdrive level for the device to the value @@ -3142,6 +3265,8 @@ amdsmi_status_t amdsmi_set_gpu_overdrive_level(amdsmi_processor_handle processor * @brief Control the set of allowed frequencies that can be used for the * specified clock. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a clock type @p clk_type, and a * 64 bit bitmask @p freq_bitmask, this function will limit the set of * allowable frequencies. If a bit in @p freq_bitmask has a value of 1, then @@ -3185,6 +3310,8 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle, * @brief Get the build version information for the currently running build of * AMDSMI. * + * @platform{gpu_bm_linux} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} + * * @details Get the major, minor, patch and build string for AMDSMI build * currently in use through @p version * @@ -3209,6 +3336,8 @@ amdsmi_get_lib_version(amdsmi_version_t *version); * @brief Retrieve the error counts for a GPU block. It is not supported on virtual * machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @details Given a processor handle @p processor_handle, an ::amdsmi_gpu_block_t @p block and a * pointer to an ::amdsmi_error_count_t @p ec, this function will write the error * count values for the GPU block indicated by @p block to memory pointed to by @@ -3233,6 +3362,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_handl /** * @brief Retrieve the enabled ECC bit-mask. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @details Given a processor handle @p processor_handle, and a pointer to a uint64_t @p * enabled_mask, this function will write bits to memory pointed to by * @p enabled_blocks. Upon a successful call, @p enabled_blocks can then be @@ -3261,6 +3392,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_enabled(amdsmi_processor_handle processor_han * @brief Retrieve the ECC status for a GPU block. It is not supported on virtual machine * guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, an ::amdsmi_gpu_block_t @p block and * a pointer to an ::amdsmi_ras_err_state_t @p state, this function will write * the current state for the GPU block indicated by @p block to memory pointed @@ -3286,6 +3419,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_hand /** * @brief Get a description of a provided AMDSMI error status * + * @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf} + * * @details Set the provided pointer to a const char *, @p status_string, to * a string containing a description of the provided error code @p status. * @@ -3407,6 +3542,8 @@ amdsmi_status_code_to_string(amdsmi_status_t status, const char **status_string) * @brief Tell if an event group is supported by a given device. It is not supported * on virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and an event group specifier @p * group, tell if @p group type events are supported by the device associated * with @p processor_handle @@ -3424,6 +3561,8 @@ amdsmi_gpu_counter_group_supported(amdsmi_processor_handle processor_handle, amd /** * @brief Create a performance counter object * + * @platform{gpu_bm_linux} + * * @details Create a performance counter object of type @p type for the device * with a processor handle of @p processor_handle, and write a handle to the object to the * memory location pointed to by @p evnt_handle. @p evnt_handle can be used @@ -3452,6 +3591,8 @@ amdsmi_gpu_create_counter(amdsmi_processor_handle processor_handle, amdsmi_event /** * @brief Deallocate a performance counter object * + * @platform{gpu_bm_linux} + * * @details Deallocate the performance counter object with the provided * ::amdsmi_event_handle_t @p evnt_handle * @@ -3468,6 +3609,8 @@ amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle); * @brief Issue performance counter control commands. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Issue a command @p cmd on the event counter associated with the * provided handle @p evt_handle. * @@ -3488,6 +3631,8 @@ amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, /** * @brief Read the current value of a performance counter * + * @platform{gpu_bm_linux} + * * @details Read the current counter value of the counter associated with the * provided handle @p evt_handle and write the value to the location pointed * to by @p value. @@ -3509,6 +3654,8 @@ amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, * @brief Get the number of currently available counters. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a performance event group @p grp, * and a pointer to a uint32_t @p available, this function will write the * number of @p grp type counters that are available on the device with handle @@ -3539,6 +3686,8 @@ amdsmi_status_t /** * @brief Get process information about processes currently using GPU * + * @platform{gpu_bm_linux} @platform{guest_1vf} + * * @details Given a non-NULL pointer to an array @p procs of * ::amdsmi_process_info_t's, of length *@p num_items, this function will write * up to *@p num_items instances of ::amdsmi_process_info_t to the memory pointed @@ -3569,6 +3718,8 @@ amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_ /** * @brief Get process information about a specific process * + * @platform{gpu_bm_linux} @platform{guest_1vf} + * * @details Given a pointer to an ::amdsmi_process_info_t @p proc and a process * id * @p pid, this function will write the process information for @p pid, if @@ -3588,6 +3739,8 @@ amdsmi_get_gpu_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t * /** * @brief Get the device indices currently being used by a process * + * @platform{gpu_bm_linux} @platform{guest_1vf} + * * @details Given a process id @p pid, a non-NULL pointer to an array of * uint32_t's @p processor_handleices of length *@p num_devices, this function will * write up to @p num_devices device indices to the memory pointed to by @@ -3630,6 +3783,8 @@ amdsmi_get_gpu_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, * @brief Retrieve the XGMI error status for a device. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, and a pointer to an * ::amdsmi_xgmi_status_t @p status, this function will write the current XGMI * error state ::amdsmi_xgmi_status_t for the device @p processor_handle to the memory @@ -3653,6 +3808,8 @@ amdsmi_gpu_xgmi_error_status(amdsmi_processor_handle processor_handle, amdsmi_xg * @brief Reset the XGMI error status for a device. It is not supported on virtual * machine guest * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, this function will reset the * current XGMI error state ::amdsmi_xgmi_status_t for the device @p processor_handle to * amdsmi_xgmi_status_t::AMDSMI_XGMI_STATUS_NO_ERRORS @@ -3675,6 +3832,8 @@ amdsmi_reset_gpu_xgmi_error(amdsmi_processor_handle processor_handle); /** * @brief Return link metric information * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle PF of a processor for which to query * * @param[out] link_metrics reference to the link metrics struct. @@ -3688,6 +3847,8 @@ amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle /** * @brief Retrieve the NUMA CPU node number for a device * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, and a pointer to an * uint32_t @p numa_node, this function will write the * node number of NUMA CPU for the device @p processor_handle to the memory @@ -3706,6 +3867,8 @@ amdsmi_topo_get_numa_node_number(amdsmi_processor_handle processor_handle, uint3 /** * @brief Retrieve the weight for a connection between 2 GPUs * + * @platform{gpu_bm_linux} + * * @details Given a source processor handle @p processor_handle_src and * a destination processor handle @p processor_handle_dst, and a pointer to an * uint64_t @p weight, this function will write the @@ -3728,6 +3891,8 @@ amdsmi_topo_get_link_weight(amdsmi_processor_handle processor_handle_src, amdsmi /** * @brief Retreive minimal and maximal io link bandwidth between 2 GPUs * + * @platform{gpu_bm_linux} + * * @details Given a source processor handle @p processor_handle_src and * a destination processor handle @p processor_handle_dst, pointer to an * uint64_t @p min_bandwidth, and a pointer to uint64_t @p max_bandiwidth, @@ -3755,6 +3920,8 @@ amdsmi_status_t /** * @brief Retrieve the hops and the connection type between 2 GPUs * + * @platform{gpu_bm_linux} + * * @details Given a source processor handle @p processor_handle_src and * a destination processor handle @p processor_handle_dst, and a pointer to an * uint64_t @p hops and a pointer to an AMDSMI_IO_LINK_TYPE @p type, @@ -3782,6 +3949,8 @@ amdsmi_topo_get_link_type(amdsmi_processor_handle processor_handle_src, /** * @brief Return P2P availability status between 2 GPUs * + * @platform{gpu_bm_linux} + * * @details Given a source processor handle @p processor_handle_src and * a destination processor handle @p processor_handle_dst, and a pointer to a * bool @p accessible, this function will write the P2P connection status @@ -3814,6 +3983,8 @@ amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, /** * @brief Retrieves the current compute partitioning for a desired device * + * @platform{gpu_bm_linux} + * * @details * Given a processor handle @p processor_handle and a string @p compute_partition , * and uint32 @p len , this function will attempt to obtain the device's @@ -3846,6 +4017,8 @@ amdsmi_get_gpu_compute_partition(amdsmi_processor_handle processor_handle, /** * @brief Modifies a selected device's compute partition setting. * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, a type of compute partition * @p compute_partition, this function will attempt to update the selected * device's compute partition setting. @@ -3873,6 +4046,8 @@ amdsmi_set_gpu_compute_partition(amdsmi_processor_handle processor_handle, * @brief Reverts a selected device's compute partition setting back to its * boot state. * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, this function will attempt to * revert its compute partition setting back to its boot state. * @@ -3898,6 +4073,8 @@ amdsmi_status_t amdsmi_reset_gpu_compute_partition(amdsmi_processor_handle proce /** * @brief Retrieves the current memory partition for a desired device * + * @platform{gpu_bm_linux} + * * @details * Given a processor handle @p processor_handle and a string @p memory_partition , * and uint32 @p len , this function will attempt to obtain the device's @@ -3930,6 +4107,8 @@ amdsmi_get_gpu_memory_partition(amdsmi_processor_handle processor_handle, /** * @brief Modifies a selected device's current memory partition setting. * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a type of memory partition * @p memory_partition, this function will attempt to update the selected * device's memory partition setting. @@ -3956,6 +4135,8 @@ amdsmi_set_gpu_memory_partition(amdsmi_processor_handle processor_handle, * @brief Reverts a selected device's memory partition setting back to its * boot state. * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle, this function will attempt to * revert its current memory partition setting back to its boot state. * @@ -3983,6 +4164,8 @@ amdsmi_status_t amdsmi_reset_gpu_memory_partition(amdsmi_processor_handle proces /** * @brief Prepare to collect event notifications for a GPU * + * @platform{gpu_bm_linux} + * * @details This function prepares to collect events for the GPU with device * ID @p processor_handle, by initializing any required system parameters. This call * may open files which will remain open until ::amdsmi_stop_gpu_event_notification() @@ -3999,6 +4182,8 @@ amdsmi_init_gpu_event_notification(amdsmi_processor_handle processor_handle); /** * @brief Specify which events to collect for a device * + * @platform{gpu_bm_linux} + * * @details Given a processor handle @p processor_handle and a @p mask consisting of * elements of ::amdsmi_evt_notification_type_t OR'd together, this function * will listen for the events specified in @p mask on the device @@ -4028,6 +4213,8 @@ amdsmi_status_t /** * @brief Collect event notifications, waiting a specified amount of time * + * @platform{gpu_bm_linux} + * * @details Given a time period @p timeout_ms in milliseconds and a caller- * provided buffer of ::amdsmi_evt_notification_data_t's @p data with a length * (in ::amdsmi_evt_notification_data_t's, also specified by the caller) in the @@ -4068,6 +4255,8 @@ amdsmi_status_t * @brief Close any file handles and free any resources used by event * notification for a GPU * + * @platform{gpu_bm_linux} + * * @details Any resources used by event notification for the GPU with * processor handle @p processor_handle will be free with this * function. This includes freeing any memory and closing file handles. This @@ -4085,6 +4274,9 @@ amdsmi_status_t amdsmi_stop_gpu_event_notification(amdsmi_processor_handle proce /** * @brief Returns BDF of the given device * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @param[out] bdf Reference to BDF. Must be allocated by user. @@ -4097,6 +4289,8 @@ amdsmi_get_gpu_device_bdf(amdsmi_processor_handle processor_handle, amdsmi_bdf_t /** * @brief Returns the UUID of the device * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * * @param[in] processor_handle Device which to query * * @param[in,out] uuid_length Length of the uuid string. As input, must be @@ -4119,6 +4313,9 @@ amdsmi_get_gpu_device_uuid(amdsmi_processor_handle processor_handle, unsigned in /** * @brief Returns the driver version information * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @param[in,out] length As input parameter length of the user allocated @@ -4143,6 +4340,9 @@ amdsmi_get_gpu_driver_info(amdsmi_processor_handle processor_handle, amdsmi_driv /** * @brief Returns the ASIC information for the device * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * @platform{guest_windows} + * * @details This function returns ASIC information such as the product name, * the vendor ID, the subvendor ID, the device ID, * the revision ID and the serial number. @@ -4160,6 +4360,8 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i /** * @brief Returns vram info * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * * @param[in] processor_handle PF of a processor for which to query * * @param[out] info Reference to vram info structure @@ -4173,6 +4375,8 @@ amdsmi_status_t amdsmi_get_gpu_vram_info( /** * @brief Returns the board part number and board information for the requested device * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to board info structure. @@ -4187,6 +4391,8 @@ amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_handle, amdsmi_board * @brief Returns the power caps as currently configured in the * system. It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle Device which to query * @param[in] sensor_ind A 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. @@ -4202,6 +4408,8 @@ amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle, uint32_t sen /** * @brief Returns the PCIe info for the GPU. * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to the PCIe information @@ -4215,6 +4423,8 @@ amdsmi_status_t amdsmi_get_pcie_info(amdsmi_processor_handle processor_handle, /** * @brief Returns XGMI information for the GPU. * + * @platform{gpu_bm_linux} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to xgmi information structure. Must be @@ -4236,6 +4446,8 @@ amdsmi_get_xgmi_info(amdsmi_processor_handle processor_handle, amdsmi_xgmi_info_ /** * @brief Returns the firmware versions running on the device. * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to the fw info. Must be allocated by user. @@ -4248,6 +4460,9 @@ amdsmi_get_fw_info(amdsmi_processor_handle processor_handle, amdsmi_fw_info_t *i /** * @brief Returns the static information for the vBIOS on the device. * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf} + * @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to static vBIOS information. @@ -4270,6 +4485,8 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios * Each usage is reported as a percentage from 0-100%. It is not * supported on virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to the gpu engine usage structure. Must be allocated by user. @@ -4284,6 +4501,8 @@ amdsmi_get_gpu_activity(amdsmi_processor_handle processor_handle, amdsmi_engine_ * The voltage is in units of mV and the power in units of W. * It is not supported on virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle Device which to query * * @param[out] info Reference to the gpu power structure. Must be allocated by user. @@ -4296,6 +4515,8 @@ amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_inf /** * @brief Returns is power management enabled * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle PF of a processor for which to query * * @param[out] enabled Reference to bool. Must be allocated by user. @@ -4311,6 +4532,8 @@ amdsmi_is_gpu_power_management_enabled(amdsmi_processor_handle processor_handle, * reports the averages over 1s in MHz. It is not supported * on virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle Device which to query * * @param[in] clk_type Enum representing the clock type to query. @@ -4327,6 +4550,8 @@ amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_ * @brief Returns the VRAM usage (both total and used memory) * in MegaBytes. * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @@ -4349,6 +4574,8 @@ amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_handle, amdsmi_vram_ /** * @brief Returns the list of processes running on a given GPU including itself. * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows} + * * @note The user provides a buffer to store the list and the maximum * number of processes that can be returned. If the user sets * max_processes to 0, the current total number of processes will @@ -4379,6 +4606,8 @@ amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, uint32_t * * @brief Returns the process information of a given process. * Engine usage show how much time the process spend using these engines in ns. * + * @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows} + * * @param[in] processor_handle Device which to query * * @param[in] process Handle of process to query. @@ -4403,6 +4632,8 @@ amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_pro * uncorrectable) in the given GPU. It is not supported on * virtual machine guest * + * @platform{gpu_bm_linux} @platform{host} + * * @param[in] processor_handle Device which to query * * @param[out] ec Reference to ecc error count structure. @@ -4425,6 +4656,8 @@ amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_ /** * @brief Get the core energy for a given core. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu core which to query * * @param[in,out] penergy - Input buffer to return the core energy @@ -4437,6 +4670,8 @@ amdsmi_status_t amdsmi_get_cpu_core_energy(amdsmi_processor_handle processor_han /** * @brief Get the socket energy for a given socket. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] penergy - Input buffer to return the socket energy @@ -4456,6 +4691,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_processor_handle processor_h /** * @brief Get SMU Firmware Version. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in,out] amdsmi_smu_fw - Input buffer to return the firmware version * @@ -4467,6 +4704,8 @@ amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_processor_handle processor_ /** * @brief Get HSMP protocol Version. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in,out] proto_ver - Input buffer to return the protocol version * @@ -4478,6 +4717,8 @@ amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_processor_handle processor_ /** * @brief Get normalized status of the processor's PROCHOT status. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] prochot - Input buffer to return the procohot status. @@ -4490,6 +4731,8 @@ amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_processor_handle processor_ /** * @brief Get Data fabric clock and Memory clock in MHz. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] fclk - Input buffer to return fclk @@ -4504,6 +4747,8 @@ amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_processor_handle processor_handl /** * @brief Get core clock in MHz. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] cclk - Input buffer to return core clock @@ -4516,6 +4761,8 @@ amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_processor_handle processor_hand /** * @brief Get current active frequency limit of the socket. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] freq - Input buffer to return frequency value in MHz @@ -4530,6 +4777,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_processor /** * @brief Get socket frequency range. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] fmax - Input buffer to return maximum frequency @@ -4544,6 +4793,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_processor_handle process /** * @brief Get socket frequency limit of the core. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu core which to query * * @param[in,out] freq - Input buffer to return frequency. @@ -4563,6 +4814,8 @@ amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle p /** * @brief Get the socket power. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] ppower - Input buffer to return socket power @@ -4575,6 +4828,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_processor_handle processor_ha /** * @brief Get the socket power cap. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] pcap - Input buffer to return power cap. @@ -4587,6 +4842,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_processor_handle processo /** * @brief Get the maximum power cap value for a given socket. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] pmax - Input buffer to return maximum power limit value @@ -4599,6 +4856,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_processor_handle proc /** * @brief Get the SVI based power telemetry for all rails. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] power - Input buffer to return svi based power value @@ -4611,6 +4870,8 @@ amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_processor_hand /** * @brief Set the power cap value for a given socket. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in] power - Input power limit value @@ -4623,6 +4884,8 @@ amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_processor_handle processo /** * @brief Set the power efficiency profile policy. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in] mode - mode to be set @@ -4642,6 +4905,8 @@ amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_processor_handle proce /** * @brief Get the core boost limit. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu core which to query * * @param[in,out] pboostlimit - Input buffer to fill the boostlimit value @@ -4654,6 +4919,8 @@ amdsmi_status_t amdsmi_get_cpu_core_boostlimit(amdsmi_processor_handle processor /** * @brief Get the socket c0 residency. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] pc0_residency - Input buffer to fill the c0 residency value @@ -4666,6 +4933,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_processor_handle proce /** * @brief Set the core boostlimit value. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu core which to query * * @param[in] boostlimit - boostlimit value to be set @@ -4678,6 +4947,8 @@ amdsmi_status_t amdsmi_set_cpu_core_boostlimit(amdsmi_processor_handle processor /** * @brief Set the socket boostlimit value. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in] boostlimit - boostlimit value to be set @@ -4697,6 +4968,8 @@ amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_processor_handle process /** * @brief Get the DDR bandwidth data. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in,out] ddr_bw - Input buffer to fill ddr bandwidth data * @@ -4715,6 +4988,8 @@ amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_processor_handle processor_handle, /** * @brief Get socket temperature. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] ptmon - Input buffer to fill temperature value @@ -4734,6 +5009,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_processor_handle proces /** * @brief Get DIMM temperature range and refresh rate. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] dimm_addr - DIMM address * @param[in,out] rate - Input buffer to fill temperature range and refresh rate value @@ -4747,6 +5024,8 @@ amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_processor /** * @brief Get DIMM power consumption. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] dimm_addr - DIMM address * @param[in,out] rate - Input buffer to fill power consumption value @@ -4760,6 +5039,8 @@ amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_processor_handle pr /** * @brief Get DIMM thermal sensor value. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] dimm_addr - DIMM address * @param[in,out] dimm_temp - Input buffer to fill temperature value @@ -4780,6 +5061,8 @@ amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_processor_handle proce /** * @brief Set xgmi width. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] min - Minimum xgmi width to be set * @param[in] max - maximum xgmi width to be set @@ -4798,6 +5081,8 @@ amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_processor_handle processor_hand /** * @brief Set gmi3 link width range. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] min_link_width - minimum link width to be set. * @param[in] max_link_width - maximum link width to be set. @@ -4817,6 +5102,8 @@ amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_processor_handle pro /** * @brief Enable APB. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail @@ -4826,6 +5113,8 @@ amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_processor_handle processor_handle); /** * @brief Disable APB. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in] pstate - pstate value to be set @@ -4838,6 +5127,8 @@ amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_processor_handle processor_handle, /** * @brief Set NBIO lclk dpm level value. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] nbio_id - nbio index * @param[in] min - minimum value to be set @@ -4851,6 +5142,8 @@ amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_processor_handle pro /** * @brief Get NBIO LCLK dpm level. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] nbio_id - nbio index * @param[in,out] nbio - Input buffer to fill lclk dpm level @@ -4863,6 +5156,8 @@ amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_processor_handle pro /** * @brief Set pcie link rate. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] rate_ctrl - rate control value to be set. * @param[in,out] prev_mode - Input buffer to fill previous rate control value. @@ -4875,6 +5170,8 @@ amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_processor_handle processor_ /** * @brief Set df pstate range. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] max_pstate - maximum pstate value to be set * @param[in] min_pstate - minimum pstate value to be set @@ -4894,6 +5191,8 @@ amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_processor_handle processor /** * @brief Get current input output bandwidth. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] link - link id and bw type to which io bandwidth to be obtained * @param[in,out] io_bw - Input buffer to fill bandwidth data @@ -4906,6 +5205,8 @@ amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_processor_handle proc /** * @brief Get current input output bandwidth. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in] link - link id and bw type to which xgmi bandwidth to be obtained * @param[in,out] xgmi_bw - Input buffer to fill bandwidth data @@ -4925,6 +5226,8 @@ amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_processor_handle processor /** * @brief Get metrics table version * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in,out] metrics_version input buffer to return the metrics table version. * @@ -4936,6 +5239,8 @@ amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle process /** * @brief Get metrics table * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * @param[in,out] metrics_table input buffer to return the metrics table. * @@ -4954,6 +5259,8 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handl /** * @brief Get first online core on socket. * + * @platform{cpu_bm} + * * @param[in] processor_handle Cpu socket which to query * * @param[in,out] pcore_ind - Input buffer to fill first online core on socket data @@ -4963,9 +5270,29 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handl amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_processor_handle processor_handle, uint32_t *pcore_ind); +/** + * @brief Get CPU family. + * + * @param[in,out] cpu_family - Input buffer to return the cpu family + * + * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail + */ +amdsmi_status_t amdsmi_get_cpu_family(uint32_t *cpu_family); + +/** + * @brief Get CPU model. + * + * @param[in,out] cpu_model - Input buffer to return the cpu model + * + * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail + */ +amdsmi_status_t amdsmi_get_cpu_model(uint32_t *cpu_model); + /** * @brief Get a description of provided AMDSMI error status for esmi errors. * + * @platform{cpu_bm} + * * @details Set the provided pointer to a const char *, @p status_string, to * a string containing a description of the provided error code @p status. * diff --git a/include/amd_smi/impl/amd_smi_system.h b/include/amd_smi/impl/amd_smi_system.h index 9e1004aa3c..18f93e7ab1 100644 --- a/include/amd_smi/impl/amd_smi_system.h +++ b/include/amd_smi/impl/amd_smi_system.h @@ -75,6 +75,9 @@ class AMDSmiSystem { amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index, amdsmi_processor_handle* processor_handle); + amdsmi_status_t get_cpu_family(uint32_t *cpu_family); + + amdsmi_status_t get_cpu_model(uint32_t *cpu_model); private: AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {} diff --git a/py-interface/README.md b/py-interface/README.md index ff04d9cdbd..f16163fb29 100644 --- a/py-interface/README.md +++ b/py-interface/README.md @@ -472,11 +472,26 @@ Input parameters: * `processor_handle` device which to query Output: Dictionary of Dictionaries containing cache information +Schema: { cache_index: + { + cache_properties: + { + "type": "array", + "items": { + "type": "string" + } + }, + cache_size: {"type" : "number"}, + cache_level: {"type" : "number"}, + max_num_cu_shared: {"type" : "number"}, + num_cache_instance: {"type" : "number"} + } + } Field | Description ---|--- -`cache_index` | cache index - up to 10 caches will be available -`cache_flags` | list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE"). +`cache_index` | cache index is a string of format "cache_#" up to 10 caches will be available +`cache_properties` | list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE"). `cache_size` | size of cache in KB `cache_level` | level of cache `max_num_cu_shared` | max number of compute units shared @@ -2091,7 +2106,7 @@ Output: Dictionary with fields `average_umc_activity` | Average umc (Universal Memory Controller) activity | % `average_mm_activity` | Average mm (multimedia) engine activity | % `average_socket_power` | Average socket power | W -`energy_accumulator` | Energy accumulated with a 15.3 uJ resolution over 1ns | uJ +`energy_accumulator` | Energy accumulated with a 15.3 uJ resolution over 1ns | uJ `system_clock_counter` | System clock counter | ns `average_gfxclk_frequency` | Average gfx clock frequency | MHz `average_socclk_frequency` | Average soc clock frequency | MHz @@ -2119,7 +2134,7 @@ Output: Dictionary with fields `voltage_soc` | soc voltage | mV `voltage_gfx` | gfx voltage | mV `voltage_mem` | mem voltage | mV -`indep_throttle_status` | ASIC independent throttle status (see drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h for bit flags) | +`indep_throttle_status` | ASIC independent throttle status (see drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h for bit flags) | `current_socket_power` | Current socket power (also known as instant socket power) | W `vcn_activity` | List of VCN encode/decode engine utilization per AID | % `gfxclk_lock_status` | Clock lock status. Each bit corresponds to clock instance. | @@ -6023,3 +6038,43 @@ try: except AmdSmiException as e: print(e) ``` + +### amdsmi_get_cpu_family + +Description: Get cpu family. + +Output: cpu family + +Exceptions that can be thrown by `amdsmi_get_cpu_family` function: + +* `AmdSmiLibraryException` + +Example: + +```python +try: + cpu_family = amdsmi_get_cpu_family() + print(cpu_family) +except AmdSmiException as e: + print(e) +``` + +### amdsmi_get_cpu_model + +Description: Get cpu model. + +Output: cpu model + +Exceptions that can be thrown by `amdsmi_get_cpu_model` function: + +* `AmdSmiLibraryException` + +Example: + +```python +try: + cpu_model = amdsmi_get_cpu_model() + print(cpu_model) +except AmdSmiException as e: + print(e) +``` diff --git a/py-interface/__init__.py b/py-interface/__init__.py index 76b2921907..5297f0ffb9 100644 --- a/py-interface/__init__.py +++ b/py-interface/__init__.py @@ -72,6 +72,8 @@ try: from .amdsmi_interface import amdsmi_get_metrics_table_version from .amdsmi_interface import amdsmi_get_metrics_table from .amdsmi_interface import amdsmi_first_online_core_on_cpu_socket + from .amdsmi_interface import amdsmi_get_cpu_family + from .amdsmi_interface import amdsmi_get_cpu_model except AttributeError: pass diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index 2002da306a..aac25d4a7c 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -29,6 +29,7 @@ from . import amdsmi_wrapper from .amdsmi_exception import * import sys import math +from time import localtime, asctime, time MAX_NUM_PROCESSES = 1024 @@ -1413,6 +1414,10 @@ def amdsmi_get_metrics_table( ) ) + rawtime = int(mtbl.timestamp) + rawtime = time() + timeinfo = localtime(rawtime) + return { "mtbl_accumulation_counter": mtbl.accumulation_counter, "mtbl_max_socket_temperature": f"{round(check_msb_32(mtbl.max_socket_temperature) * fraction_q10 ,3)} °C", @@ -1425,6 +1430,7 @@ def amdsmi_get_metrics_table( "mtbl_max_socket_power_limit": f"{round(mtbl.max_socket_power_limit * fraction_uq10 ,3)} W", "mtbl_socket_power": f"{round(mtbl.socket_power * fraction_uq10 ,3)} W", "mtbl_timestamp_raw": mtbl.timestamp, + "mtbl_timestamp_readable": f"{asctime(timeinfo)}", "mtbl_socket_energy_acc": f"{round((mtbl.socket_energy_acc * fraction_uq16)/KILO ,3)} kJ", "mtbl_ccd_energy_acc": f"{round((mtbl.ccd_energy_acc * fraction_uq16)/KILO ,3)} kJ", "mtbl_xcd_energy_acc": f"{round((mtbl.xcd_energy_acc * fraction_uq16)/KILO ,3)} kJ", @@ -1459,11 +1465,11 @@ def amdsmi_get_metrics_table( "mtbl_xgmi_write_bandwidth_acc": f"{[round(x*fraction_uq10 ,3) for x in list(mtbl.xgmi_write_bandwidth_acc)]} Gbps", "mtbl_socket_c0_residency": f"{round(mtbl.socket_c0_residency * fraction_uq10 ,3)} %", "mtbl_socket_gfx_busy": f"{round(mtbl.socket_gfx_busy * fraction_uq10 ,3)} %", - "mtbl_dram_bandwidth_utilization": f"{round(mtbl.dram_bandwidth_utilization * fraction_uq10 ,3)} %", + "mtbl_hbm_bandwidth_utilization": f"{round(mtbl.dram_bandwidth_utilization * fraction_uq10 ,3)} %", "mtbl_socket_c0_residency_acc": round(mtbl.socket_c0_residency_acc * fraction_uq10 ,3), "mtbl_socket_gfx_busy_acc": round(mtbl.socket_gfx_busy_acc * fraction_uq10 ,3), - "mtbl_dram_bandwidth_acc": f"{round(mtbl.dram_bandwidth_acc * fraction_uq10 ,3)} Gbps", - "mtbl_max_dram_bandwidth": f"{round(mtbl.max_dram_bandwidth * fraction_uq10 ,3)} Gbps", + "mtbl_hbm_bandwidth_acc": f"{round(mtbl.dram_bandwidth_acc * fraction_uq10 ,3)} Gbps", + "mtbl_max_hbm_bandwidth": f"{round(mtbl.max_dram_bandwidth * fraction_uq10 ,3)} Gbps", "mtbl_dram_bandwidth_utilization_acc": round(mtbl.dram_bandwidth_utilization_acc * fraction_uq10 ,3), "mtbl_pcie_bandwidth_acc": f"{[round(x*fraction_uq10 ,3) for x in list(mtbl.pcie_bandwidth_acc)]} Gbps", "mtbl_prochot_residency_acc": mtbl.prochot_residency_acc, @@ -1490,6 +1496,20 @@ def amdsmi_first_online_core_on_cpu_socket( return pcore_ind.value +def amdsmi_get_cpu_family(): + family = ctypes.c_uint32() + _check_res( + amdsmi_wrapper.amdsmi_get_cpu_family(ctypes.byref(family)) + ) + return family.value + +def amdsmi_get_cpu_model(): + model = ctypes.c_uint32() + _check_res( + amdsmi_wrapper.amdsmi_get_cpu_model(ctypes.byref(model)) + ) + return model.value + def amdsmi_init(flag=AmdSmiInitFlags.INIT_AMD_GPUS): if not isinstance(flag, AmdSmiInitFlags): raise AmdSmiParameterException(flag, AmdSmiInitFlags) @@ -1619,30 +1639,32 @@ def amdsmi_get_gpu_cache_info( cache_info_dict = {} for cache_index in range(cache_info.num_cache_types): + # Put cache_properties at the start of the dictionary for readability cache_dict = { "cache_properties": [], - "cache_size": cache_info.cache[cache_index].cache_size_kb, + "cache_size": cache_info.cache[cache_index].cache_size, "cache_level": cache_info.cache[cache_index].cache_level, "max_num_cu_shared": cache_info.cache[cache_index].max_num_cu_shared, "num_cache_instance": cache_info.cache[cache_index].num_cache_instance } - cache_flags = cache_info.cache[cache_index].flags - data_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_DATA_CACHE - inst_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_INST_CACHE - cpu_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_CPU_CACHE - simd_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_SIMD_CACHE + # Check against cache properties bitmask + cache_properties = cache_info.cache[cache_index].properties + data_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_DATA_CACHE + inst_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_INST_CACHE + cpu_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_CPU_CACHE + simd_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_SIMD_CACHE - cache_flags_status = [data_cache, inst_cache, cpu_cache, simd_cache] - cache_flag_list = [] - for cache_flag in cache_flags_status: - if cache_flag: - flag_name = amdsmi_wrapper.amdsmi_cache_flags_type_t__enumvalues[cache_flag] - flag_name = flag_name.replace("CACHE_FLAGS_", "") - cache_flag_list.append(flag_name) + cache_properties_status = [data_cache, inst_cache, cpu_cache, simd_cache] + cache_property_list = [] + for cache_property in cache_properties_status: + if cache_property: + property_name = amdsmi_wrapper.amdsmi_cache_properties_type_t__enumvalues[cache_property] + property_name = property_name.replace("CACHE_PROPERTIES_", "") + cache_property_list.append(property_name) - cache_dict["cache_properties"] = cache_flag_list - cache_info_dict[f"cache {cache_index}"] = cache_dict + cache_dict["cache_properties"] = cache_property_list + cache_info_dict[f"cache_{cache_index}"] = cache_dict if not cache_info_dict: raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NO_DATA) diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index 7e54a9a190..e73ef07af7 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -813,20 +813,20 @@ struct_amdsmi_vbios_info_t._fields_ = [ amdsmi_vbios_info_t = struct_amdsmi_vbios_info_t -# values for enumeration 'amdsmi_cache_flags_type_t' -amdsmi_cache_flags_type_t__enumvalues = { - 1: 'CACHE_FLAGS_ENABLED', - 2: 'CACHE_FLAGS_DATA_CACHE', - 4: 'CACHE_FLAGS_INST_CACHE', - 8: 'CACHE_FLAGS_CPU_CACHE', - 16: 'CACHE_FLAGS_SIMD_CACHE', +# values for enumeration 'amdsmi_cache_properties_type_t' +amdsmi_cache_properties_type_t__enumvalues = { + 1: 'CACHE_PROPERTIES_ENABLED', + 2: 'CACHE_PROPERTIES_DATA_CACHE', + 4: 'CACHE_PROPERTIES_INST_CACHE', + 8: 'CACHE_PROPERTIES_CPU_CACHE', + 16: 'CACHE_PROPERTIES_SIMD_CACHE', } -CACHE_FLAGS_ENABLED = 1 -CACHE_FLAGS_DATA_CACHE = 2 -CACHE_FLAGS_INST_CACHE = 4 -CACHE_FLAGS_CPU_CACHE = 8 -CACHE_FLAGS_SIMD_CACHE = 16 -amdsmi_cache_flags_type_t = ctypes.c_uint32 # enum +CACHE_PROPERTIES_ENABLED = 1 +CACHE_PROPERTIES_DATA_CACHE = 2 +CACHE_PROPERTIES_INST_CACHE = 4 +CACHE_PROPERTIES_CPU_CACHE = 8 +CACHE_PROPERTIES_SIMD_CACHE = 16 +amdsmi_cache_properties_type_t = ctypes.c_uint32 # enum class struct_amdsmi_gpu_cache_info_t(Structure): pass @@ -835,9 +835,9 @@ class struct_cache_(Structure): struct_cache_._pack_ = 1 # source:False struct_cache_._fields_ = [ - ('cache_size_kb', ctypes.c_uint32), + ('cache_size', ctypes.c_uint32), ('cache_level', ctypes.c_uint32), - ('flags', ctypes.c_uint32), + ('properties', ctypes.c_uint32), ('max_num_cu_shared', ctypes.c_uint32), ('num_cache_instance', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 3), @@ -2294,6 +2294,12 @@ amdsmi_get_metrics_table.argtypes = [amdsmi_processor_handle, ctypes.POINTER(str amdsmi_first_online_core_on_cpu_socket = _libraries['libamd_smi.so'].amdsmi_first_online_core_on_cpu_socket amdsmi_first_online_core_on_cpu_socket.restype = amdsmi_status_t amdsmi_first_online_core_on_cpu_socket.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_cpu_family = _libraries['libamd_smi.so'].amdsmi_get_cpu_family +amdsmi_get_cpu_family.restype = amdsmi_status_t +amdsmi_get_cpu_family.argtypes = [ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_cpu_model = _libraries['libamd_smi.so'].amdsmi_get_cpu_model +amdsmi_get_cpu_model.restype = amdsmi_status_t +amdsmi_get_cpu_model.argtypes = [ctypes.POINTER(ctypes.c_uint32)] amdsmi_get_esmi_err_msg = _libraries['libamd_smi.so'].amdsmi_get_esmi_err_msg amdsmi_get_esmi_err_msg.restype = amdsmi_status_t amdsmi_get_esmi_err_msg.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))] @@ -2415,9 +2421,9 @@ __all__ = \ 'AMDSMI_VRAM_VENDOR__WINBOND', 'AMDSMI_XGMI_STATUS_ERROR', 'AMDSMI_XGMI_STATUS_MULTIPLE_ERRORS', 'AMDSMI_XGMI_STATUS_NO_ERRORS', 'AMD_APU', 'AMD_CPU', - 'AMD_CPU_CORE', 'AMD_GPU', 'CACHE_FLAGS_CPU_CACHE', - 'CACHE_FLAGS_DATA_CACHE', 'CACHE_FLAGS_ENABLED', - 'CACHE_FLAGS_INST_CACHE', 'CACHE_FLAGS_SIMD_CACHE', + 'AMD_CPU_CORE', 'AMD_GPU', 'CACHE_PROPERTIES_CPU_CACHE', + 'CACHE_PROPERTIES_DATA_CACHE', 'CACHE_PROPERTIES_ENABLED', + 'CACHE_PROPERTIES_INST_CACHE', 'CACHE_PROPERTIES_SIMD_CACHE', 'CLK_TYPE_DCEF', 'CLK_TYPE_DCLK0', 'CLK_TYPE_DCLK1', 'CLK_TYPE_DF', 'CLK_TYPE_FIRST', 'CLK_TYPE_GFX', 'CLK_TYPE_MEM', 'CLK_TYPE_PCIE', 'CLK_TYPE_SOC', 'CLK_TYPE_SYS', 'CLK_TYPE_VCLK0', @@ -2465,7 +2471,7 @@ __all__ = \ 'VRAM_TYPE_GDDR6', 'VRAM_TYPE_HBM', 'VRAM_TYPE_UNKNOWN', 'VRAM_TYPE__MAX', 'WR_BW0', 'amd_metrics_table_header_t', 'amdsmi_asic_info_t', 'amdsmi_bdf_t', 'amdsmi_bit_field_t', - 'amdsmi_board_info_t', 'amdsmi_cache_flags_type_t', + 'amdsmi_board_info_t', 'amdsmi_cache_properties_type_t', 'amdsmi_card_form_factor_t', 'amdsmi_clk_info_t', 'amdsmi_clk_type_t', 'amdsmi_compute_partition_type_t', 'amdsmi_container_types_t', 'amdsmi_counter_command_t', @@ -2490,8 +2496,9 @@ __all__ = \ 'amdsmi_get_cpu_current_xgmi_bw', 'amdsmi_get_cpu_ddr_bw', 'amdsmi_get_cpu_dimm_power_consumption', 'amdsmi_get_cpu_dimm_temp_range_and_refresh_rate', - 'amdsmi_get_cpu_dimm_thermal_sensor', 'amdsmi_get_cpu_fclk_mclk', - 'amdsmi_get_cpu_hsmp_proto_ver', 'amdsmi_get_cpu_prochot_status', + 'amdsmi_get_cpu_dimm_thermal_sensor', 'amdsmi_get_cpu_family', + 'amdsmi_get_cpu_fclk_mclk', 'amdsmi_get_cpu_hsmp_proto_ver', + 'amdsmi_get_cpu_model', 'amdsmi_get_cpu_prochot_status', 'amdsmi_get_cpu_pwr_svi_telemetry_all_rails', 'amdsmi_get_cpu_smu_fw_version', 'amdsmi_get_cpu_socket_c0_residency', diff --git a/rocm_smi/src/rocm_smi.cc b/rocm_smi/src/rocm_smi.cc index 6326abdee9..98e25be381 100755 --- a/rocm_smi/src/rocm_smi.cc +++ b/rocm_smi/src/rocm_smi.cc @@ -738,7 +738,7 @@ rsmi_dev_ecc_count_get(uint32_t dv_ind, rsmi_gpu_block_t block, ret = GetDevValueVec(type, dv_ind, &val_vec); if (val_vec.size() < 2 ) ret = RSMI_STATUS_FILE_ERROR; - if (ret == RSMI_STATUS_FILE_ERROR || val_vec.size() != 2) { + if (ret == RSMI_STATUS_FILE_ERROR) { ss << __PRETTY_FUNCTION__ << " | ======= end =======" << ", GetDevValueVec() ret was RSMI_STATUS_FILE_ERROR " << "-> reporting RSMI_STATUS_NOT_SUPPORTED"; diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index b940ec9113..472d7ba325 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -445,23 +445,22 @@ amdsmi_status_t amdsmi_get_gpu_cache_info( info->num_cache_types = rsmi_info.num_cache_types; for (unsigned int i =0; i < rsmi_info.num_cache_types; i++) { - info->cache[i].cache_size_kb = rsmi_info.cache[i].cache_size_kb; + info->cache[i].cache_size = rsmi_info.cache[i].cache_size_kb; info->cache[i].cache_level = rsmi_info.cache[i].cache_level; info->cache[i].max_num_cu_shared = rsmi_info.cache[i].max_num_cu_shared; info->cache[i].num_cache_instance = rsmi_info.cache[i].num_cache_instance; // convert from sysfs type to CRAT type(HSA Cache Affinity type) - info->cache[i].flags = 0; + info->cache[i].properties = 0; if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_DATA) - info->cache[i].flags |= CACHE_FLAGS_DATA_CACHE; + info->cache[i].properties |= CACHE_PROPERTIES_DATA_CACHE; if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_INSTRUCTION) - info->cache[i].flags |= CACHE_FLAGS_INST_CACHE; + info->cache[i].properties |= CACHE_PROPERTIES_INST_CACHE; if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_CPU) - info->cache[i].flags |= CACHE_FLAGS_CPU_CACHE; + info->cache[i].properties |= CACHE_PROPERTIES_CPU_CACHE; if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_HSACU) - info->cache[i].flags |= CACHE_FLAGS_SIMD_CACHE; + info->cache[i].properties |= CACHE_PROPERTIES_SIMD_CACHE; } - return AMDSMI_STATUS_SUCCESS; } @@ -3082,6 +3081,38 @@ amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_processor_handle p return AMDSMI_STATUS_SUCCESS; } +amdsmi_status_t amdsmi_get_cpu_family(uint32_t *cpu_family) +{ + amdsmi_status_t status; + uint32_t family; + + AMDSMI_CHECK_INIT(); + + status = amd::smi::AMDSmiSystem::getInstance().get_cpu_family(&family); + if (status != AMDSMI_STATUS_SUCCESS) + return amdsmi_errno_to_esmi_status(status); + + *cpu_family = family; + + return AMDSMI_STATUS_SUCCESS; +} + +amdsmi_status_t amdsmi_get_cpu_model(uint32_t *cpu_model) +{ + amdsmi_status_t status; + uint32_t model; + + AMDSMI_CHECK_INIT(); + + status = amd::smi::AMDSmiSystem::getInstance().get_cpu_model(&model); + if (status != AMDSMI_STATUS_SUCCESS) + return amdsmi_errno_to_esmi_status(status); + + *cpu_model = model; + + return AMDSMI_STATUS_SUCCESS; +} + amdsmi_status_t amdsmi_get_esmi_err_msg(amdsmi_status_t status, const char **status_string) { for (auto& iter : amd::smi::esmi_status_map) { diff --git a/src/amd_smi/amd_smi_system.cc b/src/amd_smi/amd_smi_system.cc index 3480cbef41..e46eb71784 100644 --- a/src/amd_smi/amd_smi_system.cc +++ b/src/amd_smi/amd_smi_system.cc @@ -56,7 +56,7 @@ namespace smi { #define AMD_SMI_INIT_FLAG_RESRV_TEST1 0x800000000000000 //!< Reserved for test -static amdsmi_status_t get_cpu_family(uint32_t *cpu_family) { +amdsmi_status_t AMDSmiSystem::get_cpu_family(uint32_t *cpu_family) { amdsmi_status_t ret; ret = static_cast(esmi_cpu_family_get(cpu_family)); @@ -68,7 +68,7 @@ static amdsmi_status_t get_cpu_family(uint32_t *cpu_family) { } -static amdsmi_status_t get_cpu_model(uint32_t *cpu_model) { +amdsmi_status_t AMDSmiSystem::get_cpu_model(uint32_t *cpu_model) { amdsmi_status_t ret; ret = static_cast(esmi_cpu_model_get(cpu_model)); diff --git a/src/amd_smi/amd_smi_utils.cc b/src/amd_smi/amd_smi_utils.cc index 79d9103699..f73a1a7626 100644 --- a/src/amd_smi/amd_smi_utils.cc +++ b/src/amd_smi/amd_smi_utils.cc @@ -522,6 +522,7 @@ amdsmi_status_t smi_amdgpu_get_market_name_from_dev_id(uint32_t device_id, char break; case 0x73a1: case 0x73ae: + case 0x73bf: strcpy(market_name, "NAVI21"); break; case 0x74b4: diff --git a/tools/get_platform.py b/tools/get_platform.py new file mode 100644 index 0000000000..28d61150ee --- /dev/null +++ b/tools/get_platform.py @@ -0,0 +1,99 @@ +import re +import argparse + +def get_platforms(file_name): + # removing the new line characters + with open(file_name) as f: + lines = [line.rstrip() for line in f] + + platform_map = {} + platform_lines = "" + function_line = "" + for line in lines: + if "@platform" in line: + platform_lines += line.replace("*","").lstrip() + if platform_lines =="": + continue + l = line.lstrip() + if len(l) == 0: + continue + if l[0] == '*' or l[0]== '#' or (len(l)>1 and l[0] == '/' and l[1] == '*'): + if function_line != "": + func = ' '.join(function_line.split()) + platforms = re.findall(r"\{(.*?)\}", platform_lines) + for p in platforms: + if p not in platform_map: + platform_map[p]=[func] + else: + platform_map[p].append(func) + platform_lines = "" + function_line = "" + continue + function_line += line + " " + return platform_map + +# string in list1 but not in list2 +def diff(list1, list2): + result = [] + for l1 in list1: + if l1 not in list2: + result.append(l1) + return result + +def common(list1, list2): + result = [] + for l1 in list1: + if l1 in list2: + result.append(l1) + return result + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='amdsmi platform classifier') + parser.add_argument('--platforms', default=False, action='store_true', help='list supported platforms') + parser.add_argument('--list', default="", metavar="platform" , help='List function in a platform') + parser.add_argument('--diff' , default=None, metavar="platform", nargs=2, help='Find the APIs in platform1 but not in platform2') + parser.add_argument('--common' , default=None, metavar="platform", nargs=2, help='Find the common APIs of two platforms') + + file_name="../include/amd_smi/amdsmi.h" + args = parser.parse_args() + platform_map=get_platforms(file_name) + if args.platforms: + for p in platform_map: + print (p) + exit(0) + + if args.list: + if args.list not in platform_map: + print("Unknown platform ", args.list) + exit(1) + for f in platform_map[args.list]: + print (f) + exit(0) + + if args.diff != None: + if args.diff[0] not in platform_map or args.diff[1] not in platform_map: + print("Unknown platforms ", args.diff) + exit(1) + platforms0 = platform_map[args.diff[0]] + platforms1 = platform_map[args.diff[1]] + result = diff(platforms0, platforms1) + print("APIs in", args.diff[0], "but not in", args.diff[1]) + for f in result: + print(f) + exit(0) + + + if args.common != None: + if args.common[0] not in platform_map or args.common[1] not in platform_map: + print("Unknown platforms ", args.common) + exit(1) + platforms0 = platform_map[args.common[0]] + platforms1 = platform_map[args.common[1]] + result = common(platforms0, platforms1) + print("APIs in both ", args.common[0], "and", args.common[1]) + for f in result: + print(f) + exit(0) + + parser.print_help() +