Merge amd-dev into amd-master 20240926
Signed-off-by: Zhang Ava <niandong.zhang@amd.com> Change-Id: I8697f9b43e7da03b05f17efb6e6e26118fd2a139
Tento commit je obsažen v:
@@ -133,7 +133,6 @@ do_install_amdsmi_python_lib() {
|
||||
local PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES="$PIP_BREAK_SYSTEM_PACKAGES"
|
||||
export PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
|
||||
# Remove old python library
|
||||
local pip_list_output
|
||||
pip_list_output=$(python3 -m pip list --format=columns --disable-pip-version-check)
|
||||
@@ -149,27 +148,9 @@ do_install_amdsmi_python_lib() {
|
||||
return
|
||||
fi
|
||||
|
||||
# upgrade pip if it's an ancient version, typically should not execute
|
||||
# otherwise the amdsmi install will fail
|
||||
local pip_version
|
||||
pip_version=$(python3 -m pip --version | grep -Eo '^[^\ ]+ ([0-9]+)' | grep -Eo '[0-9]+$')
|
||||
if [[ "$pip_version" -lt 19 ]]; then
|
||||
echo "Detected ancient pip version ($pip_version)... Upgrading..."
|
||||
python3 -m pip install --upgrade pip --quiet --disable-pip-version-check
|
||||
fi
|
||||
unset pip_version
|
||||
|
||||
# Check PyYAML dependency, typically should not execute
|
||||
pyyaml_version=$(python3 -m pip show pyyaml | grep -Po '(?<=Version: )[0-9]')
|
||||
if [[ "$pyyaml_version" -lt 3 ]]; then
|
||||
echo "Detected ancient pyyaml version ($pyyaml_version)... Upgrading..."
|
||||
python3 -m pip install 'PyYAML>=5.1' --quiet --disable-pip-version-check --ignore-installed
|
||||
fi
|
||||
unset pyyaml_version
|
||||
|
||||
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
|
||||
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
|
||||
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check --no-build-isolation
|
||||
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check --no-build-isolation --no-index
|
||||
|
||||
export PIP_ROOT_USER_ACTION="$PREVIOUS_PIP_ROOT_USER_ACTION"
|
||||
export PIP_BREAK_SYSTEM_PACKAGES="$PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES"
|
||||
|
||||
+1
-21
@@ -148,29 +148,9 @@ do_install_amdsmi_python_lib() {
|
||||
return
|
||||
fi
|
||||
|
||||
# upgrade pip if it's an ancient version
|
||||
# otherwise amdsmi install will fail
|
||||
local pip_version
|
||||
pip_version=$(python3 -m pip --version | grep -Eo '^[^\ ]+ ([0-9]+)' | grep -Eo '[0-9]+$')
|
||||
if [[ "$pip_version" -lt 19 ]]; then
|
||||
echo "Detected ancient pip version ($pip_version)... Upgrading..."
|
||||
python3 -m pip install --upgrade pip --quiet --disable-pip-version-check
|
||||
fi
|
||||
unset pip_version
|
||||
|
||||
# Check PyYAML dependency, typically should not execute
|
||||
local pyyaml_version
|
||||
pyyaml_version=$(python3 -m pip show pyyaml | grep -Po '(?<=Version: )[0-9]')
|
||||
if [[ "$pyyaml_version" -lt 3 ]]; then
|
||||
echo "Detected ancient pyyaml version ($pyyaml_version)... Upgrading..."
|
||||
python3 -m pip install 'PyYAML>=5.1' --quiet --disable-pip-version-check --ignore-installed
|
||||
fi
|
||||
unset pyyaml_version
|
||||
|
||||
# install python library at @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi
|
||||
local python_lib_path=@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@
|
||||
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check --no-build-isolation
|
||||
|
||||
python3 -m pip install "$python_lib_path" --quiet --disable-pip-version-check --no-build-isolation --no-index
|
||||
export PIP_ROOT_USER_ACTION="$PREVIOUS_PIP_ROOT_USER_ACTION"
|
||||
export PIP_BREAK_SYSTEM_PACKAGES="$PREVIOUS_PIP_BREAK_SYSTEM_PACKAGES"
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class AMDSMICommands():
|
||||
|
||||
if len(self.device_handles) == 0:
|
||||
# No GPU's found post amdgpu driver initialization
|
||||
logging.error('Unable to detect any GPU devices, check amdgpu version and module status')
|
||||
logging.error('Unable to detect any GPU devices, check amdgpu version and module status (sudo modprobe amdgpu)')
|
||||
exit_flag = True
|
||||
|
||||
if self.helpers.is_amd_hsmp_initialized():
|
||||
@@ -73,7 +73,7 @@ class AMDSMICommands():
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_DRV):
|
||||
logging.info('Unable to get CPU devices, amd_hsmp driver not loaded')
|
||||
logging.info('Unable to detect any CPU devices, check amd_hsmp version and module status (sudo modprobe amd_hsmp)')
|
||||
else:
|
||||
raise e
|
||||
|
||||
@@ -83,13 +83,13 @@ class AMDSMICommands():
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
if e.err_code in (amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NOT_INIT,
|
||||
amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_DRV):
|
||||
logging.info('Unable to get CORE devices, amd_hsmp driver not loaded')
|
||||
logging.info('Unable to get CORE devices, amd_hsmp driver not loaded (sudo modprobe amd_hsmp)')
|
||||
else:
|
||||
raise e
|
||||
|
||||
if len(self.cpu_handles) == 0 and len(self.core_handles) == 0:
|
||||
# No CPU's found post amd_hsmp driver initialization
|
||||
logging.error('Unable to detect any CPU devices, check amd_hsmp version and module status')
|
||||
logging.error('Unable to detect any CPU devices, check amd_hsmp version and module status (sudo modprobe amd_hsmp)')
|
||||
exit_flag = True
|
||||
|
||||
if exit_flag:
|
||||
|
||||
@@ -6,20 +6,12 @@
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.5.0)
|
||||
|
||||
message("*******************************************************************")
|
||||
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
|
||||
message(" CMake AMD goamdsmi_shim Library ")
|
||||
message("*******************************************************************")
|
||||
|
||||
option(WITH_AMDSMI "Support unified cpu and gpu" ON)
|
||||
message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
|
||||
|
||||
set(AMDSMI_DIR "" CACHE PATH "path to amdsmi installation")
|
||||
|
||||
if(WITH_AMDSMI)
|
||||
add_definitions(-DAMDSMI_BUILD)
|
||||
add_definitions(-DENABLE_ESMI_LIB)
|
||||
#include(deps/SetupAmdsmi.cmake)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DEBUG_LEVEL)
|
||||
add_definitions(-DENABLE_DEBUG_LEVEL=${ENABLE_DEBUG_LEVEL})
|
||||
message("**** Enabling Debug Level=${ENABLE_DEBUG_LEVEL} ****")
|
||||
@@ -51,11 +43,6 @@ message("SOVERSION: ${SO_VERSION_STRING}")
|
||||
|
||||
project(${GOAMDSMI_SHIM_TARGET})
|
||||
|
||||
# Create a configure file to get version info from within library
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/${GOAMDSMI_SHIM_TARGET}Config.in"
|
||||
"${PROJECT_SOURCE_DIR}/include/${GOAMDSMI_SHIM_TARGET}Config.h")
|
||||
|
||||
if (NOT DEFINED CPACK_PACKAGE_VENDOR)
|
||||
set(CPACK_PACKAGE_VENDOR "AMD")
|
||||
endif()
|
||||
@@ -109,11 +96,9 @@ add_library(${GOAMDSMI_SHIM_TARGET} SHARED
|
||||
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} pthread rt m)
|
||||
|
||||
if(WITH_AMDSMI)
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} amd_smi)
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} -L${AMDSMI_DIR}/lib)
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} -L${AMDSMI_DIR}/lib64)
|
||||
endif()
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} amd_smi)
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} -L${AMDSMI_DIR}/lib)
|
||||
target_link_libraries(${GOAMDSMI_SHIM_TARGET} -L${AMDSMI_DIR}/lib64)
|
||||
|
||||
## Set the VERSION and SOVERSION values
|
||||
set_property(TARGET ${GOAMDSMI_SHIM_TARGET} PROPERTY
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (c) 2024, Advanced Micro Devices, Inc.
|
||||
|
||||
#ifndef INCLUDE_GOAMDSMI_SHIM64CONFIG_H_
|
||||
#define INCLUDE_GOAMDSMI_SHIM64CONFIG_H_
|
||||
|
||||
// This file is generated on build.
|
||||
|
||||
#define goamdsmi_shim_VERSION_MAJOR @goamdsmi_shim_VERSION_MAJOR@
|
||||
#define goamdsmi_shim_VERSION_MINOR @goamdsmi_shim_VERSION_MINOR@
|
||||
#define goamdsmi_shim_VERSION_PATCH @goamdsmi_shim_VERSION_PATCH@
|
||||
#define goamdsmi_shim_VERSION_BUILD "@goamdsmi_shim_VERSION_BUILD@"
|
||||
|
||||
#endif // INCLUDE_GOAMDSMI_SHIM_SMI64CONFIG_H_
|
||||
@@ -39,13 +39,10 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "amdsmi_go_shim.h"
|
||||
#ifdef AMDSMI_BUILD
|
||||
#include <amd_smi/amdsmi.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#define nullptr ((void*)0)
|
||||
|
||||
#ifdef AMDSMI_BUILD
|
||||
#define MAX_SOCKET_ACROSS_SYSTEM 4
|
||||
#define CPU_0 0
|
||||
#define GPU_SENSOR_0 0
|
||||
@@ -94,15 +91,6 @@ goamdsmi_status_t is_file_present(const char* driver_name, const char* file_name
|
||||
return GOAMDSMI_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
goamdsmi_status_t go_shim_amdsmi_present()
|
||||
{
|
||||
if((GOAMDSMI_STATUS_SUCCESS == is_file_present(AMDSMI_DRIVER_NAME, AMDSMI_LIB_FILE)) || (GOAMDSMI_STATUS_SUCCESS == is_file_present(AMDSMI_DRIVER_NAME, AMDSMI_LIB64_FILE)))
|
||||
{
|
||||
return GOAMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
return GOAMDSMI_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
goamdsmi_status_t check_amdgpu_driver()
|
||||
{
|
||||
return is_file_present(AMDGPU_DRIVER_NAME, AMDGPU_INITSTATE_FILE);
|
||||
@@ -143,13 +131,6 @@ goamdsmi_status_t go_shim_amdsmiapu_init(goamdsmi_Init_t goamdsmi_Init)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(GOAMDSMI_STATUS_FAILURE == go_shim_amdsmi_present())
|
||||
{
|
||||
if (enable_debug_level(GOAMDSMI_DEBUG_LEVEL_1)) {printf("AMDSMI, Failed, AMDSMI not present in the System, missing \"%s\" (or) \"%s\"\n", AMDSMI_LIB_FILE, AMDSMI_LIB64_FILE);}
|
||||
return GOAMDSMI_STATUS_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((GOAMDSMI_STATUS_SUCCESS == check_amdgpu_driver()) && (GOAMDSMI_STATUS_SUCCESS == check_hsmp_driver()))
|
||||
{
|
||||
@@ -693,42 +674,3 @@ uint64_t goamdsmi_gpu_dev_gpu_memory_total_get(uint32_t dv_ind)
|
||||
|
||||
return gpu_memory_total;
|
||||
}
|
||||
#else
|
||||
////////////////////////////////////////////////------------CPU------------////////////////////////////////////////////////
|
||||
bool goamdsmi_cpu_init() {return false;}
|
||||
uint32_t goamdsmi_cpu_threads_per_core_get() {return GOAMDSMI_VALUE_0;}
|
||||
uint32_t goamdsmi_cpu_number_of_threads_get() {return GOAMDSMI_VALUE_0;}
|
||||
uint32_t goamdsmi_cpu_number_of_sockets_get() {return GOAMDSMI_VALUE_0;}
|
||||
uint64_t goamdsmi_cpu_core_energy_get(uint32_t thread_index) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_cpu_socket_energy_get(uint32_t socket_index) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint32_t goamdsmi_cpu_prochot_status_get(uint32_t socket_index) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint32_t goamdsmi_cpu_socket_power_get(uint32_t socket_index) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint32_t goamdsmi_cpu_socket_power_cap_get(uint32_t socket_index) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint32_t goamdsmi_cpu_core_boostlimit_get(uint32_t thread_index) {return GOAMDSMI_UINT32_MAX;}
|
||||
|
||||
////////////////////////////////////////////////------------GPU------------////////////////////////////////////////////////
|
||||
bool goamdsmi_gpu_init() {return false;}
|
||||
bool goamdsmi_gpu_shutdown() {return false;}
|
||||
uint32_t goamdsmi_gpu_num_monitor_devices() {return GOAMDSMI_VALUE_0;}
|
||||
char* goamdsmi_gpu_dev_name_get(uint32_t dv_ind) {return NULL;}
|
||||
uint16_t goamdsmi_gpu_dev_id_get(uint32_t dv_ind) {return GOAMDSMI_UINT16_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_pci_id_get(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
char* goamdsmi_gpu_dev_vendor_name_get(uint32_t dv_ind) {return NULL;}
|
||||
char* goamdsmi_gpu_dev_vbios_version_get(uint32_t dv_ind) {return NULL;}
|
||||
uint64_t goamdsmi_gpu_dev_power_cap_get(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_power_get(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor, uint32_t metric) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint32_t goamdsmi_gpu_dev_overdrive_level_get(uint32_t dv_ind) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint32_t goamdsmi_gpu_dev_mem_overdrive_level_get(uint32_t dv_ind) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint32_t goamdsmi_gpu_dev_perf_level_get(uint32_t dv_ind) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_gpu_clk_freq_get_sclk(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_gpu_clk_freq_get_mclk(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_od_volt_freq_range_min_get_sclk(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_od_volt_freq_range_min_get_mclk(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_od_volt_freq_range_max_get_sclk(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_od_volt_freq_range_max_get_mclk(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint32_t goamdsmi_gpu_dev_gpu_busy_percent_get(uint32_t dv_ind) {return GOAMDSMI_UINT32_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_gpu_memory_busy_percent_get(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_gpu_memory_usage_get(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
uint64_t goamdsmi_gpu_dev_gpu_memory_total_get(uint32_t dv_ind) {return GOAMDSMI_UINT64_MAX;}
|
||||
#endif
|
||||
|
||||
@@ -625,15 +625,15 @@ typedef struct {
|
||||
* This union is used to identify various memory partitioning settings.
|
||||
*/
|
||||
typedef union {
|
||||
struct nps_flags_ {
|
||||
uint32_t nps1_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t nps2_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t nps4_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t nps8_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t reserved :28;
|
||||
} amdsmi_nps_flags_t;
|
||||
struct nps_flags_ {
|
||||
uint32_t nps1_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t nps2_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t nps4_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t nps8_cap :1; // bool 1 = true; 0 = false; Max uint32 means unsupported
|
||||
uint32_t reserved :28;
|
||||
} amdsmi_nps_flags_t;
|
||||
|
||||
uint32_t nps_cap_mask;
|
||||
uint32_t nps_cap_mask;
|
||||
} amdsmi_nps_caps_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -218,7 +218,7 @@ amdsmi_status_t smi_amdgpu_get_power_cap(amd::smi::AMDSmiGPUDevice* device, int
|
||||
if (!device->check_if_drm_is_supported()) {
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
constexpr int DATA_SIZE = 10;
|
||||
constexpr int DATA_SIZE = 16;
|
||||
char val[DATA_SIZE];
|
||||
std::string fullpath;
|
||||
amdsmi_status_t ret = AMDSMI_STATUS_SUCCESS;
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele