drm/amd/amdgpu: Prepare implementation to support reporting of CU usage
Subsystems (2)
PATCH 1/3 drm/amd/amdgpu: Prepare implementation to support reporting of CU usage
[Why]
Allow user to know number of compute units (CU) that are in use at any given moment.
[How]
Read registers of SQ that give number of waves that are in flight of various queues. Use this information to determine number of CU's in use.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 ++++++----- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h | 5 +---- 2 files changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -5
@@ -49,6 +49,7 @@#include "amdgpu_ras.h" #include "gfx_v9_4.h" +#include "gfx_v9_0.h" #include "asic_reg/pwr/pwr_10_0_offset.h" #include "asic_reg/pwr/pwr_10_0_sh_mask.h"
@@ -785,10 +786,9 @@ static void gfx_v9_0_set_ring_funcs(struct amdgpu_device *adev);static void gfx_v9_0_set_irq_funcs (struct amdgpu_device *adev);static void gfx_v9_0_set_gds_init (struct amdgpu_device *adev);static void gfx_v9_0_set_rlc_funcs (struct amdgpu_device *adev); -static int gfx_v9_0_get_cu_info (struct amdgpu_device *adev, -struct amdgpu_cu_info *cu_info);static uint64_t gfx_v9_0_get_gpu_clock_counter (struct amdgpu_device *adev); -static void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num,u32 instance); +static int gfx_v9_0_get_cu_info (struct amdgpu_device *adev, +struct amdgpu_cu_info *cu_info);static void gfx_v9_0_ring_emit_de_meta (struct amdgpu_ring *ring);static u64 gfx_v9_0_ring_get_rptr_compute (struct amdgpu_ring *ring); static int gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev,
@@ -2397,7 +2397,8 @@ static void gfx_v9_0_tiling_mode_table_init(struct amdgpu_device *adev)/* TODO */ } -static void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num,u32 instance) +void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num, +u32 instance) {u32 data;
@@ -6924,7 +6925,7 @@ static u32 gfx_v9_0_get_cu_active_bitmap(struct amdgpu_device *adev) }static int gfx_v9_0_get_cu_info (struct amdgpu_device *adev, -struct amdgpu_cu_info *cu_info) +struct amdgpu_cu_info *cu_info) {int i, j, k, counter, active_cu_number =0 ;u32 mask, bitmap, ao_bitmap, ao_cu_mask =0 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h +1 -4
@@ -26,9 +26,6 @@extern const struct amdgpu_ip_block_version gfx_v9_0_ip_block; -void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num); - -uint64_t gfx_v9_0_get_gpu_clock_counter (struct amdgpu_device *adev); -int gfx_v9_0_get_cu_info (struct amdgpu_device *adev,struct amdgpu_cu_info *cu_info); +void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num,u32 instance);#endif
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Comments inline
Quoted 37 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Ramesh Errabolu
Sent: Friday, September 25, 2020 6:03 PM
To: [email protected]
Cc: Errabolu, Ramesh <[email protected]>
Subject: [PATCH 1/3] drm/amd/amdgpu: Prepare implementation to support reporting of CU usage[Why]
Allow user to know number of compute units (CU) that are in use at any given moment.[How]
Read registers of SQ that give number of waves that are in flight of various queues. Use this information to determine number of CU's in use.Signed-off-by Ramesh Errabolu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 11 ++++++----- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h | 5 +---- 2 files changed, 7 insertions(+), 9 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0@@ -49,6 +49,7 @@#include "amdgpu_ras.h" #include "gfx_v9_4.h" +#include "gfx_v9_0.h" #include "asic_reg/pwr/pwr_10_0_offset.h" #include "asic_reg/pwr/pwr_10_0_sh_mask.h"
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_set_ring_funcs(struct amdgpu_device *adev); · line 792
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-3@@ -785,10 +786,9 @@ static void gfx_v9_0_set_ring_funcs(struct amdgpu_device *adev);static void gfx_v9_0_set_irq_funcs (struct amdgpu_device *adev);static void gfx_v9_0_set_gds_init (struct amdgpu_device *adev);static void gfx_v9_0_set_rlc_funcs (struct amdgpu_device *adev); -static int gfx_v9_0_get_cu_info (struct amdgpu_device *adev, -struct amdgpu_cu_info *cu_info);static uint64_t gfx_v9_0_get_gpu_clock_counter (struct amdgpu_device *adev); -static void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num, u32 instance); +static int gfx_v9_0_get_cu_info (struct amdgpu_device *adev, +struct amdgpu_cu_info *cu_info);
We don't need to move this function definition down here, do we? Keeping the diff as small as possible is ideal, and helps with the git history/blame functionality
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0static void gfx_v9_0_ring_emit_de_meta (struct amdgpu_ring *ring);static u64 gfx_v9_0_ring_get_rptr_compute (struct amdgpu_ring *ring);static int gfx_v9_0_query_ras_error_count(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-1@@ -2397,7 +2397,8 @@ static void gfx_v9_0_tiling_mode_table_init(struct amdgpu_device *adev)/* TODO */ } -static void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num, u32 instance) +void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num, +u32 instance) {drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0u32 data;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static u32 gfx_v9_0_get_cu_active_bitmap(struct amdgpu_device · line 6929
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-1@@ -6924,7 +6925,7 @@ static u32 gfx_v9_0_get_cu_active_bitmap(struct amdgpu_device *adev) }static int gfx_v9_0_get_cu_info (struct amdgpu_device *adev, -struct amdgpu_cu_info *cu_info) +struct amdgpu_cu_info *cu_info)
Keep the indentation where it was
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0{int i, j, k, counter, active_cu_number =0 ;drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0u32 mask, bitmap, ao_bitmap, ao_cu_mask =0 ;drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h +0
-0
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h line 30
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h +1
-4@@ -26,9 +26,6 @@extern const struct amdgpu_ip_block_version gfx_v9_0_ip_block; -void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num); - -uint64_t gfx_v9_0_get_gpu_clock_counter (struct amdgpu_device *adev); -int gfx_v9_0_get_cu_info (struct amdgpu_device *adev,struct amdgpu_cu_info *cu_info); +void gfx_v9_0_select_se_sh (struct amdgpu_device *adev,u32 se_num,u32 sh_num,u32 instance);
You shouldn't remove get_gpu_clock_counter . Also, the definition should stay where it was (above get_gpu_clock_counter). And get_cu_info should also stay.
Kent
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.h +0
-1#endif --2.27.0
Quoted 8 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.or
g%2Fmailman%2Flistinfo%2Famd- gfx&data=02%7C01%7Ckent.russell%40amd.com%7C7d7719c7d79d42b0929b08d8619 ec6d5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637366681875267026& ;sdata=uugTvQGeVADMxj06qT4LHriy3GEs2Zg3%2Bzpln0VX6b4%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx