Skip to content

Commit e3de58f

Browse files
rajbharalexdeucher
authored andcommitted
drm/amdkfd: update SIMD distribution algo for GFXIP 9.4.2 onwards
In certain cooperative group dispatch scenarios the default SPI resource allocation may cause reduced per-CU workgroup occupancy. Set COMPUTE_RESOURCE_LIMITS.FORCE_SIMD_DIST=1 to mitigate soft hang scenarions. Reviewed-by: Felix Kuehling <[email protected]> Suggested-by: Joseph Greathouse <[email protected]> Signed-off-by: Rajneesh Bhardwaj <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 0d555e4 commit e3de58f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,15 @@ static void update_mqd(struct mqd_manager *mm, void *mqd,
303303
update_cu_mask(mm, mqd, minfo, 0);
304304
set_priority(m, q);
305305

306+
if (minfo && KFD_GC_VERSION(mm->dev) >= IP_VERSION(9, 4, 2)) {
307+
if (minfo->update_flag & UPDATE_FLAG_IS_GWS)
308+
m->compute_resource_limits |=
309+
COMPUTE_RESOURCE_LIMITS__FORCE_SIMD_DIST_MASK;
310+
else
311+
m->compute_resource_limits &=
312+
~COMPUTE_RESOURCE_LIMITS__FORCE_SIMD_DIST_MASK;
313+
}
314+
306315
q->is_active = QUEUE_IS_ACTIVE(*q);
307316
}
308317

drivers/gpu/drm/amd/amdkfd/kfd_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ struct queue_properties {
532532
enum mqd_update_flag {
533533
UPDATE_FLAG_DBG_WA_ENABLE = 1,
534534
UPDATE_FLAG_DBG_WA_DISABLE = 2,
535+
UPDATE_FLAG_IS_GWS = 4, /* quirk for gfx9 IP */
535536
};
536537

537538
struct mqd_update_info {

drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd)
9595
int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
9696
void *gws)
9797
{
98+
struct mqd_update_info minfo = {0};
9899
struct kfd_node *dev = NULL;
99100
struct process_queue_node *pqn;
100101
struct kfd_process_device *pdd;
@@ -146,9 +147,10 @@ int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
146147
}
147148

148149
pdd->qpd.num_gws = gws ? dev->adev->gds.gws_size : 0;
150+
minfo.update_flag = gws ? UPDATE_FLAG_IS_GWS : 0;
149151

150152
return pqn->q->device->dqm->ops.update_queue(pqn->q->device->dqm,
151-
pqn->q, NULL);
153+
pqn->q, &minfo);
152154
}
153155

154156
void kfd_process_dequeue_from_all_devices(struct kfd_process *p)

0 commit comments

Comments
 (0)