Commit Graph

128 Commits

Author SHA1 Message Date
Galantsev, Dmitrii 5a234677fb SWDEV-340919 - Move examples and tests install dir
Previous install locations:
- /opt/rocm/share/example/amd-smi
- /opt/rocm/share/tests/amd-smi

New install locations:
- /opt/rocm/share/amd_smi/example
- /opt/rocm/share/amd_smi/tests

Change-Id: I305477b9f66bdc5963923efe6da1c01f87ea2085
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/amdsmi commit: 6ee793ca03]
2023-01-20 09:49:56 -06:00
Dalibor Stanisavljevic 24ceedf639 SWDEV-378294 - Fixed failing tests
Change-Id: Ie0f9dedd6901e05b1a5ca7846624c127d92ed67f
Signed-off-by: Dalibor Stanisavljevic <Dalibor.Stanisavljevic@amd.com>


[ROCm/amdsmi commit: bf79fe4323]
2023-01-18 10:28:32 -05:00
Bill(Shuzhou) Liu f29da5cce9 change sensor_type in amdsmi_dev_get_temp_metric() to enum
The sensor_type in amdsmi_dev_get_temp_metric() will be changed to
amdsmi_temperature_type_t

Change-Id: I72a7f271b0a55a025acc2ca523062a3d51cc036d


[ROCm/amdsmi commit: 79bd9c1d5f]
2023-01-04 13:01:04 -06:00
Galantsev, Dmitrii 2d97dee0c2 SWDEV-374138 - Improve ASAN flags
Tests overwritten the linker flags resulting in failed build with clang.
This change improves ASAN linker flag assignment and fixes test issue.

Change-Id: I88f38360d46b20f6cc7298ad0d1fd09ff6ce47d6
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/amdsmi commit: 2184d0c3d7]
2023-01-03 16:30:48 -06:00
Bill(Shuzhou) Liu 594f222ad5 Make amdsmi function name consistent
Some of the amdsmi function have the verb (set or get) at the
end of the function. Move it to the middle to be consistent with
other APIs.

Change-Id: I8053d16f46af951c25aaaf8febf2896a33633fa1


[ROCm/amdsmi commit: 221d6fdc5c]
2022-12-16 10:20:49 -06:00
Galantsev, Dmitrii 77223cb3db CMAKE: Resolve lib dependencies for tests
amdsmitst was failing and not finding libgtest and libamd_smi.

This change resolves the issue by

1. Installing gtest into tests directory
2. Modifying RUNPATH variable to point to libamd_smi.so

Change-Id: I126d01c88116d37c5f2b55b9ecb2c9f1313f26fe
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/amdsmi commit: 0c52236abd]
2022-12-12 14:37:57 -06:00
Dalibor Stanisavljevic b48024d883 SWDEV-370223 - Change the name of the header to amdsmi.h
Change dev to device_handle throughout the file
Change the pcie_info pcie_speed field type to uint32_t
Add AMDSMI prefix before amdsmi_mm_ip enum

Change-Id: I242145389ddc3f2ad05dfd6ca371640f4d118fc4
Signed-off-by: Dalibor Stanisavljevic <Dalibor.Stanisavljevic@amd.com>


[ROCm/amdsmi commit: b4b761d02f]
2022-12-08 13:34:34 +01:00
Galantsev, Dmitrii 6e85124757 CMAKE: Repackage whole project for ROCm 5.5 release
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Change-Id: I932b11a111c8e0db04bd8c5e0c3d1a470e5b2386


[ROCm/amdsmi commit: aeb0bf5832]
2022-11-29 17:04:32 -06:00
Bill(Shuzhou) Liu 17fa3924d6 Fix the unit tests
Fix a few broken unit tests to handle NOT_YET_IMPLEMENTED errors.

Change-Id: If3afac0dc32f2e3e82d83bffa5906b630bb1894a


[ROCm/amdsmi commit: c8caa80405]
2022-11-04 08:53:09 -05:00
Galantsev, Dmitrii f1125780dd Cleanup tests
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/amdsmi commit: 7957b63dd4]
2022-11-03 13:30:16 -05:00
Galantsev, Dmitrii 4fede3797c Cleanup CMakeLists.txt for packaging
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>


[ROCm/amdsmi commit: c99e4e1501]
2022-11-03 12:44:23 -05:00
Bill(Shuzhou) Liu 1ae77d9ac0 The device name and vbios version is incorrect
Get the device name from rocm-smi which is not displayed properly
in some cards. Set the vibos version using the rocm-smi.

Change-Id: I138f1760cde94007cb93cad02c6d8cccbb4afa28


[ROCm/amdsmi commit: 9a92ea833f]
2022-10-28 13:03:18 -05:00
Bill(Shuzhou) Liu 33f7fba549 Fix unit test compile error
Update the unit test as header enum type name is changed.

Change-Id: Ie965462da7d46259883650b15644003cf936982a


[ROCm/amdsmi commit: a25c71b730]
2022-10-20 09:54:11 -05:00
Bill(Shuzhou) Liu b546e272e0 Change the get_socket_handles and get_device_handles APIs interface
Those two APIs are changed to let the user get the handles count,
allocate memory, and then return handles to the allocated memory.

Change-Id: Ibe28a89ad188c99da6af3af1740b2b25ff22ba06


[ROCm/amdsmi commit: 2b2d11c446]
2022-10-20 09:24:31 -05:00
Dalibor Stanisavljevic bd4ff14bd0 SWDEV-353742 - Port smilib function to amdsmi
Change-Id: I99df249755a5c665a8dd1777fa82d046e139bd77
Signed-off-by: Dalibor Stanisavljevic <Dalibor.Stanisavljevic@amd.com>


[ROCm/amdsmi commit: 3daf9c1063]
2022-10-20 09:24:22 -05:00
Bill(Shuzhou) Liu d83e3a8b6e Restructure the folder
Move rocm_smi related function to rocm_smi folder. Move amd_smi to
top level include/ and src/ folder. Remove obsolte oam folder.
Change the CMakeLists.txt to update folder locations.

Change-Id: I52e6be739e49f3b0545865f25364787f5985e9c3


[ROCm/amdsmi commit: 0c91ef919d]
2022-10-20 09:23:51 -05:00
Bill(Shuzhou) Liu 0b624c50d2 Support rocm-smi related device information
A few fields are added to board_info and asic_info for rocm-smi
device information.

Implement rocm-smi related fw block in amdsmi_get_fw_info().

Change-Id: I825d3e5c7feaa07a6e05386d4f1a59ebf528dfc0


[ROCm/amdsmi commit: 1ec3a2182e]
2022-10-20 09:23:41 -05:00
Bill(Shuzhou) Liu bfa976cf08 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]
2022-09-06 12:08:59 -04:00
Bill(Shuzhou) Liu 236e4e2d3e Port more rocm-smi function to amd-smi
The API support function, performance counter, process information,
topology and xgmi info.

Change-Id: I3350ec75fdd2ca1438e79134582ae83c49763056


[ROCm/amdsmi commit: 86017b799c]
2022-08-24 12:49:27 -05:00
Bill(Shuzhou) Liu 39c1c4334e Support events in the amdsmi
Port the events handling from rocm-smi to amd-smi

Change-Id: I0b4cb30a585cb2188a24be0e21c1c156b461bb1d


[ROCm/amdsmi commit: 7b92c694a0]
2022-08-23 16:49:56 -04:00
Bill(Shuzhou) Liu 06a481c563 Add unit test support
Add gtest based unit test framework. Implement fan read/write function.

Change-Id: I83375c24b99d24d01d12bccda863a38f75f5987f


[ROCm/amdsmi commit: 98df483bef]
2022-08-05 09:55:34 -04:00
Bill(Shuzhou) Liu 26df407089 Upgrade GoogleTest to v1.11.0
The old GoogleTest has compile errors on Centos 9. Upgrade it
to latest version.

Change-Id: I6bbe6afdfad6422a210f258880ddc87a9f088d76


[ROCm/amdsmi commit: 8ce9289bc2]
2022-03-09 15:18:43 -05:00
Sreekant Somasekharan b3ba591ee6 Add blacklist filter 'virtualization' for rsmi tests failing in SRIOV
Change-Id: Ibbaef092482c0b78ecd86a29f0b9b4331b51abe2


[ROCm/amdsmi commit: e6ae697e9c]
2022-03-04 22:13:44 -05:00
Divya Shikre ee42de6190 Temporary blacklist TestPerfLevelReadWrite for navi21
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Iee2146170b6828fe4fe2846c3ebfd57f95734f34


[ROCm/amdsmi commit: 8c4635acea]
2022-01-27 22:56:37 -05:00
Divya Shikre 2d7a5566e4 Don't assert when fan is not supported.
Add a check when RSMI_STATUS_NOT_SUPPORTED is returned for fanRead/fanReadWrite.
Fix for SWDEV-314176 & SWDEV-314175 reported.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Icf2cc541a3fa5ca4794aff5d6bc91104adc45e6d


[ROCm/amdsmi commit: 11a71c63b1]
2022-01-20 12:29:12 -05:00
Divya Shikre 656b39646e Update temp_read rsmitst.
Check for RSMI_STATUS_INVALID_ARGS when invalid args are passed.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I0d5ff84aee5cce4214026ddcd860a17ae3e43147


[ROCm/amdsmi commit: b4fd9c0d94]
2021-11-29 18:09:45 -05:00
Sreekant Somasekharan 1a4346e6ba Skip TestFrequenciesReadWrite for unsupported ASICs
For ASICs NAVI10 and above setting display clock [DCEFCLK] is not supported and the sysfs entry is
read-only. As a result, the test falsely fails for these ASICs. ROCm SMI Lib is ASIC independent.
So Display clock set cannot be selectively disabled for these ASICs.

As a compromise if the set (write to sysfs entry) fails due to permission error and euid is root,
assume that set feature is not supported and skip the test.

Change-Id: I7a273878cbf1465b01728705323e8a92a42378dd


[ROCm/amdsmi commit: c6f695f5a9]
2021-11-29 11:23:38 -05:00
Sreekant Somasekharan d48617a959 Modify bool variable to true in if condition of src=dst
Change-Id: Ie2024b3a6ad68e48384bb3472fe8785bcd643665


[ROCm/amdsmi commit: 3f27dcc1ac]
2021-11-17 12:53:40 -05:00
Sreekant Somasekharan 3370c2dd7a Add test case for rsmi_is_P2P_accessible API.
Change-Id: Iccfede42925c98d96454b5f25cc0ed6fc9258911


[ROCm/amdsmi commit: ce46fd237a]
2021-10-28 17:06:07 -04:00
Divya Shikre 2d9a7dfb0b Add failing rsmi tests to exclude file to enable blacklisting
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Ibdad4d54ffe87391b13379c63e005fd04c6abaf5


[ROCm/amdsmi commit: e96d6ab77e]
2021-10-26 17:57:05 -04:00
Bill(Shuzhou) Liu e26cec9f5a Add -g compiler option for ADDRESS_SANITIZER
Add -g compiler option for Address Sanitizer

Change-Id: I958fefa6c4b5871c29734ab1d4ec238c9e073192


[ROCm/amdsmi commit: 42d39d3e34]
2021-08-03 13:54:19 -04:00
Divya Shikre 7a0b4bc8ac Add fix to ignore error returned when perf determinism is not supported.
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I89b6a0a3dbba6fbd4b12ff2e20670eff9f32ed7f


[ROCm/amdsmi commit: 6edea7a92e]
2021-06-14 12:18:22 -04:00
Ori Messinger a9e6f40bbb ROCm SMI LIB: Add Default Power Cap To rsmitst
Implement default GPU power cap functionality in rsmitst.
It is available in the "rsmitstReadOnly.TestPowerRead" test, and
is displayed as: "Default Power Cap: #uW" (where uW is microwatts).

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: I564ea3785f1a93dfd30587634057516549fa762c


[ROCm/amdsmi commit: 5b42cdf780]
2021-04-28 12:42:34 -04:00
Harish Kasiviswanathan 52dc52654d Add energy counter resolution to rsmi_dev_energy_count_get
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Change-Id: I03b70968257db7a45e21d7ba62542cdedd18eb85


[ROCm/amdsmi commit: 844acbc0d8]
2021-04-22 10:25:06 -04:00
Harish Kasiviswanathan abedccf6f3 Add time profile for set_power_cap function
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Change-Id: Id728cb5fe85b3558e52b4517508211dca499e801


[ROCm/amdsmi commit: 92cf7ff28a]
2021-04-21 15:29:44 -04:00
Bill(Shuzhou) Liu 6e21939768 Unit test for energy accumulator counter
Add a few unit tests for energy accumulator counter.

Change-Id: Ib78a67e29465de9c14e6e934c5d62ec64de66d8a


[ROCm/amdsmi commit: 392d13e318]
2021-04-14 16:04:46 -04:00
Bill(Shuzhou) Liu 62bef2b6c4 Unit tests for coarse grain utilization counters
The unit tests for GFX and Memory activity counters.

Change-Id: I968dabc9ef6de9d335d7f751b290fb713b51a79c


[ROCm/amdsmi commit: 6340176b99]
2021-04-14 10:53:55 -04:00
Divya Shikre 0fc1abdced Update performance determinism api as per the modified sysfs interface.
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Ib0ec5128819644a2ff6c916da9194a7fe1dad795


[ROCm/amdsmi commit: aaf2120117]
2021-04-07 16:38:48 -04:00
Bill(Shuzhou) Liu 7b48f14374 Add support for the HBM temperature
The rsmi_dev_temp_metric_get() can also support the HBM
temperatures which is retrieved from gpu_metrics.

Change-Id: I96b979296e90cf881523627b41b1a02849676416


[ROCm/amdsmi commit: da480b4589]
2021-04-05 15:55:55 -04:00
Chris Freehill 7337bfaef9 Handle different gpu_metrics content versions for format v1
Change-Id: I344d1815da683befc8f8b5caf921803b267ae29f


[ROCm/amdsmi commit: 5e2a4f3a15]
2021-03-24 14:34:55 -05:00
Kent Russell 4a35269cc1 CMakeLIsts: Fix libasan usage
static-libasan doesn't exist, so use the easier-to-remember
shared-libsan and change static-libasan to static-libsan

Signed-off-by: Kent Russell <kent.russell@amd.com>
Change-Id: Ieef480aacdd770f3bb40673a2e8f8306b308b1c9


[ROCm/amdsmi commit: ef7f99a7e2]
2021-01-15 15:39:05 -05:00
Chris Freehill a0c99bc972 Correct TestPerfLevelReadWrite test
Enums referenced in the test did not match what's in rocm_smi.h.
Added static assert to try to catch this. Also moved enum string
map to test_common.cc/h where other such maps are.

Also, fixed some cpplint issues.

Change-Id: I683553248ceb2fabb28ce1a1208bc9744aaf88d6


[ROCm/amdsmi commit: 7e17684532]
2020-12-16 17:12:04 -06:00
Chris Freehill 3be45e2ea9 Fix process killed while holding mutex
Previously, when a process holding a shared mutex was killed,
the next time an RSMI application was started, it would not be
able to obtain the mutex--the application would have to exit.
This fix uses pthread_mutexattr_setrobust() to detect this
situation and act accordingingly.

Also, add some missing, needed mutexes and move mutexes
closer to where the protect resource is used.

Change-Id: Icfdc3a246f4cfa3fd008e3f13472199abd76fd35


[ROCm/amdsmi commit: f4938b0ac9]
2020-12-04 12:59:55 -05:00
Divya Shikre 4fd8d18e22 Adding Performance Determinism Mode to rocm_smi lib, CLI & gtest.
A special mode of operation to achieve minimal performance variation by letting
the user have the ability to provide the desired frequency to be set as the soft limit.
The user can control the entry and exit to the mode via rocm-smi a mechanism to
enter / exit performance determinism mode as below.

Enter performance determinism mode:
- hold a lock
- write performance_determinism to power_dpm_force_performance_level
- write input clk_freq to pp_dpm_sclk
- release lock

Exit performance determinism_mode:
- hold a lock
- write auto to power_dpm_force_performance_level
- release lock

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Ia24e27954cdf1c4337ffc83d8948fbdfaf4552d2


[ROCm/amdsmi commit: 60d0f3052f]
2020-12-02 11:11:00 -05:00
Mukul Joshi c017960507 Update Event Notification test for GPU Reset event
Update the event notification tests to handle both GPU pre reset
and GPU post reset events. GPU post reset event takes sometime to
be generated after the pre reset event, so issue another
notification read to wait for post reset event.

Change-Id: I2812760b184d5357130e478cc35d27b14592abb3


[ROCm/amdsmi commit: 446ab5c8c7]
2020-11-23 10:53:23 -05:00
Chris Freehill bd9e47a53c rsmitst address sanitizer support
Also, add libasan flag variants for librocm_smi

Change-Id: Ibd012e40d26907addf8c0550aaf9f78c11b8d51f


[ROCm/amdsmi commit: bf6af90908]
2020-11-10 15:45:56 -06:00
Chris Freehill c6a58d91cb Quiet address sanitizer warnings
Also,
* Fix some doxygen issues
* Fix address sanitizer issues in rsmitst

Change-Id: Ie6c6fd9af5c418210b7064e79650fb92cd4a5e2b


[ROCm/amdsmi commit: 63064b0000]
2020-11-10 14:16:39 -06:00
Ramesh Errabolu c69c210a6e Update ROCm SMI library with ability to read CU occupancy
Change-Id: Ib9882fa2d81c13604af282279bfa116bc2fd05a4


[ROCm/amdsmi commit: 328878343c]
2020-10-14 09:33:37 -04:00
Divya Shikre 207d6339ec Adding gtest for gpu metrics read
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I66edb15c8b7380f3427822b33e845202bfac7a2b


[ROCm/amdsmi commit: f397cba414]
2020-10-08 13:37:47 -04:00
Chris Freehill 137e33a1e6 Revert "Revert "Support for RSMI_EVNT_GRP_XGMI_DATA_OUT counters""
This reverts commit 1be2933806.



Change-Id: Ic412a64d35aab74caf12bf4c791f0a66ac15b061


[ROCm/amdsmi commit: 5465d872aa]
2020-10-08 10:36:30 -04:00