Port rocm-smi function to amd-smi
Port most rocm-smi function to amd-smi and add unit tests.
Change-Id: I6387a4bdaf20ead2389c99bb01d438156ccd0747
[ROCm/amdsmi commit: f1d02aca79]
Этот коммит содержится в:
@@ -760,7 +760,7 @@ WARN_LOGFILE =
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../README.md \
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/../include/rocm_smi/rocm_smi.h
|
||||
@CMAKE_CURRENT_SOURCE_DIR@/../amd_smi/include/amd_smi.h
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
|
||||
@@ -65,7 +65,7 @@ int main() {
|
||||
|
||||
// Init amdsmi for sockets and devices.
|
||||
// Here we are only interested in AMD_GPUS.
|
||||
ret = amdsmi_init(AMD_SMI_INIT_AMD_GPUS);
|
||||
ret = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
// Get all sockets
|
||||
@@ -93,7 +93,7 @@ int main() {
|
||||
// For each device of the socket, get name and temperature.
|
||||
for (uint32_t j=0; j < device_count; j++) {
|
||||
// Get device type. Since the amdsmi is initialized with
|
||||
// AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
|
||||
// AMDSMI_INIT_AMD_GPUS, the device_type must be AMD_GPU.
|
||||
device_type_t device_type;
|
||||
ret = amdsmi_get_device_type(device_handles[j], &device_type);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
@@ -58,12 +58,13 @@ extern "C" {
|
||||
*
|
||||
* Initialization flags may be OR'd together and passed to ::amdsmi_init().
|
||||
*/
|
||||
|
||||
#define AMD_SMI_INIT_ALL_DEVICES 0x0 // Default option
|
||||
#define AMD_SMI_INIT_AMD_CPUS (1 << 0)
|
||||
#define AMD_SMI_INIT_AMD_GPUS (1 << 1)
|
||||
#define AMD_SMI_INIT_NON_AMD_CPUS (1 << 2)
|
||||
#define AMD_SMI_INIT_NON_AMD_GPUS (1 << 3)
|
||||
typedef enum amdsmi_init_flags {
|
||||
AMDSMI_INIT_ALL_DEVICES = 0x0, // Default option
|
||||
AMDSMI_INIT_AMD_CPUS = (1 << 0),
|
||||
AMDSMI_INIT_AMD_GPUS = (1 << 1),
|
||||
AMDSMI_INIT_NON_AMD_CPUS = (1 << 2),
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3)
|
||||
} amdsmi_init_flags_t;
|
||||
|
||||
/* Maximum size definitions GPUVSMI */
|
||||
#define AMDSMI_MAX_MM_IP_COUNT 8
|
||||
@@ -141,14 +142,15 @@ typedef enum amdsmi_status {
|
||||
* Clock types
|
||||
*/
|
||||
typedef enum amdsmi_clk_type {
|
||||
CLOCK_TYPE_SYS, //!< System clock
|
||||
CLOCK_TYPE_SYS = 0x0, //!< System clock
|
||||
CLOCK_TYPE_FIRST = CLOCK_TYPE_SYS,
|
||||
CLOCK_TYPE_GFX = CLOCK_TYPE_SYS,
|
||||
CLOCK_TYPE_DF, //!< Data Fabric clock (for ASICs
|
||||
//!< running on a separate clock)
|
||||
CLOCK_TYPE_DCEF, //!< Display Controller Engine clock
|
||||
CLOCK_TYPE_SOC,
|
||||
CLOCK_TYPE_MEM,
|
||||
CLOCK_TYPE_PCIE,
|
||||
CLOCK_TYPE_GFX,
|
||||
CLOCK_TYPE_VCLK0,
|
||||
CLOCK_TYPE_VCLK1,
|
||||
CLOCK_TYPE_DCLK0,
|
||||
@@ -165,14 +167,15 @@ typedef amdsmi_clk_type_t amdsmi_clk_type;
|
||||
*/
|
||||
typedef enum amdsmi_temperature_type {
|
||||
TEMPERATURE_TYPE_EDGE,
|
||||
TEMPERATURE_TYPE_FIRST = TEMPERATURE_TYPE_EDGE,
|
||||
TEMPERATURE_TYPE_JUNCTION,
|
||||
TEMPERATURE_TYPE_VRAM,
|
||||
TEMPERATURE_TYPE_PLX,
|
||||
TEMPERATURE_TYPE_HBM_0,
|
||||
TEMPERATURE_TYPE_HBM_1,
|
||||
TEMPERATURE_TYPE_HBM_2,
|
||||
TEMPERATURE_TYPE_HBM_3,
|
||||
TEMPERATURE_TYPE__MAX,
|
||||
TEMPERATURE_TYPE_PLX,
|
||||
TEMPERATURE_TYPE__MAX = TEMPERATURE_TYPE_PLX
|
||||
} amdsmi_temperature_type_t;
|
||||
|
||||
/**
|
||||
@@ -181,6 +184,7 @@ typedef enum amdsmi_temperature_type {
|
||||
*/
|
||||
typedef enum amdsmi_fw_block {
|
||||
FW_ID_SMU = 1,
|
||||
FW_ID_FIRST = FW_ID_SMU,
|
||||
FW_ID_CP_CE,
|
||||
FW_ID_CP_PFP,
|
||||
FW_ID_CP_ME,
|
||||
@@ -239,142 +243,143 @@ typedef amdsmi_range_t amdsmi_range;
|
||||
/// \endcond
|
||||
|
||||
typedef struct amdsmi_xgmi_info {
|
||||
uint8_t xgmi_lanes;
|
||||
uint64_t xgmi_hive_id;
|
||||
uint64_t xgmi_node_id;
|
||||
uint32_t index;
|
||||
uint8_t xgmi_lanes;
|
||||
uint64_t xgmi_hive_id;
|
||||
uint64_t xgmi_node_id;
|
||||
uint32_t index;
|
||||
} amdsmi_xgmi_info_t;
|
||||
|
||||
/**
|
||||
* GPU Capability info
|
||||
*/
|
||||
typedef struct amdsmi_gpu_caps {
|
||||
struct {
|
||||
uint32_t gfxip_major;
|
||||
uint32_t gfxip_minor;
|
||||
uint16_t gfxip_cu_count;
|
||||
} gfx;
|
||||
struct {
|
||||
uint8_t mm_ip_count;
|
||||
uint8_t mm_ip_list[AMDSMI_MAX_MM_IP_COUNT];
|
||||
} mm;
|
||||
struct {
|
||||
uint32_t gfxip_major;
|
||||
uint32_t gfxip_minor;
|
||||
uint16_t gfxip_cu_count;
|
||||
} gfx;
|
||||
struct {
|
||||
uint8_t mm_ip_count;
|
||||
uint8_t mm_ip_list[AMDSMI_MAX_MM_IP_COUNT];
|
||||
} mm;
|
||||
|
||||
bool ras_supported;
|
||||
uint8_t max_vf_num;
|
||||
uint32_t gfx_ip_count;
|
||||
uint32_t dma_ip_count;
|
||||
bool ras_supported;
|
||||
uint8_t max_vf_num;
|
||||
uint32_t gfx_ip_count;
|
||||
uint32_t dma_ip_count;
|
||||
} amdsmi_gpu_caps_t;
|
||||
|
||||
typedef struct amdsmi_vram_info {
|
||||
uint32_t vram_total;
|
||||
uint32_t vram_used;
|
||||
uint32_t vram_total;
|
||||
uint32_t vram_used;
|
||||
} amdsmi_vram_info_t;
|
||||
|
||||
typedef struct amdsmi_frequency_range {
|
||||
amdsmi_range_t supported_freq_range;
|
||||
amdsmi_range_t current_freq_range;
|
||||
} amdsmi_frequency_range_t;
|
||||
|
||||
typedef union amdsmi_bdf {
|
||||
struct {
|
||||
uint64_t function_number : 6;
|
||||
uint64_t device_number : 10;
|
||||
uint64_t bus_number : 16;
|
||||
uint64_t domain_number : 32;
|
||||
};
|
||||
uint64_t as_uint;
|
||||
struct {
|
||||
uint64_t function_number : 3;
|
||||
uint64_t device_number : 5;
|
||||
uint64_t bus_number : 8;
|
||||
uint64_t domain_number : 48;
|
||||
};
|
||||
uint64_t as_uint;
|
||||
} amdsmi_bdf_t;
|
||||
|
||||
typedef struct amdsmi_power_cap_info {
|
||||
uint32_t power_cap;
|
||||
uint32_t default_power_cap;
|
||||
uint32_t dpm_cap;
|
||||
uint32_t min_power_cap;
|
||||
uint32_t max_power_cap;
|
||||
uint64_t power_cap;
|
||||
uint64_t default_power_cap;
|
||||
uint64_t dpm_cap;
|
||||
uint64_t min_power_cap;
|
||||
uint64_t max_power_cap;
|
||||
} amdsmi_power_cap_info_t;
|
||||
|
||||
typedef struct amdsmi_vbios_info {
|
||||
char name[AMDSMI_MAX_STRING_LENGTH];
|
||||
uint32_t vbios_version;
|
||||
char build_date[AMDSMI_MAX_DATE_LENGTH];
|
||||
char part_number[AMDSMI_MAX_STRING_LENGTH];
|
||||
char vbios_version_string[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char name[AMDSMI_MAX_STRING_LENGTH];
|
||||
uint32_t vbios_version;
|
||||
char build_date[AMDSMI_MAX_DATE_LENGTH];
|
||||
char part_number[AMDSMI_MAX_STRING_LENGTH];
|
||||
char vbios_version_string[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
} amdsmi_vbios_info_t;
|
||||
|
||||
typedef struct amdsmi_fw_info {
|
||||
uint8_t num_fw_info;
|
||||
struct {
|
||||
amdsmi_fw_block_t fw_id;
|
||||
uint32_t fw_version;
|
||||
} fw_info_list[FW_ID__MAX];
|
||||
uint8_t num_fw_info;
|
||||
struct {
|
||||
amdsmi_fw_block_t fw_id;
|
||||
uint32_t fw_version;
|
||||
} fw_info_list[FW_ID__MAX];
|
||||
} amdsmi_fw_info_t;
|
||||
|
||||
typedef struct amdsmi_asic_info {
|
||||
char market_name[AMDSMI_MAX_STRING_LENGTH];
|
||||
uint32_t family; /**< Has zero value */
|
||||
uint32_t vendor_id; //< Use 32 bit to be compatible with other platform.
|
||||
uint32_t subvendor_id;
|
||||
uint32_t device_id;
|
||||
uint32_t rev_id;
|
||||
uint64_t asic_serial;
|
||||
char market_name[AMDSMI_MAX_STRING_LENGTH];
|
||||
uint32_t family; /**< Has zero value */
|
||||
uint32_t vendor_id; //< Use 32 bit to be compatible with other platform.
|
||||
uint32_t subvendor_id;
|
||||
uint32_t device_id;
|
||||
uint32_t rev_id;
|
||||
uint64_t asic_serial;
|
||||
} amdsmi_asic_info_t;
|
||||
|
||||
typedef struct amdsmi_board_info {
|
||||
uint64_t serial_number;
|
||||
bool is_master;
|
||||
char model_number[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char product_serial[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char fru_id[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char product_name[AMDSMI_PRODUCT_NAME_LENGTH];
|
||||
char manufacturer_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
uint64_t serial_number;
|
||||
bool is_master;
|
||||
char model_number[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char product_serial[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char fru_id[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char product_name[AMDSMI_PRODUCT_NAME_LENGTH];
|
||||
char manufacturer_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
} amdsmi_board_info_t;
|
||||
|
||||
typedef struct amdsmi_temperature {
|
||||
uint16_t cur_temp;
|
||||
uint16_t cur_temp;
|
||||
} amdsmi_temperature_t;
|
||||
|
||||
typedef struct amdsmi_temperature_limit {
|
||||
uint16_t limit;
|
||||
uint16_t limit;
|
||||
} amdsmi_temperature_limit_t;
|
||||
|
||||
typedef struct amdsmi_power_limit {
|
||||
uint16_t limit;
|
||||
uint16_t limit;
|
||||
} amdsmi_power_limit_t;
|
||||
|
||||
typedef struct amdsmi_power_measure {
|
||||
uint16_t average_socket_power;
|
||||
uint64_t energy_accumulator; // v1 mod. (32->64)
|
||||
uint32_t voltage_gfx; //GFX voltage measurement in mV
|
||||
uint32_t voltage_soc; // SOC voltage measurement in mV
|
||||
uint32_t voltage_mem; // MEM voltage measurement in mV
|
||||
uint16_t average_socket_power;
|
||||
uint64_t energy_accumulator; // v1 mod. (32->64)
|
||||
uint32_t voltage_gfx; // GFX voltage measurement in mV
|
||||
uint32_t voltage_soc; // SOC voltage measurement in mV
|
||||
uint32_t voltage_mem; // MEM voltage measurement in mV
|
||||
} amdsmi_power_measure_t;
|
||||
|
||||
typedef struct amdsmi_clock_measure {
|
||||
uint32_t cur_clk;
|
||||
uint32_t avg_clk;
|
||||
uint32_t min_clk;
|
||||
uint32_t max_clk;
|
||||
uint32_t cur_clk;
|
||||
uint32_t avg_clk;
|
||||
uint32_t min_clk;
|
||||
uint32_t max_clk;
|
||||
} amdsmi_clock_measure_t;
|
||||
|
||||
typedef struct amdsmi_engine_usage {
|
||||
uint32_t average_gfx_activity;
|
||||
uint32_t average_umc_activity;
|
||||
uint32_t average_mm_activity[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint32_t average_gfx_activity;
|
||||
uint32_t average_umc_activity;
|
||||
uint32_t average_mm_activity[AMDSMI_MAX_MM_IP_COUNT];
|
||||
} amdsmi_engine_usage_t;
|
||||
|
||||
typedef uint32_t amdsmi_process_handle;
|
||||
|
||||
typedef struct amdsmi_process_info {
|
||||
char name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
amdsmi_process_handle pid;
|
||||
uint64_t mem; /** in bytes */
|
||||
struct {
|
||||
uint16_t gfx[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t compute[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t sdma[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t enc[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t dec[AMDSMI_MAX_MM_IP_COUNT];
|
||||
} usage; /** percentage 0-100% times 100 */
|
||||
char container_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
amdsmi_process_handle pid;
|
||||
uint64_t mem; /** in bytes */
|
||||
struct {
|
||||
uint16_t gfx[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t compute[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t sdma[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t enc[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint16_t dec[AMDSMI_MAX_MM_IP_COUNT];
|
||||
} usage; /** percentage 0-100% times 100 */
|
||||
char container_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
} amdsmi_proc_info_t;
|
||||
|
||||
//! Guaranteed maximum possible number of supported frequencies
|
||||
@@ -2201,7 +2206,7 @@ amdsmi_status_t amdsmi_dev_gpu_clk_freq_get(amdsmi_device_handle device_handle,
|
||||
* @retval ::AMDSMI_STATUS_INVALID_ARGS the provided arguments are not valid
|
||||
*
|
||||
*/
|
||||
amdsmi_status_t amdsmi_dev_gpu_reset(int32_t dv_ind);
|
||||
amdsmi_status_t amdsmi_dev_gpu_reset(amdsmi_device_handle device_handle);
|
||||
|
||||
/**
|
||||
* @brief This function retrieves the voltage/frequency curve information
|
||||
@@ -2435,7 +2440,7 @@ amdsmi_dev_power_profile_presets_get(amdsmi_device_handle device_handle, uint32_
|
||||
*
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_perf_level_set(int32_t dv_ind, amdsmi_dev_perf_level_t perf_lvl);
|
||||
amdsmi_dev_perf_level_set(amdsmi_device_handle device_handle, amdsmi_dev_perf_level_t perf_lvl);
|
||||
|
||||
/**
|
||||
* @brief Set the PowerPlay performance level associated with the device with
|
||||
@@ -2501,7 +2506,7 @@ amdsmi_dev_perf_level_set_v1(amdsmi_device_handle device_handle, amdsmi_dev_perf
|
||||
* @retval ::AMDSMI_STATUS_PERMISSION function requires root access
|
||||
*
|
||||
*/
|
||||
amdsmi_status_t amdsmi_dev_overdrive_level_set(int32_t dv_ind, uint32_t od);
|
||||
amdsmi_status_t amdsmi_dev_overdrive_level_set(amdsmi_device_handle device_handle, uint32_t od);
|
||||
|
||||
/**
|
||||
* @brief Set the overdrive percent associated with the device with provided
|
||||
@@ -3240,7 +3245,8 @@ amdsmi_minmax_bandwidth_get(amdsmi_device_handle device_handle_src, amdsmi_devic
|
||||
*
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst,
|
||||
amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src,
|
||||
amdsmi_device_handle device_handle_dst,
|
||||
uint64_t *hops, AMDSMI_IO_LINK_TYPE *type);
|
||||
|
||||
/**
|
||||
@@ -3729,7 +3735,8 @@ amdsmi_get_board_info(amdsmi_device_handle dev, amdsmi_board_info_t *info);
|
||||
* system.
|
||||
*
|
||||
* \param [in] dev - 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.
|
||||
* \param [out] info - Reference to power caps information structure. Must be
|
||||
* allocated by user.
|
||||
*
|
||||
@@ -3743,7 +3750,8 @@ amdsmi_get_board_info(amdsmi_device_handle dev, amdsmi_board_info_t *info);
|
||||
* * -::SMI_ERR_API_FAILED - Other errors
|
||||
*/
|
||||
amdsmi_status
|
||||
amdsmi_get_power_cap_info(amdsmi_device_handle dev, amdsmi_power_cap_info_t *info);
|
||||
amdsmi_get_power_cap_info(amdsmi_device_handle dev, uint32_t sensor_ind,
|
||||
amdsmi_power_cap_info_t *info);
|
||||
|
||||
/**
|
||||
* \brief Returns XGMI information for the GPU.
|
||||
|
||||
@@ -76,7 +76,7 @@ class AMDSmiSystem {
|
||||
amdsmi_device_handle* device_handle);
|
||||
|
||||
private:
|
||||
AMDSmiSystem() : init_flag_(AMD_SMI_INIT_ALL_DEVICES) {}
|
||||
AMDSmiSystem() : init_flag_(AMDSMI_INIT_ALL_DEVICES) {}
|
||||
uint64_t init_flag_;
|
||||
AMDSmiDrm drm_;
|
||||
std::vector<AMDSmiSocket*> sockets_;
|
||||
|
||||
@@ -202,8 +202,29 @@ amdsmi_status_t amdsmi_get_board_info(amdsmi_device_handle device_handle,
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
return rsmi_wrapper(rsmi_dev_name_get, device_handle,
|
||||
auto r = rsmi_wrapper(rsmi_dev_name_get, device_handle,
|
||||
board_info->product_name, AMDSMI_PRODUCT_NAME_LENGTH);
|
||||
if (r != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
// TODO(bliu) : rsmi_dev_serial_number_get, rsmi_dev_brand_get,
|
||||
// rsmi_dev_sku_get, Do we include in the board_info or different data structure
|
||||
/*
|
||||
r = rsmi_wrapper(rsmi_dev_serial_number_get, device_handle,
|
||||
board_info->serial_number, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
if (r != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
|
||||
r = rsmi_wrapper(rsmi_dev_brand_get, device_handle,
|
||||
board_info->brand, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
if (r != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
|
||||
r = rsmi_wrapper(rsmi_dev_sku_get, device_handle,
|
||||
&(board_info->sku));
|
||||
if (r != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
*/
|
||||
return r;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_temp_metric_get(amdsmi_device_handle device_handle,
|
||||
@@ -213,6 +234,18 @@ amdsmi_status_t amdsmi_dev_temp_metric_get(amdsmi_device_handle device_handle,
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
// Get the PLX temperature from the gpu_metrics
|
||||
if (sensor_type == TEMPERATURE_TYPE_PLX) {
|
||||
amdsmi_gpu_metrics_t metric_info;
|
||||
auto r_status = amdsmi_dev_gpu_metrics_info_get(
|
||||
device_handle, &metric_info);
|
||||
if (r_status != AMDSMI_STATUS_SUCCESS)
|
||||
return r_status;
|
||||
|
||||
*temperature = metric_info.temperature_vrsoc;
|
||||
return r_status;
|
||||
}
|
||||
|
||||
return rsmi_wrapper(rsmi_dev_temp_metric_get, device_handle, sensor_type,
|
||||
static_cast<rsmi_temperature_metric_t>(metric), temperature);
|
||||
}
|
||||
@@ -337,6 +370,15 @@ amdsmi_status_t amdsmi_get_caps_info(amdsmi_device_handle device_handle,
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO(bliu): add more vbios info
|
||||
amdsmi_status amdsmi_get_vbios_info(amdsmi_device_handle device_handle,
|
||||
amdsmi_vbios_info_t *info) {
|
||||
if (info == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
return rsmi_wrapper(rsmi_dev_vbios_version_get, device_handle,
|
||||
info->vbios_version_string, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_fan_rpms_get(amdsmi_device_handle device_handle,
|
||||
uint32_t sensor_ind, int64_t *speed) {
|
||||
@@ -375,11 +417,32 @@ amdsmi_status_t amdsmi_dev_id_get(amdsmi_device_handle device_handle,
|
||||
// TODO(bliu) : add other asic info
|
||||
amdsmi_status
|
||||
amdsmi_get_asic_info(amdsmi_device_handle dev, amdsmi_asic_info_t *info) {
|
||||
if (info == nullptr) return AMDSMI_STATUS_INVAL;
|
||||
if (info == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
// Set init value
|
||||
memset(info, 0, sizeof(amdsmi_asic_info_t));
|
||||
|
||||
// ignore errors to set multiple properties
|
||||
uint16_t vendor_id = 0;
|
||||
amdsmi_status status = rsmi_wrapper(rsmi_dev_vendor_id_get, dev,
|
||||
&vendor_id);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) info->vendor_id = vendor_id;
|
||||
if (status == AMDSMI_STATUS_SUCCESS)
|
||||
info->vendor_id = vendor_id;
|
||||
|
||||
// TODO(bliu) : get unique_id from rocm-smi and then covert to string
|
||||
// status = rsmi_wrapper(rsmi_dev_unique_id_get, dev, &(info->unique_id));
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO(bliu) : get all fw info
|
||||
amdsmi_status amdsmi_get_fw_info(amdsmi_device_handle dev,
|
||||
amdsmi_fw_info_t *info) {
|
||||
if (info == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
auto status = AMDSMI_STATUS_SUCCESS;
|
||||
// rsmi_wrapper(rsmi_dev_firmware_version_get, dev, &(info->unique_id));
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -389,11 +452,27 @@ amdsmi_status_t amdsmi_dev_subsystem_id_get(amdsmi_device_handle device_handle,
|
||||
return rsmi_wrapper(rsmi_dev_subsystem_id_get, device_handle, id);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_subsystem_name_get(
|
||||
amdsmi_device_handle device_handle,
|
||||
char *name, size_t len) {
|
||||
return rsmi_wrapper(rsmi_dev_subsystem_name_get, device_handle, name, len);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_vendor_name_get(
|
||||
amdsmi_device_handle device_handle, char *name, size_t len) {
|
||||
return rsmi_wrapper(rsmi_dev_vendor_name_get, device_handle, name, len);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_subsystem_vendor_id_get(
|
||||
amdsmi_device_handle device_handle, uint16_t *id) {
|
||||
return rsmi_wrapper(rsmi_dev_subsystem_vendor_id_get, device_handle, id);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_vram_vendor_get(amdsmi_device_handle device_handle,
|
||||
char *brand, uint32_t len) {
|
||||
return rsmi_wrapper(rsmi_dev_vram_vendor_get, device_handle, brand, len);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_event_notification_init(amdsmi_device_handle device_handle) {
|
||||
return rsmi_wrapper(rsmi_event_notification_init, device_handle);
|
||||
@@ -538,7 +617,8 @@ amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src, amdsmi_device_
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst,
|
||||
amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src,
|
||||
amdsmi_device_handle device_handle_dst,
|
||||
bool *accessible) {
|
||||
amd::smi::AMDSmiGPUDevice* src_device = nullptr;
|
||||
amd::smi::AMDSmiGPUDevice* dst_device = nullptr;
|
||||
@@ -630,8 +710,8 @@ amdsmi_compute_process_info_get(amdsmi_process_info_t *procs, uint32_t *num_item
|
||||
return rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_compute_process_info_by_pid_get(uint32_t pid, amdsmi_process_info_t *proc) {
|
||||
amdsmi_status_t amdsmi_compute_process_info_by_pid_get(uint32_t pid,
|
||||
amdsmi_process_info_t *proc) {
|
||||
if (proc == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
auto r = rsmi_compute_process_info_by_pid_get(pid,
|
||||
@@ -648,3 +728,355 @@ amdsmi_compute_process_gpus_get(uint32_t pid, uint32_t *dv_indices,
|
||||
return rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_ecc_count_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_gpu_block_t block, amdsmi_error_count_t *ec) {
|
||||
if (ec == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_ecc_count_get, device_handle,
|
||||
static_cast<rsmi_gpu_block_t>(block),
|
||||
reinterpret_cast<rsmi_error_count_t*>(ec));
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_ecc_enabled_get(amdsmi_device_handle device_handle,
|
||||
uint64_t *enabled_blocks) {
|
||||
if (enabled_blocks == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_ecc_enabled_get, device_handle,
|
||||
enabled_blocks);
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_ecc_status_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_gpu_block_t block,
|
||||
amdsmi_ras_err_state_t *state) {
|
||||
if (state == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_ecc_status_get, device_handle,
|
||||
static_cast<rsmi_gpu_block_t>(block),
|
||||
reinterpret_cast<rsmi_ras_err_state_t*>(state));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_busy_percent_get(amdsmi_device_handle device_handle,
|
||||
uint32_t *busy_percent) {
|
||||
if (busy_percent == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_busy_percent_get, device_handle,
|
||||
busy_percent);
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_gpu_metrics_info_get(
|
||||
amdsmi_device_handle device_handle,
|
||||
amdsmi_gpu_metrics_t *pgpu_metrics) {
|
||||
if (pgpu_metrics == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, device_handle,
|
||||
reinterpret_cast<rsmi_gpu_metrics_t*>(pgpu_metrics));
|
||||
}
|
||||
|
||||
// TODO(bliu): read from libdrm
|
||||
amdsmi_status
|
||||
amdsmi_get_power_cap_info(amdsmi_device_handle device_handle,
|
||||
uint32_t sensor_ind,
|
||||
amdsmi_power_cap_info_t *info) {
|
||||
if (info == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
amd::smi::AMDSmiGPUDevice* gpudevice = nullptr;
|
||||
amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpudevice);
|
||||
if (r != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
|
||||
// Ignore errors to get as much as possible info.
|
||||
memset(info, 0, sizeof(amdsmi_power_cap_info_t));
|
||||
auto rsmi_status = rsmi_dev_power_cap_default_get(gpudevice->get_gpu_id(),
|
||||
&(info->default_power_cap));
|
||||
rsmi_status = rsmi_dev_power_cap_range_get(gpudevice->get_gpu_id(),
|
||||
sensor_ind, &(info->max_power_cap), &(info->min_power_cap));
|
||||
rsmi_status = rsmi_dev_power_cap_get(gpudevice->get_gpu_id(),
|
||||
sensor_ind, &(info->power_cap));
|
||||
|
||||
// TODO(bliu) : dpm_cap
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_power_cap_set(amdsmi_device_handle device_handle,
|
||||
uint32_t sensor_ind, uint64_t cap) {
|
||||
return rsmi_wrapper(rsmi_dev_power_cap_set, device_handle,
|
||||
sensor_ind, cap);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_power_ave_get(amdsmi_device_handle device_handle,
|
||||
uint32_t sensor_ind, uint64_t *power) {
|
||||
if (power == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_power_ave_get, device_handle,
|
||||
sensor_ind, power);
|
||||
}
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_power_profile_presets_get(amdsmi_device_handle device_handle,
|
||||
uint32_t sensor_ind,
|
||||
amdsmi_power_profile_status_t *status) {
|
||||
if (status == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_power_profile_presets_get, device_handle,
|
||||
sensor_ind,
|
||||
reinterpret_cast<rsmi_power_profile_status_t*>(status));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_perf_determinism_mode_set(
|
||||
amdsmi_device_handle device_handle, uint64_t clkvalue) {
|
||||
return rsmi_wrapper(rsmi_perf_determinism_mode_set, device_handle,
|
||||
clkvalue);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_power_profile_set(amdsmi_device_handle device_handle,
|
||||
uint32_t reserved, amdsmi_power_profile_preset_masks_t profile) {
|
||||
return rsmi_wrapper(rsmi_dev_power_profile_set, device_handle,
|
||||
reserved,
|
||||
static_cast<rsmi_power_profile_preset_masks_t>(profile));
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_perf_level_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_dev_perf_level_t *perf) {
|
||||
if (perf == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_perf_level_get, device_handle,
|
||||
reinterpret_cast<rsmi_dev_perf_level_t*>(perf));
|
||||
}
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_perf_level_set(amdsmi_device_handle device_handle,
|
||||
amdsmi_dev_perf_level_t perf_lvl) {
|
||||
return rsmi_wrapper(rsmi_dev_perf_level_set, device_handle,
|
||||
static_cast<rsmi_dev_perf_level_t>(perf_lvl));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_perf_level_set_v1(amdsmi_device_handle device_handle,
|
||||
amdsmi_dev_perf_level_t perf_lvl) {
|
||||
return rsmi_wrapper(rsmi_dev_perf_level_set_v1, device_handle,
|
||||
static_cast<rsmi_dev_perf_level_t>(perf_lvl));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_pci_bandwidth_set(amdsmi_device_handle device_handle,
|
||||
uint64_t bw_bitmask) {
|
||||
return rsmi_wrapper(rsmi_dev_pci_bandwidth_set, device_handle,
|
||||
bw_bitmask);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_pci_bandwidth_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_pcie_bandwidth_t *bandwidth) {
|
||||
return rsmi_wrapper(rsmi_dev_pci_bandwidth_get, device_handle,
|
||||
reinterpret_cast<rsmi_pcie_bandwidth_t*>(bandwidth));
|
||||
}
|
||||
|
||||
// TODO(bliu): other frequencies in amdsmi_clk_type_t
|
||||
amdsmi_status_t amdsmi_dev_gpu_clk_freq_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f) {
|
||||
if (f == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
// Get from gpu_metrics
|
||||
if (clk_type == CLOCK_TYPE_VCLK0 ||
|
||||
clk_type == CLOCK_TYPE_VCLK1 ||
|
||||
clk_type == CLOCK_TYPE_DCLK0 ||
|
||||
clk_type == CLOCK_TYPE_DCLK1 ) {
|
||||
amdsmi_gpu_metrics_t metric_info;
|
||||
auto r_status = amdsmi_dev_gpu_metrics_info_get(
|
||||
device_handle, &metric_info);
|
||||
if (r_status != AMDSMI_STATUS_SUCCESS)
|
||||
return r_status;
|
||||
|
||||
f->num_supported = 1;
|
||||
if (clk_type == CLOCK_TYPE_VCLK0) {
|
||||
f->current = metric_info.current_vclk0;
|
||||
f->frequency[0] = metric_info.average_vclk0_frequency;
|
||||
}
|
||||
if (clk_type == CLOCK_TYPE_VCLK1) {
|
||||
f->current = metric_info.current_vclk1;
|
||||
f->frequency[0] = metric_info.average_vclk1_frequency;
|
||||
}
|
||||
if (clk_type == CLOCK_TYPE_DCLK0) {
|
||||
f->current = metric_info.current_dclk0;
|
||||
f->frequency[0] = metric_info.average_dclk0_frequency;
|
||||
}
|
||||
if (clk_type == CLOCK_TYPE_DCLK1) {
|
||||
f->current = metric_info.current_dclk1;
|
||||
f->frequency[0] = metric_info.average_dclk1_frequency;
|
||||
}
|
||||
|
||||
return r_status;
|
||||
}
|
||||
|
||||
return rsmi_wrapper(rsmi_dev_gpu_clk_freq_get, device_handle,
|
||||
static_cast<rsmi_clk_type_t>(clk_type),
|
||||
reinterpret_cast<rsmi_frequencies_t*>(f));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_gpu_clk_freq_set(amdsmi_device_handle device_handle,
|
||||
amdsmi_clk_type_t clk_type, uint64_t freq_bitmask) {
|
||||
// Not support the clock type read from gpu_metrics
|
||||
if (clk_type == CLOCK_TYPE_VCLK0 ||
|
||||
clk_type == CLOCK_TYPE_VCLK1 ||
|
||||
clk_type == CLOCK_TYPE_DCLK0 ||
|
||||
clk_type == CLOCK_TYPE_DCLK1 ) {
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return rsmi_wrapper(rsmi_dev_gpu_clk_freq_set, device_handle,
|
||||
static_cast<rsmi_clk_type_t>(clk_type), freq_bitmask);
|
||||
}
|
||||
amdsmi_status_t
|
||||
amdsmi_dev_memory_reserved_pages_get(amdsmi_device_handle device_handle,
|
||||
uint32_t *num_pages,
|
||||
amdsmi_retired_page_record_t *records) {
|
||||
return rsmi_wrapper(rsmi_dev_memory_reserved_pages_get, device_handle,
|
||||
num_pages,
|
||||
reinterpret_cast<rsmi_retired_page_record_t*>(records));
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_memory_total_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_memory_type_t mem_type, uint64_t *total) {
|
||||
return rsmi_wrapper(rsmi_dev_memory_total_get, device_handle,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), total);
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_memory_usage_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_memory_type_t mem_type, uint64_t *used) {
|
||||
return rsmi_wrapper(rsmi_dev_memory_usage_get, device_handle,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), used);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_overdrive_level_get(
|
||||
amdsmi_device_handle device_handle,
|
||||
uint32_t *od) {
|
||||
return rsmi_wrapper(rsmi_dev_overdrive_level_get, device_handle, od);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_overdrive_level_set(
|
||||
amdsmi_device_handle device_handle, uint32_t od) {
|
||||
return rsmi_wrapper(rsmi_dev_overdrive_level_set, device_handle, od);
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_pci_replay_counter_get(
|
||||
amdsmi_device_handle device_handle, uint64_t *counter) {
|
||||
return rsmi_wrapper(rsmi_dev_pci_replay_counter_get,
|
||||
device_handle, counter);
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_pci_throughput_get(
|
||||
amdsmi_device_handle device_handle,
|
||||
uint64_t *sent, uint64_t *received, uint64_t *max_pkt_sz) {
|
||||
return rsmi_wrapper(rsmi_dev_pci_throughput_get, device_handle,
|
||||
sent, received, max_pkt_sz);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_od_volt_info_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_od_volt_freq_data_t *odv) {
|
||||
return rsmi_wrapper(rsmi_dev_od_volt_info_get, device_handle,
|
||||
reinterpret_cast<rsmi_od_volt_freq_data_t*>(odv));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_od_volt_curve_regions_get(
|
||||
amdsmi_device_handle device_handle,
|
||||
uint32_t *num_regions, amdsmi_freq_volt_region_t *buffer) {
|
||||
return rsmi_wrapper(rsmi_dev_od_volt_curve_regions_get, device_handle,
|
||||
num_regions, reinterpret_cast<rsmi_freq_volt_region_t* >(buffer));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_volt_metric_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_voltage_type_t sensor_type,
|
||||
amdsmi_voltage_metric_t metric, int64_t *voltage) {
|
||||
return rsmi_wrapper(rsmi_dev_volt_metric_get, device_handle,
|
||||
static_cast<rsmi_voltage_type_t>(sensor_type),
|
||||
static_cast<rsmi_voltage_metric_t>(metric), voltage);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_od_clk_info_set(amdsmi_device_handle device_handle,
|
||||
amdsmi_freq_ind_t level,
|
||||
uint64_t clkvalue,
|
||||
amdsmi_clk_type_t clkType) {
|
||||
return rsmi_wrapper(rsmi_dev_od_clk_info_set, device_handle,
|
||||
static_cast<rsmi_freq_ind_t>(level), clkvalue,
|
||||
static_cast<rsmi_clk_type_t>(clkType));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_od_volt_info_set(amdsmi_device_handle device_handle,
|
||||
uint32_t vpoint, uint64_t clkvalue, uint64_t voltvalue) {
|
||||
return rsmi_wrapper(rsmi_dev_od_volt_info_set, device_handle,
|
||||
vpoint, clkvalue, voltvalue);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_clk_range_set(amdsmi_device_handle device_handle,
|
||||
uint64_t minclkvalue,
|
||||
uint64_t maxclkvalue,
|
||||
amdsmi_clk_type_t clkType) {
|
||||
return rsmi_wrapper(rsmi_dev_clk_range_set, device_handle,
|
||||
minclkvalue, maxclkvalue,
|
||||
static_cast<rsmi_clk_type_t>(clkType));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_overdrive_level_set_v1(
|
||||
amdsmi_device_handle device_handle,
|
||||
uint32_t od) {
|
||||
return rsmi_wrapper(rsmi_dev_overdrive_level_set_v1, device_handle,
|
||||
od);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_gpu_reset(amdsmi_device_handle device_handle) {
|
||||
return rsmi_wrapper(rsmi_dev_gpu_reset, device_handle);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_utilization_count_get(amdsmi_device_handle device_handle,
|
||||
amdsmi_utilization_counter_t utilization_counters[],
|
||||
uint32_t count,
|
||||
uint64_t *timestamp) {
|
||||
return rsmi_wrapper(rsmi_utilization_count_get, device_handle,
|
||||
reinterpret_cast<rsmi_utilization_counter_t*>(utilization_counters),
|
||||
count, timestamp);
|
||||
}
|
||||
amdsmi_status_t amdsmi_dev_memory_busy_percent_get(
|
||||
amdsmi_device_handle device_handle,
|
||||
uint32_t *busy_percent) {
|
||||
return rsmi_wrapper(rsmi_dev_memory_busy_percent_get, device_handle,
|
||||
busy_percent);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_energy_count_get(amdsmi_device_handle device_handle,
|
||||
uint64_t *power, float *counter_resolution, uint64_t *timestamp) {
|
||||
return rsmi_wrapper(rsmi_dev_energy_count_get, device_handle,
|
||||
power, counter_resolution, timestamp);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_drm_render_minor_get(
|
||||
amdsmi_device_handle device_handle, uint32_t *minor) {
|
||||
return rsmi_wrapper(rsmi_dev_drm_render_minor_get, device_handle,
|
||||
minor);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_dev_pci_id_get(
|
||||
amdsmi_device_handle device_handle, uint64_t *bdfid) {
|
||||
return rsmi_wrapper(rsmi_dev_pci_id_get, device_handle,
|
||||
bdfid);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_topo_numa_affinity_get(
|
||||
amdsmi_device_handle device_handle, uint32_t *numa_node) {
|
||||
return rsmi_wrapper(rsmi_topo_numa_affinity_get, device_handle,
|
||||
numa_node);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_version_get(amdsmi_version_t *version) {
|
||||
if (version == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
auto rstatus = rsmi_version_get(
|
||||
reinterpret_cast<rsmi_version_t*>(version));
|
||||
return rsmi_to_amdsmi_status(rstatus);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_version_str_get(amdsmi_sw_component_t component,
|
||||
char *ver_str,
|
||||
uint32_t len) {
|
||||
if (ver_str == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
auto status = rsmi_version_str_get(
|
||||
static_cast<rsmi_sw_component_t>(component), ver_str, len);
|
||||
return rsmi_to_amdsmi_status(status);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,10 +50,12 @@
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
#define AMD_SMI_INIT_FLAG_RESRV_TEST1 0x800000000000000 //!< Reserved for test
|
||||
|
||||
amdsmi_status_t AMDSmiSystem::init(uint64_t flags) {
|
||||
init_flag_ = flags;
|
||||
// populate sockets and devices
|
||||
if (flags & AMD_SMI_INIT_AMD_GPUS) {
|
||||
if (flags & AMDSMI_INIT_AMD_GPUS) {
|
||||
drm_.init();
|
||||
// init rsmi
|
||||
rsmi_status_t ret = rsmi_init(flags);
|
||||
@@ -114,7 +116,7 @@ amdsmi_status_t AMDSmiSystem::cleanup() {
|
||||
}
|
||||
devices_.clear();
|
||||
sockets_.clear();
|
||||
init_flag_ = AMD_SMI_INIT_ALL_DEVICES;
|
||||
init_flag_ = AMDSMI_INIT_ALL_DEVICES;
|
||||
rsmi_status_t ret = rsmi_shut_down();
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return static_cast<amdsmi_status_t>(ret);
|
||||
|
||||
@@ -334,7 +334,7 @@ typedef struct {
|
||||
* Clock types
|
||||
*/
|
||||
typedef enum {
|
||||
RSMI_CLK_TYPE_SYS = 0x0, //!< System clock
|
||||
RSMI_CLK_TYPE_SYS = 0x0, //!< System clock
|
||||
RSMI_CLK_TYPE_FIRST = RSMI_CLK_TYPE_SYS,
|
||||
RSMI_CLK_TYPE_DF, //!< Data Fabric clock (for ASICs
|
||||
//!< running on a separate clock)
|
||||
@@ -1064,7 +1064,7 @@ rsmi_status_t rsmi_dev_id_get(uint32_t dv_ind, uint16_t *id);
|
||||
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
|
||||
*
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_sku_get(uint32_t dv_ind, char *sku);
|
||||
rsmi_status_t rsmi_dev_sku_get(uint32_t dv_ind, uint16_t *sku);
|
||||
|
||||
/**
|
||||
* @brief Get the device vendor id associated with the device with provided
|
||||
|
||||
Исполняемый файл
+174
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/err_cnt_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestErrCntRead::TestErrCntRead() : TestBase() {
|
||||
set_title("AMDSMI Error Count Read Test");
|
||||
set_description("The Error Count Read tests verifies that error counts"
|
||||
" can be read properly.");
|
||||
}
|
||||
|
||||
TestErrCntRead::~TestErrCntRead(void) {
|
||||
}
|
||||
|
||||
void TestErrCntRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestErrCntRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestErrCntRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestErrCntRead::Close() {
|
||||
// This will close handles opened within amdsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestErrCntRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_error_count_t ec;
|
||||
uint64_t enabled_mask;
|
||||
amdsmi_ras_err_state_t err_state;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_ecc_enabled_get(device_handles_[i], &enabled_mask);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**Error Count Enabled Mask get is not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_ecc_enabled_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_ecc_enabled_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Block Error Mask: 0x" << std::hex << enabled_mask <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
for (uint32_t b = AMDSMI_GPU_BLOCK_FIRST;
|
||||
b <= AMDSMI_GPU_BLOCK_LAST; b = b*2) {
|
||||
err = amdsmi_dev_ecc_status_get(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
&err_state);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count status for " <<
|
||||
GetBlockNameStr(static_cast<amdsmi_gpu_block_t>(b)) <<
|
||||
" block: " << GetErrStateNameStr(err_state) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_ecc_status_get(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
err = amdsmi_dev_ecc_count_get(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b), &ec);
|
||||
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count for " <<
|
||||
GetBlockNameStr(static_cast<amdsmi_gpu_block_t>(b)) <<
|
||||
": Not supported for this device" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_ecc_count_get(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error counts for " <<
|
||||
GetBlockNameStr(static_cast<amdsmi_gpu_block_t>(b)) << " block: "
|
||||
<< std::endl;
|
||||
std::cout << "\t\tCorrectable errors: " << ec.correctable_err
|
||||
<< std::endl;
|
||||
std::cout << "\t\tUncorrectable errors: " << ec.uncorrectable_err
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_ecc_count_get(device_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestErrCntRead : public TestBase {
|
||||
public:
|
||||
TestErrCntRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestErrCntRead
|
||||
virtual ~TestErrCntRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
|
||||
Исполняемый файл
+167
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/frequencies_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestFrequenciesRead::TestFrequenciesRead() : TestBase() {
|
||||
set_title("AMDSMI Frequencies Read Test");
|
||||
set_description("The Frequency Read tests verifies that the "
|
||||
"available and current frequency levels can be read properly.");
|
||||
}
|
||||
|
||||
TestFrequenciesRead::~TestFrequenciesRead(void) {
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
static void print_frequencies(amdsmi_frequencies_t *f, uint32_t *l = nullptr) {
|
||||
assert(f != nullptr);
|
||||
for (uint32_t j = 0; j < f->num_supported; ++j) {
|
||||
std::cout << "\t** " << j << ": " << f->frequency[j];
|
||||
if (l != nullptr) {
|
||||
std::cout << "T/s; x" << l[j];
|
||||
} else {
|
||||
std::cout << "Hz";
|
||||
}
|
||||
|
||||
if (j == f->current) {
|
||||
std::cout << " *";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_frequencies_t f;
|
||||
amdsmi_pcie_bandwidth_t b;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
auto freq_output = [&](amdsmi_clk_type_t t, const char *name) {
|
||||
err = amdsmi_dev_gpu_clk_freq_get(device_handles_[i], t, &f);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get " << name <<
|
||||
": Not supported on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_gpu_clk_freq_get(device_handles_[i], t, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported " << name << " clock frequencies: ";
|
||||
std::cout << f.num_supported << std::endl;
|
||||
print_frequencies(&f);
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_gpu_clk_freq_get(device_handles_[i], t, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
freq_output(CLOCK_TYPE_MEM, "Supported GPU Memory");
|
||||
freq_output(CLOCK_TYPE_SYS, "Supported GPU");
|
||||
freq_output(CLOCK_TYPE_DF, "Data Fabric Clock");
|
||||
freq_output(CLOCK_TYPE_DCEF, "Display Controller Engine Clock");
|
||||
freq_output(CLOCK_TYPE_SOC, "SOC Clock");
|
||||
|
||||
err = amdsmi_dev_pci_bandwidth_get(device_handles_[i], &b);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_pci_bandwidth_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported PCIe bandwidths: ";
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_pci_bandwidth_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestFrequenciesRead : public TestBase {
|
||||
public:
|
||||
TestFrequenciesRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestFrequenciesRead
|
||||
virtual ~TestFrequenciesRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_H_
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/frequencies_read_write.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestFrequenciesReadWrite::TestFrequenciesReadWrite() : TestBase() {
|
||||
set_title("AMDSMI Frequencies Read/Write Test");
|
||||
set_description("The Frequencies tests verify that the frequency "
|
||||
"settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestFrequenciesReadWrite::~TestFrequenciesReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestFrequenciesReadWrite::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
amdsmi_frequencies_t f;
|
||||
uint32_t freq_bitmask;
|
||||
amdsmi_clk_type amdsmi_clk;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
|
||||
for (uint32_t clk = (uint32_t)CLOCK_TYPE_FIRST;
|
||||
clk <= CLOCK_TYPE__MAX; ++clk) {
|
||||
amdsmi_clk = (amdsmi_clk_type)clk;
|
||||
|
||||
auto freq_read = [&]() -> bool {
|
||||
// Skip CLOCK_TYPE_PCIE, which does not supported in rocm-smi.
|
||||
std::cout << amdsmi_clk << std::endl;
|
||||
if (amdsmi_clk == CLOCK_TYPE_PCIE)
|
||||
return true;
|
||||
ret = amdsmi_dev_gpu_clk_freq_get(device_handles_[dv_ind], amdsmi_clk, &f);
|
||||
std::cout << ret << std::endl;
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Set " << FreqEnumToStr(amdsmi_clk) <<
|
||||
": Not supported on this machine" << std::endl;
|
||||
return false;
|
||||
} else {
|
||||
// CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Initial frequency for clock " <<
|
||||
FreqEnumToStr(amdsmi_clk) << " is " << f.current << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
auto freq_write = [&]() {
|
||||
// Set clocks to something other than the usual default of the lowest
|
||||
// frequency.
|
||||
// Skip CLOCK_TYPE_PCIE, which does not supported in rocm-smi.
|
||||
if (amdsmi_clk == CLOCK_TYPE_PCIE)
|
||||
return;
|
||||
|
||||
freq_bitmask = 0b01100; // Try the 3rd and 4th clocks
|
||||
|
||||
std::string freq_bm_str =
|
||||
std::bitset<AMDSMI_MAX_NUM_FREQUENCIES>(freq_bitmask).to_string();
|
||||
|
||||
freq_bm_str.erase(0, std::min(freq_bm_str.find_first_not_of('0'),
|
||||
freq_bm_str.size()-1));
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Setting frequency mask for " <<
|
||||
FreqEnumToStr(amdsmi_clk) << " to 0b" << freq_bm_str << " ..." <<
|
||||
std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_gpu_clk_freq_set(device_handles_[dv_ind], amdsmi_clk, freq_bitmask);
|
||||
//Certain ASICs does not allow to set particular clocks. If set function for a clock returns
|
||||
//permission error despite root access, manually set ret value to success and return
|
||||
if (ret == AMDSMI_STATUS_NO_PERM && geteuid() == 0) {
|
||||
std::cout << "\t**Set " << FreqEnumToStr(amdsmi_clk) <<
|
||||
": Not supported on this machine. Skipping..." << std::endl;
|
||||
ret = AMDSMI_STATUS_SUCCESS;
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_gpu_clk_freq_get(device_handles_[dv_ind], amdsmi_clk, &f);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Frequency is now index " << f.current << std::endl;
|
||||
std::cout << "Resetting mask to all frequencies." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_gpu_clk_freq_set(device_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_perf_level_set(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if (freq_read()) {
|
||||
CHK_ERR_ASRT(ret)
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
freq_write();
|
||||
CHK_ERR_ASRT(ret)
|
||||
#if 0
|
||||
ret = amdsmi_dev_gpu_clk_freq_get(dv_ind, amdsmi_clk, &f);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Initial frequency for clock " << amdsmi_clk << " is " <<
|
||||
f.current << std::endl;
|
||||
}
|
||||
// Set clocks to something other than the usual default of the lowest
|
||||
// frequency.
|
||||
freq_bitmask = 0b01100; // Try the 3rd and 4th clocks
|
||||
|
||||
std::string freq_bm_str =
|
||||
std::bitset<AMDSMI_MAX_NUM_FREQUENCIES>(freq_bitmask).to_string();
|
||||
|
||||
freq_bm_str.erase(0, std::min(freq_bm_str.find_first_not_of('0'),
|
||||
freq_bm_str.size()-1));
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Setting frequency mask for clock " << amdsmi_clk <<
|
||||
" to 0b" << freq_bm_str << " ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_gpu_clk_freq_set(dv_ind, amdsmi_clk, freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_gpu_clk_freq_get(dv_ind, amdsmi_clk, &f);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Frequency is now index " << f.current << std::endl;
|
||||
std::cout << "Resetting mask to all frequencies." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_gpu_clk_freq_set(dv_ind, amdsmi_clk, 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_perf_level_set(dv_ind, AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_WRITE_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_WRITE_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestFrequenciesReadWrite : public TestBase {
|
||||
public:
|
||||
TestFrequenciesReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestFrequenciesReadWrite
|
||||
virtual ~TestFrequenciesReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_WRITE_H_
|
||||
Исполняемый файл
+120
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/gpu_busy_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestGPUBusyRead::TestGPUBusyRead() : TestBase() {
|
||||
set_title("AMDSMI GPU Busy Read Test");
|
||||
set_description("The GPU Busy Read tests verifies that the gpu busy "
|
||||
"percentage can be read properly.");
|
||||
}
|
||||
|
||||
TestGPUBusyRead::~TestGPUBusyRead(void) {
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::Close() {
|
||||
// This will close handles opened within amdsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestGPUBusyRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
uint32_t val_ui32;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_busy_percent_get(device_handles_[i], &val_ui32);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent (Percent Idle):" << std::dec <<
|
||||
val_ui32 << " (" << 100 - val_ui32 << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_GPU_BUSY_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_GPU_BUSY_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestGPUBusyRead : public TestBase {
|
||||
public:
|
||||
TestGPUBusyRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestGPUBusyRead
|
||||
virtual ~TestGPUBusyRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_GPU_BUSY_READ_H_
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/gpu_metrics_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestGpuMetricsRead::TestGpuMetricsRead() : TestBase() {
|
||||
set_title("AMDSMI GPU Metrics Read Test");
|
||||
set_description("The GPU Metrics tests verifies that "
|
||||
"the gpu metrics info can be read properly.");
|
||||
}
|
||||
|
||||
TestGpuMetricsRead::~TestGpuMetricsRead(void) {
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::Close() {
|
||||
// This will close handles opened within amdsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestGpuMetricsRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS:\n";
|
||||
}
|
||||
amdsmi_gpu_metrics_t smu;
|
||||
err = amdsmi_dev_gpu_metrics_info_get(device_handles_[i], &smu);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::dec << "system_clock_counter="
|
||||
<< smu.system_clock_counter << '\n';
|
||||
std::cout << std::dec << "temperature_edge="
|
||||
<< smu.temperature_edge << '\n';
|
||||
std::cout << std::dec << "temperature_hotspot="
|
||||
<< smu.temperature_hotspot << '\n';
|
||||
std::cout << std::dec << "temperature_mem="
|
||||
<< smu.temperature_mem << '\n';
|
||||
std::cout << std::dec << "temperature_vrgfx="
|
||||
<< smu.temperature_vrgfx << '\n';
|
||||
std::cout << std::dec << "temperature_vrsoc="
|
||||
<< smu.temperature_vrsoc << '\n';
|
||||
std::cout << std::dec << "temperature_vrmem="
|
||||
<< smu.temperature_vrmem << '\n';
|
||||
std::cout << std::dec << "average_gfx_activity="
|
||||
<< smu.average_gfx_activity << '\n';
|
||||
std::cout << std::dec << "average_umc_activity="
|
||||
<< smu.average_umc_activity << '\n';
|
||||
std::cout << std::dec << "average_mm_activity="
|
||||
<< smu.average_mm_activity << '\n';
|
||||
std::cout << std::dec << "average_socket_power="
|
||||
<< smu.average_socket_power << '\n';
|
||||
std::cout << std::dec << "energy_accumulator="
|
||||
<< smu.energy_accumulator << '\n';
|
||||
std::cout << std::dec << "average_gfxclk_frequency="
|
||||
<< smu.average_gfxclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_gfxclk_frequency="
|
||||
<< smu.average_gfxclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_uclk_frequency="
|
||||
<< smu.average_uclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_vclk0_frequency="
|
||||
<< smu.average_vclk0_frequency << '\n';
|
||||
std::cout << std::dec << "average_dclk0_frequency="
|
||||
<< smu.average_dclk0_frequency << '\n';
|
||||
std::cout << std::dec << "average_vclk1_frequency="
|
||||
<< smu.average_vclk1_frequency << '\n';
|
||||
std::cout << std::dec << "average_dclk1_frequency="
|
||||
<< smu.average_dclk1_frequency << '\n';
|
||||
std::cout << std::dec << "current_gfxclk="
|
||||
<< smu.current_gfxclk << '\n';
|
||||
std::cout << std::dec << "current_socclk="
|
||||
<< smu.current_socclk << '\n';
|
||||
std::cout << std::dec << "current_uclk="
|
||||
<< smu.current_uclk << '\n';
|
||||
std::cout << std::dec << "current_vclk0="
|
||||
<< smu.current_vclk0 << '\n';
|
||||
std::cout << std::dec << "current_dclk0="
|
||||
<< smu.current_dclk0 << '\n';
|
||||
std::cout << std::dec << "current_vclk1="
|
||||
<< smu.current_vclk1 << '\n';
|
||||
std::cout << std::dec << "current_dclk1="
|
||||
<< smu.current_dclk1 << '\n';
|
||||
std::cout << std::dec << "throttle_status="
|
||||
<< smu.throttle_status << '\n';
|
||||
std::cout << std::dec << "current_fan_speed="
|
||||
<< smu.current_fan_speed << '\n';
|
||||
std::cout << "pcie_link_width="
|
||||
<< std::to_string(smu.pcie_link_width) << '\n';
|
||||
std::cout << "pcie_link_width="
|
||||
<< std::to_string(smu.pcie_link_speed) << '\n';
|
||||
std::cout << "gfx_activity_acc="
|
||||
<< std::dec << smu.gfx_activity_acc << '\n';
|
||||
std::cout << "mem_actvity_acc="
|
||||
<< std::dec << smu.mem_actvity_acc << '\n';
|
||||
|
||||
for (int i = 0; i < AMDSMI_NUM_HBM_INSTANCES; ++i) {
|
||||
std::cout << "temperature_hbm[" << i << "]=" << std::dec <<
|
||||
smu.temperature_hbm[i] << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_gpu_metrics_info_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_GPU_METRICS_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_GPU_METRICS_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestGpuMetricsRead : public TestBase {
|
||||
public:
|
||||
TestGpuMetricsRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestGpuMetricsRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_GPU_METRICS_READ_H_
|
||||
Исполняемый файл
+255
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/id_info_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestIdInfoRead::TestIdInfoRead() : TestBase() {
|
||||
set_title("AMDSMI ID Info Read Test");
|
||||
set_description("This test verifies that ID information such as the "
|
||||
"device, subsystem and vendor IDs can be read properly.");
|
||||
}
|
||||
|
||||
TestIdInfoRead::~TestIdInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestIdInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestIdInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestIdInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestIdInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const uint32_t kBufferLen = 80;
|
||||
|
||||
void TestIdInfoRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
uint16_t id;
|
||||
uint64_t val_ui64;
|
||||
uint32_t drm_render_minor;
|
||||
|
||||
char buffer[kBufferLen];
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t*************************" << std::endl;
|
||||
std::cout << "\t**Device index: " << i << std::endl;
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the device
|
||||
err = amdsmi_dev_id_get(device_handles_[i], &id);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
amdsmi_status_t ret;
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
// vendor_id, unique_id
|
||||
amdsmi_asic_info_t asci_info;
|
||||
err = amdsmi_get_asic_info(device_handles_[0], &asci_info);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// device name, brand, serial_number
|
||||
amdsmi_board_info_t board_info;
|
||||
err = amdsmi_get_board_info(device_handles_[0], &board_info);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
err = amdsmi_dev_vram_vendor_get(device_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Vram Vendor string not supported on this system." << std::endl;
|
||||
err = amdsmi_dev_vram_vendor_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Vram Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_dev_drm_render_minor_get(device_handles_[i], &drm_render_minor);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_drm_render_minor_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**DRM Render Minor: " << drm_render_minor << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_drm_render_minor_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_dev_vendor_name_get(device_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Device Vendor name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_vendor_name_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_vendor_name_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the sub-device
|
||||
err = amdsmi_dev_subsystem_id_get(device_handles_[i], &id);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_subsystem_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_subsystem_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_dev_subsystem_name_get(device_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Subsystem name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_subsystem_name_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_subsystem_name_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_dev_subsystem_vendor_id_get(device_handles_[i], &id);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_subsystem_vendor_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Sub-system Vendor ID: 0x" << std::hex <<
|
||||
id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_subsystem_vendor_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_dev_vendor_name_get(device_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Subsystem Vendor name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_vendor_name_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_vendor_name_get(device_handles_[i], nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
err = amdsmi_dev_pci_id_get(device_handles_[i], &val_ui64);
|
||||
// Don't check for AMDSMI_STATUS_NOT_SUPPORTED since this should always be
|
||||
// supported. It is not based on a sysfs file.
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_pci_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_ID_INFO_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_ID_INFO_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestIdInfoRead : public TestBase {
|
||||
public:
|
||||
TestIdInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestIdInfoRead
|
||||
virtual ~TestIdInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_ID_INFO_READ_H_
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <thread> // NOLINT
|
||||
#include <random>
|
||||
#include <chrono> // NOLINT
|
||||
|
||||
#include "amd_smi_test/functional/init_shutdown_refcount.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
extern int32_t
|
||||
rsmi_test_refcount(uint64_t refcnt_type);
|
||||
|
||||
static void rand_sleep_mod(int msec) {
|
||||
assert(msec > 10);
|
||||
unsigned int seed = time(NULL);
|
||||
std::mt19937_64 eng{seed};
|
||||
std::uniform_int_distribution<> dist{10, msec};
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{dist(eng)});
|
||||
}
|
||||
|
||||
static void* AMDSMIInitFunction(void* args) {
|
||||
amdsmi_status_t status;
|
||||
|
||||
(void)args;
|
||||
rand_sleep_mod(100);
|
||||
status = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
EXPECT_EQ(AMDSMI_STATUS_SUCCESS, status);
|
||||
pthread_exit(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void* AMDSMIShutDownFunction(void* args) {
|
||||
amdsmi_status_t status;
|
||||
|
||||
(void)args;
|
||||
rand_sleep_mod(100);
|
||||
status = amdsmi_shut_down();
|
||||
EXPECT_EQ(AMDSMI_STATUS_SUCCESS, status);
|
||||
pthread_exit(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void *AMDSMIInitShutDownFunction(void* args) {
|
||||
amdsmi_status_t status;
|
||||
|
||||
(void)args;
|
||||
rand_sleep_mod(100);
|
||||
status = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
EXPECT_EQ(AMDSMI_STATUS_SUCCESS, status);
|
||||
|
||||
rand_sleep_mod(100);
|
||||
|
||||
status = amdsmi_shut_down();
|
||||
EXPECT_EQ(AMDSMI_STATUS_SUCCESS, status);
|
||||
pthread_exit(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const int NumOfThreads = 100;
|
||||
|
||||
TestConcurrentInit::TestConcurrentInit(void) : TestBase() {
|
||||
set_title("AMDSMI Concurrent Init Test");
|
||||
set_description("This test initializes AMDSMI concurrently to verify "
|
||||
"reference counting functionality.");
|
||||
}
|
||||
|
||||
TestConcurrentInit::~TestConcurrentInit(void) {
|
||||
}
|
||||
|
||||
void TestConcurrentInit::SetUp(void) {
|
||||
// TestBase::SetUp(); // Skip usual SetUp to avoid doing the usual amdsmi_init
|
||||
return;
|
||||
}
|
||||
|
||||
// Compare required profile for this test case with what we're actually
|
||||
// running on
|
||||
void TestConcurrentInit::DisplayTestInfo(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestConcurrentInit::DisplayResults(void) const {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayResults();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestConcurrentInit::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
// Compare required profile for this test case with what we're actually
|
||||
// running on
|
||||
void TestConcurrentInit::Run(void) {
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_t ThreadId[NumOfThreads];
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Testing concurrent amdsmi_init()..." << std::endl;
|
||||
}
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus = pthread_create(&ThreadId[Id], &attr,
|
||||
AMDSMIInitFunction, nullptr);
|
||||
ASSERT_EQ(0, ThreadStatus) << "pthead_create failed.";
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int err = pthread_join(ThreadId[Id], nullptr);
|
||||
ASSERT_EQ(0, err) << "pthread_join failed.";
|
||||
}
|
||||
|
||||
// Invoke hsa_shut_down and verify that all the hsa_init's were counted.
|
||||
// HSA should be exactly closed after NumOfThreads calls.
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
amdsmi_status_t err = amdsmi_shut_down();
|
||||
ASSERT_EQ(AMDSMI_STATUS_SUCCESS, err) << "An amdsmi_init was missed.";
|
||||
}
|
||||
|
||||
amdsmi_status_t err = amdsmi_shut_down();
|
||||
ASSERT_EQ(AMDSMI_STATUS_INIT_ERROR, err) <<
|
||||
"amdsmi_init reference count was too high.";
|
||||
|
||||
int32_t refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Concurrent amdsmi_init() test passed." <<
|
||||
std::endl << std::endl;
|
||||
std::cout << "Testing concurrent amdsmi_shut_down()..." << std::endl;
|
||||
}
|
||||
// Invoke hsa_shut_down and verify that all the hsa_init's were counted.
|
||||
// HSA should be exactly closed after NumOfThreads calls.
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
amdsmi_status_t err = amdsmi_init(AMDSMI_INIT_AMD_GPUS);
|
||||
ASSERT_EQ(AMDSMI_STATUS_SUCCESS, err);
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus =
|
||||
pthread_create(&ThreadId[Id], &attr, AMDSMIShutDownFunction, nullptr);
|
||||
ASSERT_EQ(0, ThreadStatus) << "pthead_create failed.";
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int err = pthread_join(ThreadId[Id], nullptr);
|
||||
ASSERT_EQ(0, err) << "pthread_join failed.";
|
||||
}
|
||||
|
||||
refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Concurrent amdsmi_shut_down() passed." << std::endl;
|
||||
std::cout <<
|
||||
"Testing concurrent amdsmi_init() followed by amdsmi_shut_down()..." <<
|
||||
std::endl;
|
||||
}
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus =
|
||||
pthread_create(&ThreadId[Id], &attr, AMDSMIInitShutDownFunction, nullptr);
|
||||
ASSERT_EQ(0, ThreadStatus) << "pthead_create failed.";
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int err = pthread_join(ThreadId[Id], nullptr);
|
||||
ASSERT_EQ(0, err) << "pthread_join failed.";
|
||||
}
|
||||
|
||||
refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"Concurrent amdsmi_init() followed by amdsmi_shut_down() passed." <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_INIT_SHUTDOWN_REFCOUNT_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_INIT_SHUTDOWN_REFCOUNT_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestConcurrentInit : public TestBase {
|
||||
public:
|
||||
TestConcurrentInit();
|
||||
|
||||
// @Brief: Destructor for the TestConcurrentInit class
|
||||
virtual ~TestConcurrentInit();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_INIT_SHUTDOWN_REFCOUNT_H_
|
||||
Исполняемый файл
+169
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/mem_page_info_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestMemPageInfoRead::TestMemPageInfoRead() : TestBase() {
|
||||
set_title("AMDSMI Memory Page Info Test");
|
||||
set_description("The Memory Page Info. test verifies that we can read "
|
||||
"memory page information, and then displays the information read");
|
||||
}
|
||||
|
||||
TestMemPageInfoRead::~TestMemPageInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_retired_page_record_t *records;
|
||||
uint32_t num_pages;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_memory_reserved_pages_get(device_handles_[i], &num_pages, nullptr);
|
||||
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Memory page information is not supported for this device"
|
||||
<< std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_memory_reserved_pages_get(device_handles_[i], nullptr, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tNumber of memory page records: " << num_pages <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_memory_reserved_pages_get(device_handles_[i], nullptr, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
if (num_pages > 0) {
|
||||
records = new amdsmi_retired_page_record_t[num_pages];
|
||||
|
||||
assert(records != nullptr);
|
||||
|
||||
err = amdsmi_dev_memory_reserved_pages_get(device_handles_[i], &num_pages, records);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Getting Memory Page Retirement Status not "
|
||||
"supported for this device" << std::endl;
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout.setf(std::ios::hex, std::ios::basefield);
|
||||
std::string page_state;
|
||||
|
||||
for (uint32_t p = 0; p < num_pages; ++p) {
|
||||
std::cout << "\t\tAddress: 0x" << records[p].page_address;
|
||||
std::cout << " Size: " << records[p].page_size;
|
||||
|
||||
switch (records[p].status) {
|
||||
case AMDSMI_MEM_PAGE_STATUS_RESERVED:
|
||||
page_state = "Retired";
|
||||
break;
|
||||
|
||||
case AMDSMI_MEM_PAGE_STATUS_PENDING:
|
||||
page_state = "Pending";
|
||||
break;
|
||||
|
||||
case AMDSMI_MEM_PAGE_STATUS_UNRESERVABLE:
|
||||
page_state = "Unreservable";
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT_EQ(0, 1) << "Unexpected memory page status";
|
||||
}
|
||||
std::cout << " Status: " << page_state << std::endl;
|
||||
}
|
||||
std::cout.setf(std::ios::dec, std::ios::basefield);
|
||||
}
|
||||
delete []records;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_MEM_PAGE_INFO_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_MEM_PAGE_INFO_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestMemPageInfoRead : public TestBase {
|
||||
public:
|
||||
TestMemPageInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestMemPageInfoRead
|
||||
virtual ~TestMemPageInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_MEM_PAGE_INFO_READ_H_
|
||||
Исполняемый файл
+158
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/mem_util_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestMemUtilRead::TestMemUtilRead() : TestBase() {
|
||||
set_title("Memory Utilization Read Test");
|
||||
set_description("The Memory Utilization Read tests verifies that "
|
||||
"memory busy percent, size and amount used can be read properly.");
|
||||
}
|
||||
|
||||
TestMemUtilRead::~TestMemUtilRead(void) {
|
||||
}
|
||||
|
||||
void TestMemUtilRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemUtilRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestMemUtilRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemUtilRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const std::map<amdsmi_memory_type_t, const char *>
|
||||
kDevMemoryTypeNameMap = {
|
||||
{AMDSMI_MEM_TYPE_VRAM, "VRAM memory"},
|
||||
{AMDSMI_MEM_TYPE_VIS_VRAM, "Visible VRAM memory"},
|
||||
{AMDSMI_MEM_TYPE_GTT, "GTT memory"},
|
||||
};
|
||||
|
||||
void TestMemUtilRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
uint64_t total;
|
||||
uint64_t usage;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
auto err_chk = [&](const char *str) {
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** " << str << ": Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
#if 0
|
||||
err = amdsmi_dev_memory_busy_percent_get(i, &mem_busy_percent);
|
||||
err_chk("amdsmi_dev_memory_busy_percent_get()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "GPU Memory Busy %: " << mem_busy_percent <<
|
||||
std::endl;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t mem_type = AMDSMI_MEM_TYPE_FIRST;
|
||||
mem_type <= AMDSMI_MEM_TYPE_LAST; ++mem_type) {
|
||||
err = amdsmi_dev_memory_total_get(device_handles_[i],
|
||||
static_cast<amdsmi_memory_type_t>(mem_type), &total);
|
||||
err_chk("amdsmi_dev_memory_total_get()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = amdsmi_dev_memory_usage_get(device_handles_[i],
|
||||
static_cast<amdsmi_memory_type_t>(mem_type), &usage);
|
||||
err_chk("amdsmi_dev_memory_usage_get()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
kDevMemoryTypeNameMap.at(static_cast<amdsmi_memory_type_t>(mem_type))
|
||||
<< " Calculated Utilization: " <<
|
||||
(static_cast<float>(usage)*100)/total << "% ("<< usage <<
|
||||
"/" << total << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestMemUtilRead : public TestBase {
|
||||
public:
|
||||
TestMemUtilRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestMemUtilRead
|
||||
virtual ~TestMemUtilRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/metrics_counter_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestMetricsCounterRead::TestMetricsCounterRead() : TestBase() {
|
||||
set_title("AMDSMI GPU Metrics Counter Read Test");
|
||||
set_description("The GPU Metrics Counter tests verifies that "
|
||||
"the gpu metrics counter info can be read properly.");
|
||||
}
|
||||
|
||||
TestMetricsCounterRead::~TestMetricsCounterRead(void) {
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestMetricsCounterRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS ENERGY COUNTER:\n";
|
||||
}
|
||||
|
||||
uint64_t power;
|
||||
uint64_t timestamp;
|
||||
float counter_resolution;
|
||||
err = amdsmi_dev_energy_count_get(device_handles_[i], &power, &counter_resolution, ×tamp);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::dec << "power counter="
|
||||
<< power << '\n';
|
||||
std::cout << "power in uJ="
|
||||
<< (double)(power * counter_resolution) << '\n';
|
||||
std::cout << std::dec << "timestamp="
|
||||
<< timestamp << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_energy_count_get(device_handles_[i], nullptr, nullptr, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
// Coarse Grain counters
|
||||
amdsmi_utilization_counter_t utilization_counters[2];
|
||||
utilization_counters[0].type = AMDSMI_COARSE_GRAIN_GFX_ACTIVITY;
|
||||
utilization_counters[1].type = AMDSMI_COARSE_GRAIN_MEM_ACTIVITY;
|
||||
err = amdsmi_utilization_count_get(device_handles_[i], utilization_counters,
|
||||
2, ×tamp);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::dec << "gfx_activity="
|
||||
<< utilization_counters[0].value << '\n';
|
||||
std::cout << std::dec << "mem_activity="
|
||||
<< utilization_counters[1].value << '\n';
|
||||
std::cout << std::dec << "timestamp="
|
||||
<< timestamp << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_utilization_count_get(device_handles_[i], nullptr,
|
||||
1 , nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
} // end for
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_METRICS_COUNTER_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_METRICS_COUNTER_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestMetricsCounterRead : public TestBase {
|
||||
public:
|
||||
TestMetricsCounterRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestMetricsCounterRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_METRICS_COUNTER_READ_H_
|
||||
Исполняемый файл
+321
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/mutual_exclusion.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
#define AMD_SMI_INIT_FLAG_RESRV_TEST1 0x800000000000000 //!< Reserved for test
|
||||
|
||||
TestMutualExclusion::TestMutualExclusion() : TestBase() {
|
||||
set_title("Mutual Exclusion Test");
|
||||
set_description("Verify that AMDSMI only allows 1 process at a time"
|
||||
" to access AMDSMI resources (primarily sysfs files). This test has one "
|
||||
"process that obtains the mutex that ensures only 1 process accesses a "
|
||||
"device's sysfs files at a time, and another process that attempts "
|
||||
"to access the device's sysfs files. The second process should fail "
|
||||
"in these attempts.");
|
||||
}
|
||||
|
||||
TestMutualExclusion::~TestMutualExclusion(void) {
|
||||
}
|
||||
|
||||
extern amdsmi_status_t rsmi_test_sleep(uint32_t dv_ind, uint32_t seconds);
|
||||
|
||||
void TestMutualExclusion::SetUp(void) {
|
||||
std::string label;
|
||||
amdsmi_status_t ret;
|
||||
|
||||
// TestBase::SetUp(AMD_SMI_INIT_FLAG_RESRV_TEST1);
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
|
||||
sleeper_process_ = false;
|
||||
child_ = 0;
|
||||
child_ = fork();
|
||||
|
||||
if (child_ != 0) {
|
||||
sleeper_process_ = true; // sleeper_process is parent
|
||||
|
||||
// AMD_SMI_INIT_FLAG_RESRV_TEST1 tells rsmi to fail immediately
|
||||
// if it can't get the mutex instead of waiting.
|
||||
ret = amdsmi_init(AMD_SMI_INIT_FLAG_RESRV_TEST1);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
|
||||
|
||||
sleep(2); // Let both processes get through amdsmi_init
|
||||
} else {
|
||||
sleep(1); // Let the sleeper process get through amdsmi_init() before
|
||||
// this one goes, so it doesn't fail.
|
||||
ret = amdsmi_init(AMD_SMI_INIT_FLAG_RESRV_TEST1);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
|
||||
|
||||
sleep(2); // Let both processes get through amdsmi_init;
|
||||
}
|
||||
|
||||
num_monitor_devs_ = num_monitor_devs();
|
||||
|
||||
if (num_monitor_devs_ == 0) {
|
||||
std::cout << "No monitor devices found on this machine." << std::endl;
|
||||
std::cout << "No ROCm SMI tests can be run." << std::endl;
|
||||
setup_failed_ = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMutualExclusion::DisplayTestInfo(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void TestMutualExclusion::DisplayResults(void) const {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayResults();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMutualExclusion::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
extern amdsmi_status_t
|
||||
rsmi_test_sleep(uint32_t dv_ind, uint32_t seconds);
|
||||
|
||||
void TestMutualExclusion::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sleeper_process_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "MUTEX_HOLDER process: started sleeping for 10 seconds..." <<
|
||||
std::endl;
|
||||
}
|
||||
ret = rsmi_test_sleep(0, 10);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "MUTEX_HOLDER process: Sleep process woke up." << std::endl;
|
||||
}
|
||||
pid_t cpid = wait(nullptr);
|
||||
ASSERT_EQ(cpid, child_);
|
||||
} else {
|
||||
// Both processes should have completed amdsmi_init().
|
||||
// let the other process get started on rsmi_test_sleep().
|
||||
sleep(2);
|
||||
TestBase::Run();
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "TESTER process: verifing that all amdsmi_dev_* functions "
|
||||
"return AMDSMI_STATUS_BUSY because MUTEX_HOLDER process "
|
||||
"holds the mutex" << std::endl;
|
||||
}
|
||||
// Try all the device related rsmi calls. They should all fail with
|
||||
// AMDSMI_STATUS_BUSY
|
||||
// Set dummy values should to working, deterministic values.
|
||||
uint16_t dmy_ui16 = 0;
|
||||
uint32_t dmy_ui32 = 1;
|
||||
uint32_t dmy_i32 = 0;
|
||||
uint64_t dmy_ui64 = 0;
|
||||
int64_t dmy_i64 = 0;
|
||||
char dmy_str[10];
|
||||
amdsmi_dev_perf_level_t dmy_perf_lvl;
|
||||
amdsmi_frequencies_t dmy_freqs;
|
||||
amdsmi_od_volt_freq_data_t dmy_od_volt;
|
||||
amdsmi_freq_volt_region_t dmy_vlt_reg;
|
||||
amdsmi_error_count_t dmy_err_cnt;
|
||||
amdsmi_ras_err_state_t dmy_ras_err_st;
|
||||
|
||||
// This can be replaced with ASSERT_EQ() once env. stabilizes
|
||||
#define CHECK_RET(A, B) { \
|
||||
if ((A) != (B)) { \
|
||||
std::cout << "Expected return value of " << B << \
|
||||
" but got " << A << std::endl; \
|
||||
std::cout << "at " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
} \
|
||||
}
|
||||
ret = amdsmi_dev_id_get(device_handles_[0], &dmy_ui16);
|
||||
|
||||
// vendor_id, unique_id
|
||||
amdsmi_asic_info_t asci_info;
|
||||
ret = amdsmi_get_asic_info(device_handles_[0], &asci_info);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
|
||||
// device name, brand, serial_number
|
||||
amdsmi_board_info_t board_info;
|
||||
ret = amdsmi_get_board_info(device_handles_[0], &board_info);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
|
||||
ret = amdsmi_dev_vendor_name_get(device_handles_[0], dmy_str, 10);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_vram_vendor_get(device_handles_[0], dmy_str, 10);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_subsystem_id_get(device_handles_[0], &dmy_ui16);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_subsystem_vendor_id_get(device_handles_[0], &dmy_ui16);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_pci_id_get(device_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_pci_throughput_get(device_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_pci_replay_counter_get(device_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_pci_bandwidth_set(device_handles_[0], 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_fan_rpms_get(device_handles_[0], dmy_ui32, &dmy_i64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_fan_speed_get(device_handles_[0], 0, &dmy_i64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_fan_speed_max_get(device_handles_[0], 0, &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_temp_metric_get(device_handles_[0], dmy_ui32, AMDSMI_TEMP_CURRENT, &dmy_i64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_fan_reset(device_handles_[0], 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_fan_speed_set(device_handles_[0], dmy_ui32, 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[0], &dmy_perf_lvl);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_overdrive_level_get(device_handles_[0], &dmy_ui32);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_gpu_clk_freq_get(device_handles_[0], CLOCK_TYPE_SYS, &dmy_freqs);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_od_volt_info_get(device_handles_[0], &dmy_od_volt);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_od_volt_curve_regions_get(device_handles_[0], &dmy_ui32, &dmy_vlt_reg);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_overdrive_level_set_v1(device_handles_[0], dmy_i32);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_gpu_clk_freq_set(device_handles_[0], CLOCK_TYPE_SYS, 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_ecc_count_get(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_ecc_enabled_get(device_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_dev_ecc_status_get(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
|
||||
/* Other functions holding device mutexes. Listed for reference.
|
||||
amdsmi_dev_sku_get
|
||||
amdsmi_dev_perf_level_set_v1
|
||||
amdsmi_dev_od_clk_info_set
|
||||
amdsmi_dev_od_volt_info_set
|
||||
amdsmi_dev_firmware_version_get
|
||||
amdsmi_dev_firmware_version_get
|
||||
amdsmi_dev_name_get
|
||||
amdsmi_dev_brand_get
|
||||
amdsmi_dev_vram_vendor_get
|
||||
amdsmi_dev_subsystem_name_get
|
||||
amdsmi_dev_drm_render_minor_get
|
||||
amdsmi_dev_vendor_name_get
|
||||
amdsmi_dev_pci_bandwidth_get
|
||||
amdsmi_dev_pci_bandwidth_set
|
||||
amdsmi_dev_pci_throughput_get
|
||||
amdsmi_dev_temp_metric_get
|
||||
amdsmi_dev_volt_metric_get
|
||||
amdsmi_dev_fan_speed_get
|
||||
amdsmi_dev_fan_rpms_get
|
||||
amdsmi_dev_fan_reset
|
||||
amdsmi_dev_fan_speed_set
|
||||
amdsmi_dev_fan_speed_max_get
|
||||
amdsmi_dev_od_volt_info_get
|
||||
amdsmi_dev_gpu_metrics_info_get
|
||||
amdsmi_dev_od_volt_curve_regions_get
|
||||
amdsmi_dev_power_max_get
|
||||
amdsmi_dev_power_ave_get
|
||||
amdsmi_dev_power_cap_get
|
||||
amdsmi_dev_power_cap_range_get
|
||||
amdsmi_dev_power_cap_set
|
||||
amdsmi_dev_power_profile_presets_get
|
||||
amdsmi_dev_power_profile_set
|
||||
amdsmi_dev_memory_total_get
|
||||
amdsmi_dev_memory_usage_get
|
||||
amdsmi_dev_memory_busy_percent_get
|
||||
amdsmi_dev_busy_percent_get
|
||||
amdsmi_dev_vbios_version_get
|
||||
amdsmi_dev_serial_number_get
|
||||
amdsmi_dev_pci_replay_counter_get
|
||||
amdsmi_dev_unique_id_get
|
||||
amdsmi_dev_counter_create
|
||||
amdsmi_counter_available_counters_get
|
||||
amdsmi_dev_counter_group_supported
|
||||
amdsmi_dev_memory_reserved_pages_get
|
||||
amdsmi_dev_xgmi_error_status
|
||||
amdsmi_dev_xgmi_error_reset
|
||||
amdsmi_dev_xgmi_hive_id_get
|
||||
amdsmi_topo_get_link_weight
|
||||
amdsmi_event_notification_mask_set
|
||||
amdsmi_event_notification_init
|
||||
amdsmi_event_notification_stop
|
||||
*/
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "TESTER process: Finished verifying that all "
|
||||
"amdsmi_dev_* functions returned AMDSMI_STATUS_BUSY" << std::endl;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+77
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_MUTUAL_EXCLUSION_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_MUTUAL_EXCLUSION_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestMutualExclusion : public TestBase {
|
||||
public:
|
||||
TestMutualExclusion();
|
||||
|
||||
// @Brief: Destructor for test case of TestMutualExclusion
|
||||
virtual ~TestMutualExclusion();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
|
||||
private:
|
||||
bool sleeper_process_;
|
||||
int child_;
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_MUTUAL_EXCLUSION_H_
|
||||
Исполняемый файл
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/overdrive_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestOverdriveRead::TestOverdriveRead() : TestBase() {
|
||||
set_title("AMDSMI Overdrive Read Test");
|
||||
set_description("The Overdrive Read tests verifies that the "
|
||||
"current overdrive level can be read properly.");
|
||||
}
|
||||
|
||||
TestOverdriveRead::~TestOverdriveRead(void) {
|
||||
}
|
||||
|
||||
void TestOverdriveRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestOverdriveRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestOverdriveRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
uint32_t val_ui32;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_overdrive_level_get(device_handles_[i], &val_ui32);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**OverDrive Level:" << val_ui32 << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_overdrive_level_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestOverdriveRead : public TestBase {
|
||||
public:
|
||||
TestOverdriveRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestOverdriveRead
|
||||
virtual ~TestOverdriveRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_H_
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/overdrive_read_write.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestOverdriveReadWrite::TestOverdriveReadWrite() : TestBase() {
|
||||
set_title("AMDSMI Overdrive Read/Write Test");
|
||||
set_description("The Fan Read tests verifies that the overdrive settings "
|
||||
"can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestOverdriveReadWrite::~TestOverdriveReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestOverdriveReadWrite::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t val;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Overdrive level to 0%..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_overdrive_level_set(device_handles_[dv_ind], 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Overdrive level to 10%..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_overdrive_level_set(device_handles_[dv_ind], 10);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_overdrive_level_get(device_handles_[dv_ind], &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New OverDrive Level:" << val << std::endl;
|
||||
std::cout << "Reset Overdrive level to 0%..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_overdrive_level_set(device_handles_[dv_ind], 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_overdrive_level_get(device_handles_[dv_ind], &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New OverDrive Level:" << val << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_WRITE_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_WRITE_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestOverdriveReadWrite : public TestBase {
|
||||
public:
|
||||
TestOverdriveReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestOverdriveReadWrite
|
||||
virtual ~TestOverdriveReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_WRITE_H_
|
||||
Исполняемый файл
+199
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/pci_read_write.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestPciReadWrite::TestPciReadWrite() : TestBase() {
|
||||
set_title("AMDSMI PCIe Bandwidth Read/Write Test");
|
||||
set_description("The PCIe Bandwidth tests verify that the PCIe bandwidth "
|
||||
"settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestPciReadWrite::~TestPciReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPciReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPciReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPciReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPciReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPciReadWrite::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
amdsmi_pcie_bandwidth_t bw;
|
||||
uint32_t freq_bitmask;
|
||||
uint64_t sent, received, max_pkt_sz, u64int;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_pci_replay_counter_get(device_handles_[dv_ind], &u64int);
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**amdsmi_dev_pci_replay_counter_get() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_pci_replay_counter_get(device_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tPCIe Replay Counter: " << u64int << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_pci_replay_counter_get(device_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_pci_throughput_get(device_handles_[dv_ind], &sent, &received, &max_pkt_sz);
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "TEST FAILURE: Current PCIe throughput is not detected. "
|
||||
"This is likely because it is not indicated in the pcie_bw sysfs "
|
||||
"file. Aborting test." << std::endl;
|
||||
|
||||
// We don't need to verify api support checking functionality is working
|
||||
// as the user may choose to have any of the input parameters as 0.
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tPCIe Throughput (1 sec.): " << std::endl;
|
||||
std::cout << "\t\tSent: " << sent << " bytes" << std::endl;
|
||||
std::cout << "\t\tReceived: " << received << " bytes" << std::endl;
|
||||
std::cout << "\t\tMax Packet Size: " << max_pkt_sz << " bytes" <<
|
||||
std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_pci_bandwidth_get(device_handles_[dv_ind], &bw);
|
||||
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "TEST FAILURE: Current PCIe bandwidth is not detected. "
|
||||
"This is likely because it is not indicated in the pp_dpm_pcie sysfs "
|
||||
"file. Aborting test." << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_pci_bandwidth_get(device_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tInitial PCIe BW index is " << bw.transfer_rate.current <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_pci_bandwidth_get(device_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
|
||||
// First set the bitmask to all supported bandwidths
|
||||
freq_bitmask = ~(~0u << bw.transfer_rate.num_supported);
|
||||
|
||||
// Then, set the bitmask to all bandwidths besides the initial BW
|
||||
freq_bitmask ^= (1 << bw.transfer_rate.current);
|
||||
|
||||
std::string freq_bm_str =
|
||||
std::bitset<AMDSMI_MAX_NUM_FREQUENCIES>(freq_bitmask).to_string();
|
||||
|
||||
freq_bm_str.erase(0, std::min(freq_bm_str.find_first_not_of('0'),
|
||||
freq_bm_str.size()-1));
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tSetting bandwidth mask to " << "0b" << freq_bm_str <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_pci_bandwidth_set(device_handles_[dv_ind], freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_pci_bandwidth_get(device_handles_[dv_ind], &bw);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tBandwidth is now index " << bw.transfer_rate.current <<
|
||||
std::endl;
|
||||
std::cout << "\tResetting mask to all bandwidths." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_pci_bandwidth_set(device_handles_[dv_ind], 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_perf_level_set(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_PCI_READ_WRITE_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_PCI_READ_WRITE_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPciReadWrite : public TestBase {
|
||||
public:
|
||||
TestPciReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPciReadWrite
|
||||
virtual ~TestPciReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_PCI_READ_WRITE_H_
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/perf_determinism.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestPerfDeterminism::TestPerfDeterminism() : TestBase() {
|
||||
set_title("AMDSMI Performance Determinism Test");
|
||||
set_description("The Performance Determinism tests verifies "
|
||||
"Enabling/Disabling performance determinism mode.");
|
||||
}
|
||||
|
||||
TestPerfDeterminism::~TestPerfDeterminism(void) {
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPerfDeterminism::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_dev_perf_level_t pfl;
|
||||
amdsmi_od_volt_freq_data_t odv;
|
||||
amdsmi_status_t ret;
|
||||
uint64_t clkvalue;
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
err = amdsmi_dev_od_volt_info_get(device_handles_[i], &odv);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else{
|
||||
clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50;
|
||||
}
|
||||
|
||||
err = amdsmi_perf_determinism_mode_set(device_handles_[i], clkvalue);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
std::cout << "\t**SCLK is now set to " << clkvalue << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "\t**Resetting performance determinism" << std::endl;
|
||||
err = amdsmi_dev_perf_level_set(device_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);;
|
||||
CHK_ERR_ASRT(err)
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_DETERMINISM_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_DETERMINISM_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPerfDeterminism : public TestBase {
|
||||
public:
|
||||
TestPerfDeterminism();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestPerfDeterminism();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_DETERMINISM_H_
|
||||
Исполняемый файл
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/perf_level_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestPerfLevelRead::TestPerfLevelRead() : TestBase() {
|
||||
set_title("AMDSMI Performance Level Read Test");
|
||||
set_description("The Performance Level Read tests verifies that the "
|
||||
"performance level monitors can be read properly.");
|
||||
}
|
||||
|
||||
TestPerfLevelRead::~TestPerfLevelRead(void) {
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPerfLevelRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_dev_perf_level_t pfl;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_perf_level_get(device_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Performance Level:" << std::dec << (uint32_t)pfl <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_perf_level_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPerfLevelRead : public TestBase {
|
||||
public:
|
||||
TestPerfLevelRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestPerfLevelRead
|
||||
virtual ~TestPerfLevelRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_H_
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/perf_level_read_write.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestPerfLevelReadWrite::TestPerfLevelReadWrite() : TestBase() {
|
||||
set_title("AMDSMI Performance Level Read/Write Test");
|
||||
set_description("The Performance Level tests verify that the performance "
|
||||
"level settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestPerfLevelReadWrite::~TestPerfLevelReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPerfLevelReadWrite::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
amdsmi_dev_perf_level_t pfl, orig_pfl;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[dv_ind], &orig_pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Original Perf Level:" <<
|
||||
GetPerfLevelStr(orig_pfl) << std::endl;
|
||||
}
|
||||
|
||||
uint32_t pfl_i = static_cast<uint32_t>(AMDSMI_DEV_PERF_LEVEL_FIRST);
|
||||
for (; pfl_i <= static_cast<uint32_t>(AMDSMI_DEV_PERF_LEVEL_LAST); pfl_i++) {
|
||||
if (pfl_i == static_cast<uint32_t>(orig_pfl)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Performance Level to " <<
|
||||
GetPerfLevelStr(static_cast<amdsmi_dev_perf_level_t>(pfl_i)) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_perf_level_set(device_handles_[dv_ind],
|
||||
static_cast<amdsmi_dev_perf_level_t>(pfl_i));
|
||||
if (ret == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**" << GetPerfLevelStr(static_cast<amdsmi_dev_perf_level_t>(pfl_i))
|
||||
<< " returned AMDSMI_STATUS_NOT_SUPPORTED" << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Reset Perf level to " << GetPerfLevelStr(orig_pfl) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_dev_perf_level_set(device_handles_[dv_ind], orig_pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_WRITE_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_WRITE_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPerfLevelReadWrite : public TestBase {
|
||||
public:
|
||||
TestPerfLevelReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPerfLevelReadWrite
|
||||
virtual ~TestPerfLevelReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_WRITE_H_
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/power_cap_read_write.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestPowerCapReadWrite::TestPowerCapReadWrite() : TestBase() {
|
||||
set_title("AMDSMI Power Cap Read/Write Test");
|
||||
set_description("The Power Cap tests verify that the power profile "
|
||||
"settings can be read and written properly.");
|
||||
}
|
||||
|
||||
TestPowerCapReadWrite::~TestPowerCapReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::Close() {
|
||||
// This will close handles opened within amdsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
uint64_t orig, min, max, new_cap;
|
||||
clock_t start, end;
|
||||
double cpu_time_used;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
|
||||
amdsmi_power_cap_info_t info;
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
|
||||
CHK_ERR_ASRT(ret)
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
min = info.min_power_cap;
|
||||
max = info.max_power_cap;
|
||||
orig = info.default_power_cap;
|
||||
|
||||
new_cap = (max + min)/2;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Original Power Cap: " << orig << " uW" << std::endl;
|
||||
std::cout << "Power Cap Range: " << max << " uW to " << min <<
|
||||
" uW" << std::endl;
|
||||
std::cout << "Setting new cap to " << new_cap << "..." << std::endl;
|
||||
}
|
||||
start = clock();
|
||||
ret = amdsmi_dev_power_cap_set(device_handles_[dv_ind], 0, new_cap);
|
||||
end = clock();
|
||||
cpu_time_used = ((double) (end - start)) * 1000000UL / CLOCKS_PER_SEC;
|
||||
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
|
||||
CHK_ERR_ASRT(ret)
|
||||
new_cap = info.default_power_cap;
|
||||
|
||||
// TODO(cfreehil) add some kind of assertion to verify new_cap is correct
|
||||
// (or within a range)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Time spent: " << cpu_time_used << " uS" << std::endl;
|
||||
std::cout << "New Power Cap: " << new_cap << " uW" << std::endl;
|
||||
std::cout << "Resetting cap to " << orig << "..." << std::endl;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_power_cap_set(device_handles_[dv_ind], 0, orig);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info);
|
||||
CHK_ERR_ASRT(ret)
|
||||
new_cap = info.default_power_cap;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Current Power Cap: " << new_cap << " uW" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_CAP_READ_WRITE_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_CAP_READ_WRITE_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPowerCapReadWrite : public TestBase {
|
||||
public:
|
||||
TestPowerCapReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPowerCapReadWrite
|
||||
virtual ~TestPowerCapReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_CAP_READ_WRITE_H_
|
||||
Исполняемый файл
+128
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/power_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestPowerRead::TestPowerRead() : TestBase() {
|
||||
set_title("AMDSMI Power Read Test");
|
||||
set_description("The Power Read tests verifies that "
|
||||
"power related values can be read properly.");
|
||||
}
|
||||
|
||||
TestPowerRead::~TestPowerRead(void) {
|
||||
}
|
||||
|
||||
void TestPowerRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPowerRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerRead::Close() {
|
||||
// This will close handles opened within amdsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPowerRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
uint64_t val_ui64, val2_ui64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
amdsmi_power_cap_info_t info;
|
||||
err = amdsmi_get_power_cap_info(device_handles_[i], 0, &info);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Power Cap: " << info.power_cap << "uW" <<std::endl;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Default Power Cap: " << info.default_power_cap << "uW" <<std::endl;
|
||||
std::cout << "\t**Power Cap Range: " << info.min_power_cap << " to " <<
|
||||
info.max_power_cap << " uW" << std::endl;
|
||||
}
|
||||
|
||||
err = amdsmi_dev_power_ave_get(device_handles_[i], 0, &val_ui64);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Averge Power Usage: ";
|
||||
CHK_AMDSMI_PERM_ERR(err)
|
||||
if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_power_ave_get(device_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPowerRead : public TestBase {
|
||||
public:
|
||||
TestPowerRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestPowerRead
|
||||
virtual ~TestPowerRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_READ_H_
|
||||
Исполняемый файл
+195
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/power_read_write.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestPowerReadWrite::TestPowerReadWrite() : TestBase() {
|
||||
set_title("AMDSMI Power Profiles Read/Write Test");
|
||||
set_description("The Power Profiles tests verify that the power profile "
|
||||
"settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestPowerReadWrite::~TestPowerReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::Close() {
|
||||
// This will close handles opened within amdsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const char *
|
||||
power_profile_string(amdsmi_power_profile_preset_masks_t profile) {
|
||||
switch (profile) {
|
||||
case AMDSMI_PWR_PROF_PRST_CUSTOM_MASK:
|
||||
return "CUSTOM";
|
||||
case AMDSMI_PWR_PROF_PRST_VIDEO_MASK:
|
||||
return "VIDEO";
|
||||
case AMDSMI_PWR_PROF_PRST_POWER_SAVING_MASK:
|
||||
return "POWER SAVING";
|
||||
case AMDSMI_PWR_PROF_PRST_COMPUTE_MASK:
|
||||
return "COMPUTE";
|
||||
case AMDSMI_PWR_PROF_PRST_VR_MASK:
|
||||
return "VR";
|
||||
case AMDSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK:
|
||||
return "3D FULL SCREEN";
|
||||
case AMDSMI_PWR_PROF_PRST_BOOTUP_DEFAULT:
|
||||
return "BOOTUP DEFAULT";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::Run(void) {
|
||||
amdsmi_status_t ret;
|
||||
amdsmi_power_profile_status_t status;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(device_handles_[dv_ind]);
|
||||
|
||||
ret = amdsmi_dev_power_profile_presets_get(device_handles_[dv_ind], 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
ret = amdsmi_dev_power_profile_presets_get(device_handles_[dv_ind], 0, nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "The available power profiles are:" << std::endl;
|
||||
uint64_t tmp = 1;
|
||||
while (tmp <= AMDSMI_PWR_PROF_PRST_LAST) {
|
||||
if ((tmp & status.available_profiles) == tmp) {
|
||||
std::cout << "\t" <<
|
||||
power_profile_string((amdsmi_power_profile_preset_masks_t)tmp) <<
|
||||
std::endl;
|
||||
}
|
||||
tmp = tmp << 1;
|
||||
}
|
||||
std::cout << "The current power profile is: " <<
|
||||
power_profile_string(status.current) << std::endl;
|
||||
}
|
||||
|
||||
amdsmi_power_profile_preset_masks_t orig_profile = status.current;
|
||||
|
||||
// Try setting the profile to a different power profile
|
||||
amdsmi_bit_field_t diff_profiles;
|
||||
amdsmi_power_profile_preset_masks_t new_prof;
|
||||
diff_profiles = status.available_profiles & (~status.current);
|
||||
|
||||
if (diff_profiles & AMDSMI_PWR_PROF_PRST_COMPUTE_MASK) {
|
||||
new_prof = AMDSMI_PWR_PROF_PRST_COMPUTE_MASK;
|
||||
} else if (diff_profiles & AMDSMI_PWR_PROF_PRST_VIDEO_MASK) {
|
||||
new_prof = AMDSMI_PWR_PROF_PRST_VIDEO_MASK;
|
||||
} else if (diff_profiles & AMDSMI_PWR_PROF_PRST_VR_MASK) {
|
||||
new_prof = AMDSMI_PWR_PROF_PRST_VR_MASK;
|
||||
} else if (diff_profiles & AMDSMI_PWR_PROF_PRST_POWER_SAVING_MASK) {
|
||||
new_prof = AMDSMI_PWR_PROF_PRST_POWER_SAVING_MASK;
|
||||
} else if (diff_profiles & AMDSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK) {
|
||||
new_prof = AMDSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK;
|
||||
} else {
|
||||
std::cout <<
|
||||
"No other non-custom power profiles to set to. Exiting." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ret = amdsmi_dev_power_profile_set(device_handles_[dv_ind], 0, new_prof);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
amdsmi_dev_perf_level_t pfl;
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_MANUAL);
|
||||
|
||||
ret = amdsmi_dev_power_profile_presets_get(device_handles_[dv_ind], 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ASSERT_EQ(status.current, new_prof);
|
||||
|
||||
ret = amdsmi_dev_perf_level_set(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = amdsmi_dev_perf_level_get(device_handles_[dv_ind], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
|
||||
ret = amdsmi_dev_power_profile_presets_get(device_handles_[dv_ind], 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ASSERT_EQ(status.current, orig_profile);
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_READ_WRITE_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_READ_WRITE_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestPowerReadWrite : public TestBase {
|
||||
public:
|
||||
TestPowerReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPowerReadWrite
|
||||
virtual ~TestPowerReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_POWER_READ_WRITE_H_
|
||||
Исполняемый файл
+202
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/sys_info_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
#include "amd_smi_test/test_utils.h"
|
||||
|
||||
TestSysInfoRead::TestSysInfoRead() : TestBase() {
|
||||
set_title("AMDSMI System Info Read Test");
|
||||
set_description("This test verifies that system information such as the "
|
||||
"BDFID, AMDSMI version, VBIOS version, etc. can be read properly.");
|
||||
}
|
||||
|
||||
TestSysInfoRead::~TestSysInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestSysInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestSysInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestSysInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestSysInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestSysInfoRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
uint64_t val_ui64;
|
||||
uint32_t val_ui32;
|
||||
char buffer[80];
|
||||
amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
amdsmi_vbios_info_t info;
|
||||
err = amdsmi_get_vbios_info(device_handles_[i], &info);
|
||||
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**VBIOS read: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_vbios_info(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_vbios_info(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**VBIOS Version: " << std::hex << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_dev_pci_id_get(device_handles_[i], &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_pci_id_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
err = amdsmi_topo_numa_affinity_get(device_handles_[i], &val_ui32);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**NUMA NODE: 0x" << std::hex << val_ui32;
|
||||
std::cout << " (" << std::dec << val_ui32 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_topo_numa_affinity_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
|
||||
// vendor_id, unique_id
|
||||
amdsmi_asic_info_t asci_info;
|
||||
err = amdsmi_get_asic_info(device_handles_[0], &asci_info);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**amdsmi_dev_unique_id() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_asic_info(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
IF_VERB(STANDARD) {
|
||||
// TODO(bliu): read unique_id
|
||||
/*
|
||||
std::cout << "\t**GPU Unique ID : " << std::hex << asci_info.unique_id <<
|
||||
std::endl;
|
||||
*/
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_asic_info(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
} else {
|
||||
std::cout << "amdsmi_dev_unique_id_get() failed with error " <<
|
||||
err << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_version_get(&ver);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
ASSERT_TRUE(ver.major != 0xFFFFFFFF && ver.minor != 0xFFFFFFFF &&
|
||||
ver.patch != 0xFFFFFFFF && ver.build != nullptr);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**RocM SMI Library version: " << ver.major << "." <<
|
||||
ver.minor << "." << ver.patch << " (" << ver.build << ")" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::setbase(10);
|
||||
|
||||
amdsmi_fw_info_t fw_info;
|
||||
err = amdsmi_get_fw_info(device_handles_[i], &fw_info);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**No FW " <<
|
||||
" available on this system" << std::endl;
|
||||
err = amdsmi_get_fw_info(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_SYS_INFO_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_SYS_INFO_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestSysInfoRead : public TestBase {
|
||||
public:
|
||||
TestSysInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestSysInfoRead
|
||||
virtual ~TestSysInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_SYS_INFO_READ_H_
|
||||
Исполняемый файл
+171
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/temp_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
static const std::map<uint32_t, std::string> kTempSensorNameMap = {
|
||||
{TEMPERATURE_TYPE_VRAM, "Memory"},
|
||||
{TEMPERATURE_TYPE_JUNCTION, "Junction"},
|
||||
{TEMPERATURE_TYPE_EDGE, "Edge"},
|
||||
{TEMPERATURE_TYPE_HBM_0, "HBM_0"},
|
||||
{TEMPERATURE_TYPE_HBM_1, "HBM_1"},
|
||||
{TEMPERATURE_TYPE_HBM_2, "HBM_2"},
|
||||
{TEMPERATURE_TYPE_HBM_3, "HBM_3"},
|
||||
{TEMPERATURE_TYPE_PLX, "PLX"}
|
||||
};
|
||||
TestTempRead::TestTempRead() : TestBase() {
|
||||
set_title("AMDSMI Temp Read Test");
|
||||
set_description("The Temperature Read tests verifies that the temperature "
|
||||
"monitors can be read properly.");
|
||||
}
|
||||
|
||||
TestTempRead::~TestTempRead(void) {
|
||||
}
|
||||
|
||||
void TestTempRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestTempRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestTempRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestTempRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestTempRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
int64_t val_i64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t type;
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
auto print_temp_metric = [&](amdsmi_temperature_metric_t met,
|
||||
std::string label) {
|
||||
err = amdsmi_dev_temp_metric_get(device_handles_[i], type, met, &val_i64);
|
||||
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_temp_metric_get(device_handles_[i], type, met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
return;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_temp_metric_get(device_handles_[i], type, met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " << val_i64/1000 <<
|
||||
"C" << std::endl;
|
||||
}
|
||||
};
|
||||
for (type = TEMPERATURE_TYPE_FIRST; type <= TEMPERATURE_TYPE__MAX; ++type) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** **********" << kTempSensorNameMap.at(type) <<
|
||||
" Temperatures **********" << std::endl;
|
||||
}
|
||||
print_temp_metric(AMDSMI_TEMP_CURRENT, "Current Temp.");
|
||||
print_temp_metric(AMDSMI_TEMP_MAX, "Temperature max value");
|
||||
print_temp_metric(AMDSMI_TEMP_MIN, "Temperature min value");
|
||||
print_temp_metric(AMDSMI_TEMP_MAX_HYST,
|
||||
"Temperature hysteresis value for max limit");
|
||||
print_temp_metric(AMDSMI_TEMP_MIN_HYST,
|
||||
"Temperature hysteresis value for min limit");
|
||||
print_temp_metric(AMDSMI_TEMP_CRITICAL, "Temperature critical max value");
|
||||
print_temp_metric(AMDSMI_TEMP_CRITICAL_HYST,
|
||||
"Temperature hysteresis value for critical limit");
|
||||
print_temp_metric(AMDSMI_TEMP_EMERGENCY,
|
||||
"Temperature emergency max value");
|
||||
print_temp_metric(AMDSMI_TEMP_EMERGENCY_HYST,
|
||||
"Temperature hysteresis value for emergency limit");
|
||||
print_temp_metric(AMDSMI_TEMP_CRIT_MIN, "Temperature critical min value");
|
||||
print_temp_metric(AMDSMI_TEMP_CRIT_MIN_HYST,
|
||||
"Temperature hysteresis value for critical min value");
|
||||
print_temp_metric(AMDSMI_TEMP_OFFSET, "Temperature offset");
|
||||
print_temp_metric(AMDSMI_TEMP_LOWEST, "Historical minimum temperature");
|
||||
print_temp_metric(AMDSMI_TEMP_HIGHEST, "Historical maximum temperature");
|
||||
}
|
||||
}
|
||||
} // x
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestTempRead : public TestBase {
|
||||
public:
|
||||
TestTempRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestTempRead
|
||||
virtual ~TestTempRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
|
||||
Исполняемый файл
+126
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/version_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestVersionRead::TestVersionRead() : TestBase() {
|
||||
set_title("AMDSMI Version Read Test");
|
||||
set_description("The Version Read tests verifies that the AMDSMI library "
|
||||
"version can be read properly.");
|
||||
}
|
||||
|
||||
TestVersionRead::~TestVersionRead(void) {
|
||||
}
|
||||
|
||||
void TestVersionRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVersionRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestVersionRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVersionRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const uint32_t kVerMaxStrLen = 80;
|
||||
|
||||
static const std::map<uint32_t, const char *>
|
||||
kComponentNameMap = {
|
||||
{AMDSMI_SW_COMP_DRIVER, "Driver Version"},
|
||||
};
|
||||
|
||||
void TestVersionRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
err = amdsmi_version_get(&ver);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
ASSERT_TRUE(ver.major != 0xFFFFFFFF && ver.minor != 0xFFFFFFFF &&
|
||||
ver.patch != 0xFFFFFFFF && ver.build != nullptr);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**AMD SMI Library version: " << ver.major << "." <<
|
||||
ver.minor << "." << ver.patch << " (" << ver.build << ")" << std::endl;
|
||||
}
|
||||
|
||||
char ver_str[kVerMaxStrLen];
|
||||
|
||||
for (uint32_t cmp = AMDSMI_SW_COMP_FIRST; cmp <= AMDSMI_SW_COMP_LAST; ++cmp) {
|
||||
err = amdsmi_version_str_get(static_cast<amdsmi_sw_component_t>(cmp),
|
||||
ver_str, kVerMaxStrLen);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << kComponentNameMap.at(cmp) << ": " <<
|
||||
ver_str << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_VERSION_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_VERSION_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestVersionRead : public TestBase {
|
||||
public:
|
||||
TestVersionRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVersionRead
|
||||
virtual ~TestVersionRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_VERSION_READ_H_
|
||||
Исполняемый файл
+197
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/volt_freq_curv_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
TestVoltCurvRead::TestVoltCurvRead() : TestBase() {
|
||||
set_title("AMDSMI Voltage-Frequency Curve Read Test");
|
||||
set_description("The Voltage-Frequency Read tests verifies that the voltage"
|
||||
" frequency curve information can be read properly.");
|
||||
}
|
||||
|
||||
TestVoltCurvRead::~TestVoltCurvRead(void) {
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static void pt_rng_Mhz(std::string title, amdsmi_range *r) {
|
||||
assert(r != nullptr);
|
||||
|
||||
std::cout << title << std::endl;
|
||||
std::cout << "\t\t** " << r->lower_bound/1000000 << " to " <<
|
||||
r->upper_bound/1000000 << " MHz" << std::endl;
|
||||
}
|
||||
|
||||
static void pt_rng_mV(std::string title, amdsmi_range *r) {
|
||||
assert(r != nullptr);
|
||||
|
||||
std::cout << title << std::endl;
|
||||
std::cout << "\t\t** " << r->lower_bound << " to " << r->upper_bound <<
|
||||
" mV" << std::endl;
|
||||
}
|
||||
|
||||
static void print_pnt(amdsmi_od_vddc_point_t *pt) {
|
||||
std::cout << "\t\t** Frequency: " << pt->frequency/1000000 << "MHz" <<
|
||||
std::endl;
|
||||
std::cout << "\t\t** Voltage: " << pt->voltage << "mV" << std::endl;
|
||||
}
|
||||
static void pt_vddc_curve(amdsmi_od_volt_curve *c) {
|
||||
assert(c != nullptr);
|
||||
|
||||
for (uint32_t i = 0; i < AMDSMI_NUM_VOLTAGE_CURVE_POINTS; ++i) {
|
||||
print_pnt(&c->vc_points[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_amdsmi_od_volt_freq_data_t(amdsmi_od_volt_freq_data_t *odv) {
|
||||
assert(odv != nullptr);
|
||||
|
||||
std::cout.setf(std::ios::dec, std::ios::basefield);
|
||||
pt_rng_Mhz("\t\tCurrent SCLK frequency range:", &odv->curr_sclk_range);
|
||||
pt_rng_Mhz("\t\tCurrent MCLK frequency range:", &odv->curr_mclk_range);
|
||||
pt_rng_Mhz("\t\tMin/Max Possible SCLK frequency range:",
|
||||
&odv->sclk_freq_limits);
|
||||
pt_rng_Mhz("\t\tMin/Max Possible MCLK frequency range:",
|
||||
&odv->mclk_freq_limits);
|
||||
|
||||
std::cout << "\t\tCurrent Freq/Volt. curve:" << std::endl;
|
||||
pt_vddc_curve(&odv->curve);
|
||||
|
||||
std::cout << "\tNumber of Freq./Volt. regions: " <<
|
||||
odv->num_regions << std::endl;
|
||||
}
|
||||
|
||||
static void print_odv_region(amdsmi_freq_volt_region_t *region) {
|
||||
pt_rng_Mhz("\t\tFrequency range:", ®ion->freq_range);
|
||||
pt_rng_mV("\t\tVoltage range:", ®ion->volt_range);
|
||||
}
|
||||
|
||||
static void print_amdsmi_od_volt_freq_regions(uint32_t num_regions,
|
||||
amdsmi_freq_volt_region_t *regions) {
|
||||
for (uint32_t i = 0; i < num_regions; ++i) {
|
||||
std::cout << "\tRegion " << i << ":" << std::endl;
|
||||
print_odv_region(®ions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_od_volt_freq_data_t odv;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
err = amdsmi_dev_od_volt_info_get(device_handles_[i], &odv);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**amdsmi_dev_od_volt_info_get: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_od_volt_info_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_od_volt_info_get(device_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "\t**Frequency-voltage curve data:" << std::endl;
|
||||
print_amdsmi_od_volt_freq_data_t(&odv);
|
||||
|
||||
amdsmi_freq_volt_region_t *regions;
|
||||
uint32_t num_regions;
|
||||
regions = new amdsmi_freq_volt_region_t[odv.num_regions];
|
||||
ASSERT_TRUE(regions != nullptr);
|
||||
|
||||
num_regions = odv.num_regions;
|
||||
err = amdsmi_dev_od_volt_curve_regions_get(device_handles_[i], &num_regions, regions);
|
||||
CHK_ERR_ASRT(err)
|
||||
ASSERT_TRUE(num_regions == odv.num_regions);
|
||||
|
||||
std::cout << "\t**Frequency-voltage curve regions:" << std::endl;
|
||||
print_amdsmi_od_volt_freq_regions(num_regions, regions);
|
||||
|
||||
delete []regions;
|
||||
}
|
||||
}
|
||||
}
|
||||
Исполняемый файл
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_VOLT_FREQ_CURV_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_VOLT_FREQ_CURV_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestVoltCurvRead : public TestBase {
|
||||
public:
|
||||
TestVoltCurvRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVoltCurvRead
|
||||
virtual ~TestVoltCurvRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_VOLT_FREQ_CURV_READ_H_
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "amd_smi.h"
|
||||
#include "amd_smi_test/functional/volt_read.h"
|
||||
#include "amd_smi_test/test_common.h"
|
||||
|
||||
|
||||
TestVoltRead::TestVoltRead() : TestBase() {
|
||||
set_title("AMDSMI Volt Read Test");
|
||||
set_description("The Voltage Read tests verifies that the voltage "
|
||||
"monitors can be read properly.");
|
||||
}
|
||||
|
||||
TestVoltRead::~TestVoltRead(void) {
|
||||
}
|
||||
|
||||
void TestVoltRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestVoltRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// amdsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestVoltRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
int64_t val_i64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
amdsmi_voltage_type_t type = AMDSMI_VOLT_TYPE_VDDGFX;
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(device_handles_[i]);
|
||||
|
||||
auto print_volt_metric = [&](amdsmi_voltage_metric_t met,
|
||||
std::string label) {
|
||||
err = amdsmi_dev_volt_metric_get(device_handles_[i], type, met, &val_i64);
|
||||
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_volt_metric_get(device_handles_[i], type, met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_dev_volt_metric_get(device_handles_[i], type, met, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " << val_i64 <<
|
||||
"mV" << std::endl;
|
||||
}
|
||||
};
|
||||
for (uint32_t i = AMDSMI_VOLT_TYPE_FIRST; i <= AMDSMI_VOLT_TYPE_LAST; ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** **********" <<
|
||||
GetVoltSensorNameStr(static_cast<amdsmi_voltage_type_t>(i)) <<
|
||||
" Voltage **********" << std::endl;
|
||||
}
|
||||
print_volt_metric(AMDSMI_VOLT_CURRENT, "Current Voltage");
|
||||
print_volt_metric(AMDSMI_VOLT_MAX, "Voltage max value");
|
||||
print_volt_metric(AMDSMI_VOLT_MIN, "Voltage min value");
|
||||
print_volt_metric(AMDSMI_VOLT_MAX_CRIT,
|
||||
"Voltage critical max value");
|
||||
print_volt_metric(AMDSMI_VOLT_MIN_CRIT,
|
||||
"Voltage critical min value");
|
||||
print_volt_metric(AMDSMI_VOLT_AVERAGE, "Voltage critical max value");
|
||||
print_volt_metric(AMDSMI_VOLT_LOWEST, "Historical minimum temperature");
|
||||
print_volt_metric(AMDSMI_VOLT_HIGHEST, "Historical maximum temperature");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2022, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_AMD_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
|
||||
#define TESTS_AMD_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
|
||||
|
||||
#include "amd_smi_test/test_base.h"
|
||||
|
||||
class TestVoltRead : public TestBase {
|
||||
public:
|
||||
TestVoltRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestVoltRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_AMD_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
|
||||
@@ -61,33 +61,31 @@
|
||||
#include "functional/xgmi_read_write.h"
|
||||
#include "functional/api_support_read.h"
|
||||
#include "functional/process_info_read.h"
|
||||
/*
|
||||
#include "functional/gpu_busy_read.h"
|
||||
#include "amd_smi_test/functional/gpu_metrics_read.h"
|
||||
#include "functional/err_cnt_read.h"
|
||||
#include "functional/power_read.h"
|
||||
#include "functional/power_read_write.h"
|
||||
#include "functional/power_cap_read_write.h"
|
||||
#include "functional/mem_util_read.h"
|
||||
#include "functional/mem_page_info_read.h"
|
||||
#include "functional/frequencies_read.h"
|
||||
#include "functional/frequencies_read_write.h"
|
||||
#include "functional/overdrive_read.h"
|
||||
#include "functional/overdrive_read_write.h"
|
||||
#include "functional/temp_read.h"
|
||||
#include "functional/volt_read.h"
|
||||
#include "functional/volt_freq_curv_read.h"
|
||||
#include "functional/perf_level_read.h"
|
||||
#include "functional/overdrive_read.h"
|
||||
#include "functional/frequencies_read.h"
|
||||
#include "functional/sys_info_read.h"
|
||||
#include "functional/gpu_busy_read.h"
|
||||
#include "functional/power_read.h"
|
||||
#include "functional/overdrive_read_write.h"
|
||||
#include "functional/perf_level_read_write.h"
|
||||
#include "functional/frequencies_read_write.h"
|
||||
#include "functional/pci_read_write.h"
|
||||
#include "functional/power_read_write.h"
|
||||
#include "functional/power_cap_read_write.h"
|
||||
#include "functional/version_read.h"
|
||||
#include "functional/err_cnt_read.h"
|
||||
#include "functional/mem_util_read.h"
|
||||
#include "amd_smi_test/functional/perf_determinism.h"
|
||||
#include "functional/sys_info_read.h"
|
||||
#include "functional/id_info_read.h"
|
||||
#include "functional/mem_page_info_read.h"
|
||||
#include "amd_smi_test/functional/metrics_counter_read.h"
|
||||
#include "functional/version_read.h"
|
||||
#include "functional/mutual_exclusion.h"
|
||||
#include "functional/init_shutdown_refcount.h"
|
||||
#include "amd_smi_test/functional/gpu_metrics_read.h"
|
||||
#include "amd_smi_test/functional/metrics_counter_read.h"
|
||||
#include "amd_smi_test/functional/perf_determinism.h"
|
||||
*/
|
||||
|
||||
static AMDSMITstGlobals *sRSMIGlvalues = nullptr;
|
||||
|
||||
@@ -130,6 +128,7 @@ static void RunGenericTest(TestBase *test) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TEST ENTRY TEMPLATE:
|
||||
// TEST(rocrtst, Perf_<test name>) {
|
||||
// <Test Implementation class> <test_obj>;
|
||||
@@ -138,13 +137,10 @@ static void RunGenericTest(TestBase *test) {
|
||||
// // from the standard pattern implemented there.
|
||||
// RunGenericTest(&<test_obj>);
|
||||
// }
|
||||
|
||||
/*
|
||||
TEST(amdsmitstReadOnly, TestVersionRead) {
|
||||
TestVersionRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
*/
|
||||
TEST(amdsmitstReadOnly, FanRead) {
|
||||
TestFanRead tst;
|
||||
RunGenericTest(&tst);
|
||||
@@ -153,31 +149,6 @@ TEST(amdsmitstReadWrite, FanReadWrite) {
|
||||
TestFanReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadWrite, TestEvtNotifReadWrite) {
|
||||
TestEvtNotifReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadWrite, TestPerfCntrReadWrite) {
|
||||
TestPerfCntrReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadWrite, TestXGMIReadWrite) {
|
||||
TestXGMIReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestAPISupportRead) {
|
||||
TestAPISupportRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestHWTopologyRead) {
|
||||
TestHWTopologyRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestProcInfoRead) {
|
||||
TestProcInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
/*
|
||||
TEST(amdsmitstReadOnly, TempRead) {
|
||||
TestTempRead tst;
|
||||
RunGenericTest(&tst);
|
||||
@@ -250,6 +221,18 @@ TEST(amdsmitstReadOnly, TestIdInfoRead) {
|
||||
TestIdInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadWrite, TestPerfCntrReadWrite) {
|
||||
TestPerfCntrReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestProcInfoRead) {
|
||||
TestProcInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestHWTopologyRead) {
|
||||
TestHWTopologyRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestGpuMetricsRead) {
|
||||
TestGpuMetricsRead tst;
|
||||
RunGenericTest(&tst);
|
||||
@@ -262,11 +245,19 @@ TEST(amdsmitstReadWrite, TestPerfDeterminism) {
|
||||
TestPerfDeterminism tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadWrite, TestXGMIReadWrite) {
|
||||
TestXGMIReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(amdsmitstReadOnly, TestMemPageInfoRead) {
|
||||
TestMemPageInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
|
||||
TEST(amdsmitstReadOnly, TestAPISupportRead) {
|
||||
TestAPISupportRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
/*
|
||||
TEST(amdsmitstReadOnly, TestMutualExclusion) {
|
||||
TestMutualExclusion tst;
|
||||
SetFlags(&tst);
|
||||
@@ -275,7 +266,12 @@ TEST(amdsmitstReadOnly, TestMutualExclusion) {
|
||||
tst.Run();
|
||||
RunCustomTestEpilog(&tst);
|
||||
}
|
||||
|
||||
*/
|
||||
TEST(amdsmitstReadWrite, TestEvtNotifReadWrite) {
|
||||
TestEvtNotifReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
/*
|
||||
TEST(amdsmitstReadOnly, TestConcurrentInit) {
|
||||
TestConcurrentInit tst;
|
||||
SetFlags(&tst);
|
||||
@@ -286,6 +282,7 @@ TEST(amdsmitstReadOnly, TestConcurrentInit) {
|
||||
tst.DisplayResults();
|
||||
}
|
||||
*/
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void TestBase::MakeHeaderStr(const char *inStr,
|
||||
}
|
||||
|
||||
void TestBase::SetUp(void) {
|
||||
SetUp(AMD_SMI_INIT_AMD_GPUS);
|
||||
SetUp(AMDSMI_INIT_AMD_GPUS);
|
||||
}
|
||||
|
||||
void TestBase::SetUp(uint64_t init_flags) {
|
||||
|
||||
@@ -223,6 +223,11 @@ const char *FreqEnumToStr(amdsmi_clk_type amdsmi_clk) {
|
||||
case CLOCK_TYPE_DCEF: return "Display Controller Engine clock";
|
||||
case CLOCK_TYPE_SOC: return "SOC clock";
|
||||
case CLOCK_TYPE_MEM: return "Memory clock";
|
||||
case CLOCK_TYPE_PCIE: return "PCIE clock";
|
||||
case CLOCK_TYPE_VCLK0: return "VCLK0 clock";
|
||||
case CLOCK_TYPE_VCLK1: return "VCLK1 clock";
|
||||
case CLOCK_TYPE_DCLK0: return "DCLK0 clock";
|
||||
case CLOCK_TYPE_DCLK1: return "DCLK1 clock";
|
||||
default: return "Invalid Clock ID";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void DumpMonitorInfo(const TestBase *test);
|
||||
} \
|
||||
}
|
||||
#define CHK_AMDSMI_PERM_ERR(RET) { \
|
||||
if (RET == AMDSMI_STATUS_PERMISSION) { \
|
||||
if (RET == AMDSMI_STATUS_NO_PERM) { \
|
||||
std::cout << "This command requires root access." << std::endl; \
|
||||
} else { \
|
||||
DISPLAY_AMDSMI_ERR(RET) \
|
||||
|
||||
Ссылка в новой задаче
Block a user