Fix undefined amdsmi_init by properly guarding SMI code and adding ENABLE_AMDSMI option

This commit is contained in:
Donato Capitella
2026-02-01 09:34:49 +00:00
förälder b4f25507ec
incheckning f1f0851398
2 ändrade filer med 6 tillägg och 1 borttagningar
+2
Visa fil
@@ -44,6 +44,7 @@ option(TRACE "Enable additional tracing"
option(FAULT_INJECTION "Enable fault injection" ON)
option(QUIET_WARNINGS "Supress compiler warnings" OFF)
option(ENABLE_ROCSHMEM "Enable rocSHMEM support in RCCL" OFF)
option(ENABLE_AMDSMI "Enable AMD/ROCm SMI support" ON)
# Default GPU architectures to build
#==================================================================================================
@@ -301,6 +302,7 @@ if(NOT USE_AMDSMI AND ENABLE_AMDSMI)
message(STATUS "Found rocm_smi at ${SMI_INCLUDE_DIR}")
set(SMI_LIB_NAME "rocm-smi-lib" CACHE INTERNAL "rocm-smi-lib for packaging")
set(SMI_LIBRARIES rocm_smi64)
add_definitions("-DUSE_ROCMSMI")
check_include_file_cxx("${SMI_INCLUDE_DIR}/rocm_smi/rocm_smi64Config.h" HAVE_ROCM_SMI64CONFIG)
+4 -1
Visa fil
@@ -742,7 +742,7 @@ int getFirmwareVersion() {
fw_version = info.fw_info_list[0].fw_version;
#else
#elif defined(USE_ROCMSMI)
rsmi_status_t ret;
ret = rsmi_init(0);
if (ret != RSMI_STATUS_SUCCESS) {
@@ -755,6 +755,9 @@ int getFirmwareVersion() {
ERROR("Could not query firmware info using rocm-smi");
return -1;
}
#else
// SMI disabled
fw_version = -1;
#endif
return fw_version;