Skip to content

Commit

Permalink
Merge amd-staging into amd-master 20230317
Browse files Browse the repository at this point in the history
Signed-off-by: Hao Zhou <[email protected]>
Change-Id: Iad8075d8aae2e0577dd6a36ce789d4f07741a448
  • Loading branch information
Hao Zhou authored and Hao Zhou committed Mar 17, 2023
2 parents 68ca36e + 1b7eb4e commit 74c96db
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@ add_subdirectory("oam")

option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorg with backward compatibility" ON)
if(FILE_REORG_BACKWARD_COMPATIBILITY)
# To enable/disable #error in wrapper header files
if(NOT DEFINED ROCM_HEADER_WRAPPER_WERROR)
if(DEFINED ENV{ROCM_HEADER_WRAPPER_WERROR})
set(ROCM_HEADER_WRAPPER_WERROR "$ENV{ROCM_HEADER_WRAPPER_WERROR}"
CACHE STRING "Header wrapper warnings as errors.")
else()
set(ROCM_HEADER_WRAPPER_WERROR "ON" CACHE STRING "Header wrapper warnings as errors.")
endif()
endif()
if(ROCM_HEADER_WRAPPER_WERROR)
set(deprecated_error 1)
else()
set(deprecated_error 0)
endif()

include(rocm_smi-backward-compat.cmake)
endif()

Expand Down
2 changes: 1 addition & 1 deletion oam/example/oam_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main()

// amd_oam_ops.get_mapi_version(&version);
if (!amd_oam_ops.discover_devices(&dev_cnt))
printf("%d AMD devices are discovered\n", dev_cnt);
printf("%u AMD devices are discovered\n", dev_cnt);
if (!dev_cnt) {
printf("No devices are found.\n");
return amd_oam_ops.free();
Expand Down
8 changes: 4 additions & 4 deletions oam/src/amd_oam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ int amdoam_get_sensors_info(uint32_t device_id, oam_sensor_type_t type,
case OAM_SENSOR_TYPE_POWER:
for (i = 0; i < num_sensors; i++) {
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
"POWER_SENSOR_%d", i+1);
"POWER_SENSOR_%u", i+1);
sensor_info[i].sensor_type = type;
status = rsmi_dev_power_ave_get(device_id, i,
reinterpret_cast<uint64_t*>(&sensor_info[i].value));
Expand All @@ -262,7 +262,7 @@ int amdoam_get_sensors_info(uint32_t device_id, oam_sensor_type_t type,
case OAM_SENSOR_TYPE_VOLTAGE:
for (i = 0; i < num_sensors; i++) {
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
"VOLTAGE_SENSOR_%d", i);
"VOLTAGE_SENSOR_%u", i);
sensor_info[i].sensor_type = type;
status = rsmi_dev_volt_metric_get(device_id, RSMI_VOLT_TYPE_VDDGFX,
RSMI_VOLT_CURRENT, &sensor_info[i].value);
Expand All @@ -274,7 +274,7 @@ int amdoam_get_sensors_info(uint32_t device_id, oam_sensor_type_t type,
case OAM_SENSOR_TYPE_TEMP:
for (i = 0; i < num_sensors; i++) {
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
"TEMP_SENSOR_%d", i+1);
"TEMP_SENSOR_%u", i+1);
sensor_info[i].sensor_type = type;
status = rsmi_dev_temp_metric_get(device_id, i, RSMI_TEMP_CURRENT,
&sensor_info[i].value);
Expand All @@ -286,7 +286,7 @@ int amdoam_get_sensors_info(uint32_t device_id, oam_sensor_type_t type,
case OAM_SENSOR_TYPE_FAN_SPEED:
for (i = 0; i < num_sensors; i++) {
snprintf(sensor_info[i].sensor_name, OAM_SENSOR_NAME_MAX,
"FAN_SENSOR_%d", i+1);
"FAN_SENSOR_%u", i+1);
sensor_info[i].sensor_type = type;
status = rsmi_dev_fan_speed_get(device_id, i, &sensor_info[i].value);
if (status != RSMI_STATUS_SUCCESS)
Expand Down
9 changes: 8 additions & 1 deletion rocm_smi-backward-compat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@ function(create_header_template)
#ifndef @include_guard@
#define @include_guard@
#if defined(__GNUC__)
#ifndef ROCM_HEADER_WRAPPER_WERROR
#define ROCM_HEADER_WRAPPER_WERROR @deprecated_error@
#endif
#if ROCM_HEADER_WRAPPER_WERROR /* ROCM_HEADER_WRAPPER_WERROR 1 */
#error \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with @prefix_name@\"
#else /* ROCM_HEADER_WRAPPER_WERROR 0 */
#if defined(__GNUC__)
#warning \"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with @prefix_name@\"
#else
#pragma message(\"This file is deprecated. Use file from include path /opt/rocm-ver/include/ and prefix with @prefix_name@\")
#endif
#endif /* ROCM_HEADER_WRAPPER_WERROR */
@include_statements@
Expand Down

0 comments on commit 74c96db

Please sign in to comment.