From bcd2e62ad0364f3d41176ce5f054b23d30c02991 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 20 Oct 2025 15:55:19 -0700 Subject: [PATCH] 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 Tested-by: Yiwei Zhang Reviewed-by: Christoph Pillmayer Part-of: --- src/panfrost/genxml/cs_builder.h | 13 +++++++++++++ src/panfrost/genxml/decode_csf.c | 14 ++++++++++++++ src/panfrost/genxml/v12.xml | 2 +- src/panfrost/genxml/v13.xml | 2 +- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/panfrost/genxml/cs_builder.h b/src/panfrost/genxml/cs_builder.h index b52957e0147..bd56425da5d 100644 --- a/src/panfrost/genxml/cs_builder.h +++ b/src/panfrost/genxml/cs_builder.h @@ -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; diff --git a/src/panfrost/genxml/decode_csf.c b/src/panfrost/genxml/decode_csf.c index b76acb0a952..f9cac452282 100644 --- a/src/panfrost/genxml/decode_csf.c +++ b/src/panfrost/genxml/decode_csf.c @@ -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; } diff --git a/src/panfrost/genxml/v12.xml b/src/panfrost/genxml/v12.xml index 842ab430322..107600e9fbf 100644 --- a/src/panfrost/genxml/v12.xml +++ b/src/panfrost/genxml/v12.xml @@ -831,7 +831,7 @@ - + diff --git a/src/panfrost/genxml/v13.xml b/src/panfrost/genxml/v13.xml index 32135cc53b0..a9feb530361 100644 --- a/src/panfrost/genxml/v13.xml +++ b/src/panfrost/genxml/v13.xml @@ -911,7 +911,7 @@ - +