panfrost: make RUN_COMPUTE.ep_limit configurable

Since v12, RUN_COMPUTE.ep_limit specifies the size of the compute task
queue.  RUN_COMPUTE stalls when there are more tasks in the queue than
the specified ep_limit.

Sensible values are 0 (treated as 4), 4, or 16 (max_tasks_per_core).

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Tested-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37988>
This commit is contained in:
Chia-I Wu
2025-10-20 15:55:19 -07:00
committed by Marge Bot
parent c696ec3b73
commit bcd2e62ad0
4 changed files with 29 additions and 2 deletions
+13
View File
@@ -116,6 +116,9 @@ struct cs_builder_conf {
/* Number of 32-bit registers used by the kernel at submission time */
uint8_t nr_kernel_registers;
/* RUN_COMPUTE.ep_limit. Must be 0 before v12. */
uint8_t compute_ep_limit;
/* CS buffer allocator */
struct cs_buffer (*alloc_buffer)(void *cookie);
@@ -1528,6 +1531,11 @@ cs_run_compute(struct cs_builder *b, unsigned task_increment,
cs_emit(b, RUN_COMPUTE, I) {
I.task_increment = task_increment;
I.task_axis = task_axis;
#if PAN_ARCH >= 12
I.ep_limit = b->conf.compute_ep_limit;
#else
assert(b->conf.compute_ep_limit == 0);
#endif
I.srt_select = res_sel.srt;
I.spd_select = res_sel.spd;
I.tsd_select = res_sel.tsd;
@@ -2070,6 +2078,11 @@ cs_run_compute_indirect(struct cs_builder *b, unsigned wg_per_task,
cs_emit(b, RUN_COMPUTE_INDIRECT, I) {
I.workgroups_per_task = wg_per_task;
#if PAN_ARCH >= 12
I.ep_limit = b->conf.compute_ep_limit;
#else
assert(b->conf.compute_ep_limit == 0);
#endif
I.srt_select = res_sel.srt;
I.spd_select = res_sel.spd;
I.tsd_select = res_sel.tsd;
+14
View File
@@ -147,10 +147,17 @@ print_cs_instr(FILE *fp, const uint64_t *instr)
/* Print the instruction. Ignore the selects and the flags override
* since we'll print them implicitly later.
*/
#if PAN_ARCH >= 12
fprintf(fp, "RUN_COMPUTE%s.%s.srt%d.spd%d.tsd%d.fau%d #%u, #%u",
I.progress_increment ? ".progress_inc" : "", axes[I.task_axis],
I.srt_select, I.spd_select, I.tsd_select, I.fau_select,
I.task_increment, I.ep_limit);
#else
fprintf(fp, "RUN_COMPUTE%s.%s.srt%d.spd%d.tsd%d.fau%d #%u",
I.progress_increment ? ".progress_inc" : "", axes[I.task_axis],
I.srt_select, I.spd_select, I.tsd_select, I.fau_select,
I.task_increment);
#endif
break;
}
@@ -572,9 +579,16 @@ print_cs_instr(FILE *fp, const uint64_t *instr)
case MALI_CS_OPCODE_RUN_COMPUTE_INDIRECT: {
cs_unpack(instr, CS_RUN_COMPUTE_INDIRECT, I);
#if PAN_ARCH >= 12
fprintf(fp, "RUN_COMPUTE_INDIRECT%s.srt%d.spd%d.tsd%d.fau%d #%u, #%u",
I.progress_increment ? ".progress_inc" : "", I.srt_select,
I.spd_select, I.tsd_select, I.fau_select, I.workgroups_per_task,
I.ep_limit);
#else
fprintf(fp, "RUN_COMPUTE_INDIRECT%s.srt%d.spd%d.tsd%d.fau%d #%u",
I.progress_increment ? ".progress_inc" : "", I.srt_select,
I.spd_select, I.tsd_select, I.fau_select, I.workgroups_per_task);
#endif
break;
}
+1 -1
View File
@@ -831,7 +831,7 @@
<struct name="CS RUN_COMPUTE_INDIRECT" size="2">
<field name="Workgroups Per Task" size="16" start="0" type="uint"/>
<field name="Endpoint Limit" size="8" start="16" type="uint"/>
<field name="Ep Limit" size="8" start="16" type="uint"/>
<field name="Progress Increment" size="1" start="32" type="CS Progress Increment" default="No Increment"/>
<field name="SRT Select" size="2" start="40" type="uint"/>
<field name="SPD Select" size="2" start="42" type="uint"/>
+1 -1
View File
@@ -911,7 +911,7 @@
<struct name="CS RUN_COMPUTE_INDIRECT" size="2">
<field name="Workgroups Per Task" size="16" start="0" type="uint"/>
<field name="Endpoint Limit" size="8" start="16" type="uint"/>
<field name="Ep Limit" size="8" start="16" type="uint"/>
<field name="Progress Increment" size="1" start="32" type="CS Progress Increment" default="No Increment"/>
<field name="SRT Select" size="2" start="40" type="uint"/>
<field name="SPD Select" size="2" start="42" type="uint"/>