drm/amdgpu/gfx7: align mqd settings with KFD
Subsystems (2)
Alex Deucher
maintainerPATCH 1/6 drm/amdgpu/gfx7: align mqd settings with KFD
Make sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -1
@@ -2819,6 +2819,7 @@ static void gfx_v7_0_mqd_init(struct amdgpu_device *adev, {u64 hqd_gpu_addr;u64 wb_gpu_addr; +u32 tmp;/* init the mqd struct */ memset (mqd,0 ,sizeof (struct cik_mqd ));
@@ -2923,7 +2924,11 @@ static void gfx_v7_0_mqd_init(struct amdgpu_device *adev, mqd->cp_hqd_atomic1_preop_lo =RREG32 (mmCP_HQD_ATOMIC1_PREOP_LO); mqd->cp_hqd_atomic1_preop_hi =RREG32 (mmCP_HQD_ATOMIC1_PREOP_HI); mqd->cp_hqd_pq_rptr =RREG32 (mmCP_HQD_PQ_RPTR); - mqd->cp_hqd_quantum =RREG32 (mmCP_HQD_QUANTUM); + tmp =RREG32 (mmCP_HQD_QUANTUM); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,10 ); + mqd->cp_hqd_quantum = tmp; mqd->cp_hqd_pipe_priority =RREG32 (mmCP_HQD_PIPE_PRIORITY); mqd->cp_hqd_queue_priority =RREG32 (mmCP_HQD_QUEUE_PRIORITY); mqd->cp_hqd_iq_rptr =RREG32 (mmCP_HQD_IQ_RPTR);
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 2/6 drm/amdgpu/gfx8: align mqd settings with KFD
Make sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -1
@@ -4532,7 +4532,11 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring)/* set static priority for a queue/ring */ gfx_v8_0_mqd_set_priority (ring, mqd); - mqd->cp_hqd_quantum =RREG32 (mmCP_HQD_QUANTUM); + tmp =RREG32 (mmCP_HQD_QUANTUM); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,10 ); + mqd->cp_hqd_quantum = tmp;/* map_queues packet doesn't need activate the queue, * so only kiq need set this field.
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 3/6 drm/amdgpu/gfx9: align mqd settings with KFD
In reply to Alex DeucherMake sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -1
@@ -3667,7 +3667,11 @@ static int gfx_v9_0_mqd_init(struct amdgpu_ring *ring)/* set static priority for a queue/ring */ gfx_v9_0_mqd_set_priority (ring, mqd); - mqd->cp_hqd_quantum =RREG32_SOC15 (GC ,0 , mmCP_HQD_QUANTUM); + tmp =RREG32_SOC15 (GC ,0 , mmCP_HQD_QUANTUM); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,1 ); + mqd->cp_hqd_quantum = tmp;/* map_queues packet doesn't need activate the queue, * so only kiq need set this field.
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 4/6 drm/amdgpu/gfx10: align mqd settings with KFD
In reply to Alex DeucherMake sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -0
@@ -7014,6 +7014,11 @@ static int gfx_v10_0_compute_mqd_init(struct amdgpu_device *adev, void *m, tmp =REG_SET_FIELD (tmp,CP_HQD_IB_CONTROL ,MIN_IB_AVAIL_SIZE ,3 ); mqd->cp_hqd_ib_control = tmp; + tmp =REG_SET_FIELD (0 ,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,1 ); + mqd->cp_hqd_quantum = tmp; +/* set static priority for a compute queue/ring */ mqd->cp_hqd_pipe_priority = prop->hqd_pipe_priority; mqd->cp_hqd_queue_priority = prop->hqd_queue_priority;
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 5/6 drm/amdgpu/gfx11: align mqd settings with KFD
In reply to Alex DeucherMake sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +5 -0
@@ -4408,6 +4408,11 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pipe_priority = prop->hqd_pipe_priority; mqd->cp_hqd_queue_priority = prop->hqd_queue_priority; + tmp =REG_SET_FIELD (0 ,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,1 ); + mqd->cp_hqd_quantum = tmp; + mqd->cp_hqd_active = prop->hqd_active;/* set UQ fenceaddress */
Signature · 1 line
2.53.0
Alex Deucher
maintainerPATCH 6/6 drm/amdgpu/gfx12: align mqd settings with KFD
In reply to Alex DeucherMake sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -0
@@ -3279,6 +3279,11 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pipe_priority = prop->hqd_pipe_priority; mqd->cp_hqd_queue_priority = prop->hqd_queue_priority; + tmp =REG_SET_FIELD (0 ,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,1 ); + mqd->cp_hqd_quantum = tmp; + mqd->cp_hqd_active = prop->hqd_active;/* set UQ fenceaddress */
Signature · 1 line
2.53.0
RE: [PATCH 6/6] drm/amdgpu/gfx12: align mqd settings with KFD
[AMD Official Use Only - AMD Internal Distribution Only]
Series is:
Reviewed-by:Jesse Zhang <[email protected]>
Should we enable this feature for SDMA?
Quoted 38 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, February 19, 2026 3:34 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 6/6] drm/amdgpu/gfx12: align mqd settings with KFDMake sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5
-0@@ -3279,6 +3279,11 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pipe_priority = prop->hqd_pipe_priority; mqd->cp_hqd_queue_priority = prop->hqd_queue_priority; + tmp =REG_SET_FIELD (0 ,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,1 ); + mqd->cp_hqd_quantum = tmp; +mqd->cp_hqd_active = prop->hqd_active; /* set UQ fenceaddress */--
2.53.0
Ping on this series.
Alex
Quoted 37 lines · Alex Deucher
Make sure to set the quantum bits in the compute MQD for better fairness across queues of the same priority.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6
-2@@ -2819,6 +2819,7 @@ static void gfx_v7_0_mqd_init(struct amdgpu_device *adev, {u64 hqd_gpu_addr;u64 wb_gpu_addr; +u32 tmp;/* init the mqd struct */ memset (mqd,0 ,sizeof (struct cik_mqd ));@@ -2923,7 +2924,11 @@ static void gfx_v7_0_mqd_init(struct amdgpu_device *adev, mqd->cp_hqd_atomic1_preop_lo =RREG32 (mmCP_HQD_ATOMIC1_PREOP_LO); mqd->cp_hqd_atomic1_preop_hi =RREG32 (mmCP_HQD_ATOMIC1_PREOP_HI); mqd->cp_hqd_pq_rptr =RREG32 (mmCP_HQD_PQ_RPTR); - mqd->cp_hqd_quantum =RREG32 (mmCP_HQD_QUANTUM); + tmp =RREG32 (mmCP_HQD_QUANTUM); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_EN ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_SCALE ,1 ); + tmp =REG_SET_FIELD (tmp,CP_HQD_QUANTUM ,QUANTUM_DURATION ,10 ); + mqd->cp_hqd_quantum = tmp; mqd->cp_hqd_pipe_priority =RREG32 (mmCP_HQD_PIPE_PRIORITY); mqd->cp_hqd_queue_priority =RREG32 (mmCP_HQD_QUEUE_PRIORITY); mqd->cp_hqd_iq_rptr =RREG32 (mmCP_HQD_IQ_RPTR); --2.53.0