From 0c4e1c9efcf4c1730e73d6aade2232d596ad8dcf Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Wed, 2 Jul 2025 17:50:51 -0700 Subject: [PATCH] intel/common: Add helper for compute thread group dispatch size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recommended settings is just a guidance and not a programming requirement as per the Bspec. Signed-off-by: Sagar Ghuge Reviewed-by: José Roberto de Souza Part-of: --- src/intel/common/intel_common.c | 16 ++++++++++++++++ src/intel/common/intel_common.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/intel/common/intel_common.c b/src/intel/common/intel_common.c index 7ba0901002b..8c3053dc009 100644 --- a/src/intel/common/intel_common.c +++ b/src/intel/common/intel_common.c @@ -217,3 +217,19 @@ intel_compute_engine_async_threads_limit(const struct intel_device_info *devinfo *ret_z_pass_async_compute_thread_limit = z_pass_async_compute_thread_limit; *ret_np_z_async_throttle_settings = np_z_async_throttle_settings; } + +int +intel_compute_threads_group_dispatch_size(uint32_t hw_threads_in_wg) +{ + /* Following value calculated based on overdispatch is disabled. In case if + * compute overdispatch disabled set to 1, then we need to use TG Size 1. + */ + switch (hw_threads_in_wg) { + case 1 ... 16: + return 0; + case 17 ... 32: + return 1; + default: + return 2; + } +} diff --git a/src/intel/common/intel_common.h b/src/intel/common/intel_common.h index fafc9b4c590..1bf7cb08170 100644 --- a/src/intel/common/intel_common.h +++ b/src/intel/common/intel_common.h @@ -15,3 +15,6 @@ intel_compute_engine_async_threads_limit(const struct intel_device_info *devinfo uint8_t *ret_pixel_async_compute_thread_limit, uint8_t *ret_z_pass_async_compute_thread_limit, uint8_t *ret_np_z_async_throttle_settings); + +int +intel_compute_threads_group_dispatch_size(uint32_t hw_threads_in_wg);