drm/amdgpu: enable wave limit on non high prio cs pipes
Subsystems (2)
PATCH 1/1 drm/amdgpu: enable wave limit on non high prio cs pipes
To achieve the best QoS for high priority compute jobs it is required to limit waves on other compute pipes as well. This patch will set min value in non high priority mmSPI_WCL_PIPE_PERCENT_CS[0-3] registers to minimize the impact of normal/low priority compute jobs over high priority compute jobs.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 49 ++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 46 ++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +48 -1
@@ -6846,10 +6846,44 @@ static void gfx_v8_0_emit_mem_sync_compute(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x0000000A );/* poll interval */ } + +/* mmSPI_WCL_PIPE_PERCENT_CS[0-7]_DEFAULT values are same */ +#define mmSPI_WCL_PIPE_PERCENT_CS_DEFAULT 0x0000007f +static void gfx_v8_0_emit_wave_limit_cs (struct amdgpu_ring *ring, +uint32_t pipe,bool enable) +{ +uint32_t val; +uint32_t wcl_cs_reg; + + val = enable ?0x1 : mmSPI_WCL_PIPE_PERCENT_CS_DEFAULT; + +switch (pipe) { +case 0 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS0; +break ; +case 1 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS1; +break ; +case 2 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS2; +break ; +case 3 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS3; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + +amdgpu_ring_emit_wreg (ring, wcl_cs_reg, val); + +} +#define mmSPI_WCL_PIPE_PERCENT_GFX_DEFAULT 0x07ffffffstatic void gfx_v8_0_emit_wave_limit (struct amdgpu_ring *ring,bool enable) {uint32_t val; +int i;/* mmSPI_WCL_PIPE_PERCENT_GFX is 7 bit multiplier register to limit * number of gfx waves. Setting 5 bit will make sure gfx only gets
@@ -6857,6 +6891,18 @@ static void gfx_v8_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable)*/ val = enable ?0x1f : mmSPI_WCL_PIPE_PERCENT_GFX_DEFAULT;amdgpu_ring_emit_wreg (ring, mmSPI_WCL_PIPE_PERCENT_GFX, val); + +/* Restrict waves for normal/low priority compute queues as well +* to get best QoS for high priority compute jobs. +* +* amdgpu controls only 1st ME(0-3 CS pipes). +*/ +for (i =0 ; i <4 ; i++) { +if (i != ring->pipe) +gfx_v8_0_emit_wave_limit_cs (ring, i, enable); + + } + }static const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
@@ -6943,7 +6989,8 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {VI_FLUSH_GPU_TLB_NUM_WREG *5 +7 +/* gfx_v8_0_ring_emit_vm_flush */ 7 +7 +7 +/* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */ 7 +/* gfx_v8_0_emit_mem_sync_compute */ - 5, /* gfx_v8_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ +5 +/* gfx_v8_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ + 15, /* for updating 3 mmSPI_WCL_PIPE_PERCENT_CS registers */ .emit_ib_size = 7, /* gfx_v8_0_ring_emit_ib_compute */ .emit_ib = gfx_v8_0_ring_emit_ib_compute, .emit_fence = gfx_v8_0_ring_emit_fence_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +45 -1
68 lines not on this page · raw message
Signature · 6 lines
2.30.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 64 lines · Nirmoy Das
To achieve the best QoS for high priority compute jobs it is required to limit waves on other compute pipes as well. This patch will set min value in non high priority mmSPI_WCL_PIPE_PERCENT_CS[0-3] registers to minimize the impact of normal/low priority compute jobs over high priority compute jobs.
Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 49 ++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 46 ++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +34
-0@@ -6846,10 +6846,44 @@ static void gfx_v8_0_emit_mem_sync_compute(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x0000000A );/* poll interval */ } + +/* mmSPI_WCL_PIPE_PERCENT_CS[0-7]_DEFAULT values are same */ +#define mmSPI_WCL_PIPE_PERCENT_CS_DEFAULT 0x0000007f +static void gfx_v8_0_emit_wave_limit_cs (struct amdgpu_ring *ring, +uint32_t pipe,bool enable) +{ +uint32_t val; +uint32_t wcl_cs_reg; + + val = enable ?0x1 : mmSPI_WCL_PIPE_PERCENT_CS_DEFAULT; + +switch (pipe) { +case 0 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS0; +break ; +case 1 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS1; +break ; +case 2 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS2; +break ; +case 3 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS3; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + +amdgpu_ring_emit_wreg (ring, wcl_cs_reg, val); + +} +#define mmSPI_WCL_PIPE_PERCENT_GFX_DEFAULT 0x07ffffffstatic void gfx_v8_0_emit_wave_limit (struct amdgpu_ring *ring,bool enable) {uint32_t val; +int i;/* mmSPI_WCL_PIPE_PERCENT_GFX is 7 bit multiplier register to limit * number of gfx waves. Setting 5 bit will make sure gfx only gets
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable) · line 6900
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7
-0@@ -6857,6 +6891,18 @@ static void gfx_v8_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable)*/ val = enable ?0x1f : mmSPI_WCL_PIPE_PERCENT_GFX_DEFAULT;amdgpu_ring_emit_wreg (ring, mmSPI_WCL_PIPE_PERCENT_GFX, val); + +/* Restrict waves for normal/low priority compute queues as well +* to get best QoS for high priority compute jobs. +* +* amdgpu controls only 1st ME(0-3 CS pipes). +*/ +for (i =0 ; i <4 ; i++) {
How about using adev->gfx.mec.num_pipe_per_mec instead of hardcoding 4 here?
Quoted 66 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7
-1+if (i != ring->pipe) +gfx_v8_0_emit_wave_limit_cs (ring, i, enable); + + } + }static const struct amd_ip_funcs gfx_v8_0_ip_funcs = {@@ -6943,7 +6989,8 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {VI_FLUSH_GPU_TLB_NUM_WREG *5 +7 +/* gfx_v8_0_ring_emit_vm_flush */ 7 +7 +7 +/* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */ 7 +/* gfx_v8_0_emit_mem_sync_compute */ - 5, /* gfx_v8_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ +5 +/* gfx_v8_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ + 15, /* for updating 3 mmSPI_WCL_PIPE_PERCENT_CS registers */ .emit_ib_size = 7, /* gfx_v8_0_ring_emit_ib_compute */ .emit_ib = gfx_v8_0_ring_emit_ib_compute, .emit_fence = gfx_v8_0_ring_emit_fence_compute,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +32
-0@@ -6668,10 +6668,42 @@ static void gfx_v9_0_emit_mem_sync(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x0000000A );/* POLL_INTERVAL */ } +static void gfx_v9_0_emit_wave_limit_cs (struct amdgpu_ring *ring, +uint32_t pipe,bool enable) +{ +struct amdgpu_device *adev = ring->adev; +uint32_t val; +uint32_t wcl_cs_reg; + +/* mmSPI_WCL_PIPE_PERCENT_CS[0-7]_DEFAULT values are same */ + val = enable ?0x1 : mmSPI_WCL_PIPE_PERCENT_CS0_DEFAULT; + +switch (pipe) { +case 0 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS0); +break ; +case 1 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS1); +break ; +case 2 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS2); +break ; +case 3 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS3); +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + +amdgpu_ring_emit_wreg (ring, wcl_cs_reg, val); + +}static void gfx_v9_0_emit_wave_limit (struct amdgpu_ring *ring,bool enable) {struct amdgpu_device *adev = ring->adev;uint32_t val; +int i;/* mmSPI_WCL_PIPE_PERCENT_GFX is 7 bit multiplier register to limit
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable) · line 6723
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-0@@ -6682,6 +6714,17 @@ static void gfx_v9_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable)amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_GFX), val); + +/* Restrict waves for normal/low priority compute queues as well +* to get best QoS for high priority compute jobs. +* +* amdgpu controls only 1st ME(0-3 CS pipes). +*/ +for (i =0 ; i <4 ; i++) {
Same comment here.
Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-2+if (i != ring->pipe) +gfx_v9_0_emit_wave_limit_cs (ring, i, enable); + + } }static const struct amd_ip_funcs gfx_v9_0_ip_funcs = {@@ -6774,7 +6817,8 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {2 +/* gfx_v9_0_ring_emit_vm_flush */ 8 +8 +8 +/* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */ 7 +/* gfx_v9_0_emit_mem_sync */ - 5, /* gfx_v9_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ +5 +/* gfx_v9_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ + 15, /* for updating 3 mmSPI_WCL_PIPE_PERCENT_CS registers */ .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */ .emit_ib = gfx_v9_0_ring_emit_ib_compute, .emit_fence = gfx_v9_0_ring_emit_fence, --2.30.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 61 lines · Alex Deucher
Quoted 60 lines · Nirmoy Das
To achieve the best QoS for high priority compute jobs it is required to limit waves on other compute pipes as well. This patch will set min value in non high priority mmSPI_WCL_PIPE_PERCENT_CS[0-3] registers to minimize the impact of normal/low priority compute jobs over high priority compute jobs.
Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 49 ++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 46 ++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +34
-0@@ -6846,10 +6846,44 @@ static void gfx_v8_0_emit_mem_sync_compute(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x0000000A );/* poll interval */ } + +/* mmSPI_WCL_PIPE_PERCENT_CS[0-7]_DEFAULT values are same */ +#define mmSPI_WCL_PIPE_PERCENT_CS_DEFAULT 0x0000007f +static void gfx_v8_0_emit_wave_limit_cs (struct amdgpu_ring *ring, +uint32_t pipe,bool enable) +{ +uint32_t val; +uint32_t wcl_cs_reg; + + val = enable ?0x1 : mmSPI_WCL_PIPE_PERCENT_CS_DEFAULT; + +switch (pipe) { +case 0 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS0; +break ; +case 1 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS1; +break ; +case 2 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS2; +break ; +case 3 : + wcl_cs_reg = mmSPI_WCL_PIPE_PERCENT_CS3; +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + +amdgpu_ring_emit_wreg (ring, wcl_cs_reg, val); + +} +#define mmSPI_WCL_PIPE_PERCENT_GFX_DEFAULT 0x07ffffffstatic void gfx_v8_0_emit_wave_limit (struct amdgpu_ring *ring,bool enable) {uint32_t val; +int i;
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable) · line 6900
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7
-0/* mmSPI_WCL_PIPE_PERCENT_GFX is 7 bit multiplier register to limit * number of gfx waves. Setting 5 bit will make sure gfx only gets @@ -6857,6 +6891,18 @@ static void gfx_v8_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable)*/ val = enable ?0x1f : mmSPI_WCL_PIPE_PERCENT_GFX_DEFAULT;amdgpu_ring_emit_wreg (ring, mmSPI_WCL_PIPE_PERCENT_GFX, val); + +/* Restrict waves for normal/low priority compute queues as well +* to get best QoS for high priority compute jobs. +* +* amdgpu controls only 1st ME(0-3 CS pipes). +*/ +for (i =0 ; i <4 ; i++) {How about using
adev->gfx.mec.num_pipe_per_mecinstead of hardcoding 4 here?
Thanks Alex, let me resend with that change.
Nirmoy
Quoted 99 lines
Quoted 67 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7
-1+if (i != ring->pipe) +gfx_v8_0_emit_wave_limit_cs (ring, i, enable); + + } + }static const struct amd_ip_funcs gfx_v8_0_ip_funcs = {@@ -6943,7 +6989,8 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {VI_FLUSH_GPU_TLB_NUM_WREG *5 +7 +/* gfx_v8_0_ring_emit_vm_flush */ 7 +7 +7 +/* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */ 7 +/* gfx_v8_0_emit_mem_sync_compute */ - 5, /* gfx_v8_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ +5 +/* gfx_v8_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ + 15, /* for updating 3 mmSPI_WCL_PIPE_PERCENT_CS registers */ .emit_ib_size = 7, /* gfx_v8_0_ring_emit_ib_compute */ .emit_ib = gfx_v8_0_ring_emit_ib_compute, .emit_fence = gfx_v8_0_ring_emit_fence_compute,drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +32
-0@@ -6668,10 +6668,42 @@ static void gfx_v9_0_emit_mem_sync(struct amdgpu_ring *ring)amdgpu_ring_write (ring,0x0000000A );/* POLL_INTERVAL */ } +static void gfx_v9_0_emit_wave_limit_cs (struct amdgpu_ring *ring, +uint32_t pipe,bool enable) +{ +struct amdgpu_device *adev = ring->adev; +uint32_t val; +uint32_t wcl_cs_reg; + +/* mmSPI_WCL_PIPE_PERCENT_CS[0-7]_DEFAULT values are same */ + val = enable ?0x1 : mmSPI_WCL_PIPE_PERCENT_CS0_DEFAULT; + +switch (pipe) { +case 0 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS0); +break ; +case 1 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS1); +break ; +case 2 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS2); +break ; +case 3 : + wcl_cs_reg =SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_CS3); +break ; +default : +DRM_DEBUG ("invalid pipe %d\n" , pipe); +return ; + } + +amdgpu_ring_emit_wreg (ring, wcl_cs_reg, val); + +}static void gfx_v9_0_emit_wave_limit (struct amdgpu_ring *ring,bool enable) {struct amdgpu_device *adev = ring->adev;uint32_t val; +int i;/* mmSPI_WCL_PIPE_PERCENT_GFX is 7 bit multiplier register to limit drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable) · line 6723
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7
-0@@ -6682,6 +6714,17 @@ static void gfx_v9_0_emit_wave_limit(struct amdgpu_ring *ring, bool enable)amdgpu_ring_emit_wreg (ring,SOC15_REG_OFFSET (GC ,0 , mmSPI_WCL_PIPE_PERCENT_GFX), val); + +/* Restrict waves for normal/low priority compute queues as well +* to get best QoS for high priority compute jobs. +* +* amdgpu controls only 1st ME(0-3 CS pipes). +*/ +for (i =0 ; i <4 ; i++) {Same comment here.
Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6
-2+if (i != ring->pipe) +gfx_v9_0_emit_wave_limit_cs (ring, i, enable); + + } }static const struct amd_ip_funcs gfx_v9_0_ip_funcs = {@@ -6774,7 +6817,8 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {2 +/* gfx_v9_0_ring_emit_vm_flush */ 8 +8 +8 +/* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */ 7 +/* gfx_v9_0_emit_mem_sync */ - 5, /* gfx_v9_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ +5 +/* gfx_v9_0_emit_wave_limit for updating mmSPI_WCL_PIPE_PERCENT_GFX register */ + 15, /* for updating 3 mmSPI_WCL_PIPE_PERCENT_CS registers */ .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */ .emit_ib = gfx_v9_0_ring_emit_ib_compute, .emit_fence = gfx_v9_0_ring_emit_fence, --2.30.0
Quoted 4 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cnirmoy.das%40amd.com%7C94ee191a465b4aa441d008d8c864bde7%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637479682338092636%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g8wQEFZDuLBfYH8nzrKh6tPgbUqvnyHjM%2BrJHqvbybA%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx