Add GPU_POWER (v3) + refactored cleanup
I split out the deletion of the unused bits in --top.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 Remove unused bits from --top
--- src/app/top.c | 5 ----- 1 file changed, 5 deletions(-)
src/app/top.c +0 -5
@@ -171,19 +171,14 @@ static struct umr_bitfield stat_uvd_pgfsm7_bits[] = {static struct umr_bitfield stat_mc_hub_bits[] = { {"OUTSTANDING_READ" ,255 ,255 , &umr_bitfield_default }, {"OUTSTANDING_WRITE" ,255 ,255 , &umr_bitfield_default }, -// { "OUTSTANDING_ATOMIC", 255, 255, &umr_bitfield_default }, {"OUTSTANDING_HUB_RDREQ" ,255 ,255 , &umr_bitfield_default }, {"OUTSTANDING_HUB_RDRET" ,255 ,255 , &umr_bitfield_default }, {"OUTSTANDING_HUB_WRREQ" ,255 ,255 , &umr_bitfield_default }, {"OUTSTANDING_HUB_WRRET" ,255 ,255 , &umr_bitfield_default }, -// { "OUTSTANDING_HUB_ATOMIC_REQ", 255, 255, &umr_bitfield_default }, -// { "OUTSTANDING_HUB_ATOMIC_RET", 255, 255, &umr_bitfield_default }, {"OUTSTANDING_RPB_READ" ,255 ,255 , &umr_bitfield_default }, {"OUTSTANDING_RPB_WRITE" ,255 ,255 , &umr_bitfield_default }, -// { "OUTSTANDING_RPB_ATOMIC", 255, 255, &umr_bitfield_default }, {"OUTSTANDING_MCD_READ" ,255 ,255 , &umr_bitfield_default }, {"OUTSTANDING_MCD_WRITE" ,255 ,255 , &umr_bitfield_default }, -// { "OUTSTANDING_MCD_ATOMIC", 255, 255, &umr_bitfield_default }, {NULL ,0 ,0 ,NULL }, };
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 Add GPU_POWER sensors (v3)
In reply to a message not in the archiveAdd the ability to sample GPU_POWER sensors. Because the sensors have a high latency we read them from a background thread which means we've added the requirement for pthreads.
(v2) Cleaned up CMake around pthreads
(v3) Update readme, factor out some deletions, cleanup switch statement
--- CMakeLists.txt | 4 +++ README | 5 ++- src/app/top.c | 90 ++++++++++++++++++++++++++++++++++++++++++++------ src/lib/CMakeLists.txt | 1 + src/lib/read_sensor.c | 37 +++++++++++++++++++++ src/umr.h | 5 +++ 6 files changed, 129 insertions(+), 13 deletions(-) create mode 100644 src/lib/read_sensor.c
CMakeLists.txt +4 -0
@@ -19,6 +19,9 @@ add_definitions(-DUMR_BUILD_REV=\"${GIT_REV}\") # Add local repository for FindXXX.cmake modules. SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/" ${CMAKE_MODULE_PATH}) +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package(Threads REQUIRED) + find_package(Curses REQUIRED) include_directories(${CURSES_INCLUDE_DIRS})
@@ -31,6 +34,7 @@ include_directories(${LIBDRM_INCLUDE_DIR}) set(REQUIRED_EXTERNAL_LIBS ${CURSES_LIBRARIES} ${PCIACCESS_LIBRARIES} + Threads::Threads ) # Global setting: build everything position independent
README +2 -3
@@ -28,9 +28,8 @@ mailing list at: Building --------- -To build umr you will need pciaccess, ncurses, and libdrm headers and -libraries. Which are available in both Fedora and Ubuntu (as well as -other distributions). To build umr: +To build umr you will need pciaccess, ncurses, libdrm, and pthread +headers and libraries. To build umr: $ mkdir build && cd build/ && cmake ../ $ make
src/app/top.c +80 -10
153 lines not on this page · raw message
src/lib/CMakeLists.txt +1 -0
@@ -14,6 +14,7 @@ add_library(umrcore STATIC find_reg.c mmio.c query_drm.c + read_sensor.c read_sgpr.c read_vram.c ring_decode.c
src/lib/read_sensor.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright 2017 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in 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: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 IN THE SOFTWARE. +* +* Authors: Tom St Denis <[email protected]> +* +*/ +#include "umr.h" + +int umr_read_sensor (struct umr_asic *asic,int sensor,void *dst,int *size) +{ +int r; +lseek (asic->fd.sensors, sensor*4 ,SEEK_SET ); + r =read (asic->fd.sensors, dst, *size); +if (r != *size) { +return -1 ; + } + *size = r; +return 0 ; +}
src/umr.h +5 -0
@@ -31,6 +31,7 @@#include <sys/stat.h> #include <fcntl.h> #include <pciaccess.h> +#include <pthread.h> /* sourced from amd_powerplay.h from the kernel */ enum amd_pp_sensors {
@@ -43,6 +44,9 @@ enum amd_pp_sensors {AMDGPU_PP_SENSOR_GPU_LOAD ,AMDGPU_PP_SENSOR_GFX_MCLK ,AMDGPU_PP_SENSOR_GPU_TEMP , +AMDGPU_PP_SENSOR_VCE_POWER , +AMDGPU_PP_SENSOR_UVD_POWER , + AMDGPU_PP_SENSOR_GPU_POWER, }; enum chipfamily {
@@ -409,6 +413,7 @@ void umr_enumerate_devices(void);int umr_get_wave_status (struct umr_asic *asic,unsigned se,unsigned sh,unsigned cu,unsigned simd,unsigned wave,struct umr_wave_status *ws);int umr_get_wave_sq_info (struct umr_asic *asic,unsigned se,unsigned sh,unsigned cu,struct umr_wave_status *ws);int umr_read_sgprs (struct umr_asic *asic,struct umr_wave_status *ws,uint32_t *dst); +int umr_read_sensor (struct umr_asic *asic,int sensor,void *dst,int *size);/* mmio helpers */ uint32_t umr_find_reg (struct umr_asic *asic,char *regname);
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hey Tom,
Tom St Denis wrote on 11.02.2017 18:52:
Quoted 1 line
I split out the deletion of the unused bits in --top.
thank you so much for bearing with me (and Edward, though I can't speak for him, obviously)! You can still have my R-b. ;-)
Cheers,
Kai
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 3627d968-1817-5ca3-024e-1d91291680b5-1ZKVMVCtJ2dx9oSEVPI0kiST3g8Odh+X@public.gmane.org
Quoted 10 lines · Kai Wasserbäch
Hey Tom,
Tom St Denis wrote on 11.02.2017 18:52:Quoted 1 line
I split out the deletion of the unused bits in --top.
thank you so much for bearing with me (and Edward, though I can't speak for him, obviously)! You can still have my R-b. ;-)
Cheers,
Kai
No worries. It's no secret I'm no fan of NFC re-submits but hard to get upset in the face of genuinely good feedback. And it is a community project in the long run so it's not like community pushback/feedback is not welcomed (my rumblings notwithstanding).
Thanks to you and Edward for the feedback.
I've pushed them out. You'll need a staging kernel to use GPU_POWER (with my and Eric's patches) to see any of this on a VI dGPU.
It's kinda interesting to see the power usage graphs (using umr's --top 'logger' mode) comparing Polaris10 and fiji while running say unigine-heaven. I think the sensors will help debug/optimize power usage going forward.
Cheers,
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 2b15805a-3e56-71b7-0242-98e3db103add-5C7GfCeVMHo@public.gmane.org
Hey Tom,
Tom St Denis wrote on 11.02.2017 20:05:
Quoted 7 lines · Kai Wasserbäch
Quoted 6 lines
Tom St Denis wrote on 11.02.2017 18:52:
Quoted 1 line
I split out the deletion of the unused bits in --top.
thank you so much for bearing with me (and Edward, though I can't speak for him, obviously)! You can still have my R-b. ;-)
Quoted 8 lines
Quoted 3 lines
Cheers,
KaiNo worries. It's no secret I'm no fan of NFC re-submits but hard to get upset in the face of genuinely good feedback. And it is a community project in the long run so it's not like community pushback/feedback is not welcomed (my rumblings notwithstanding).
I'm not sure what AMD's internal policy might be on this, but NFC re-submits are usually covered by the "with this/these fixed, you can have my R-b". Which is the reason I had that kind of language in there. I didn't expect a resend to the list, to be honest. (And I would guess the same applied to Edward's R-b.)
Quoted 8 lines
Thanks to you and Edward for the feedback.
I've pushed them out. You'll need a staging kernel to use
GPU_POWER(with my and Eric's patches) to see any of this on a VI dGPU.It's kinda interesting to see the power usage graphs (using umr's --top 'logger' mode) comparing Polaris10 and fiji while running say unigine-heaven. I think the sensors will help debug/optimize power usage going forward.
Oh, should there have been a DRM version check in there then? Like Mesa guards some features?
In any case I will have to wait for the Vega-upgrade I'm planning for this year to actually test these features out.
Cheers,
Kai
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx