From e0af347791cffe00e18ffd7ba38543ab75f1538b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Mon, 8 Apr 2024 10:39:25 -0700 Subject: [PATCH] intel/common: Implement preferred SLM encode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Preferred SLM has a different encode than SLM allocation size so adding a function just to encode it, functions call to this new function will be added in the next patches. BSpec: 64042 BSpec: 68700 Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/common/intel_compute_slm.c | 41 ++++++++++++++++++++++++++++ src/intel/common/intel_compute_slm.h | 1 + 2 files changed, 42 insertions(+) diff --git a/src/intel/common/intel_compute_slm.c b/src/intel/common/intel_compute_slm.c index 9e3ec56d7c2..4c381e48e54 100644 --- a/src/intel/common/intel_compute_slm.c +++ b/src/intel/common/intel_compute_slm.c @@ -112,3 +112,44 @@ intel_compute_slm_encode_size(unsigned gen, uint32_t bytes) return slm_size; } + +/* encode = 0 sets to largest SLM size supported in subslice */ +static struct slm_encode preferred_slm_allocation_size_table[] = { + { .encode = 0x8, .size_in_kb = 0, }, + { .encode = 0x9, .size_in_kb = 16, }, + { .encode = 0xa, .size_in_kb = 32, }, + { .encode = 0xb, .size_in_kb = 64, }, + { .encode = 0xc, .size_in_kb = 96, }, + { .encode = 0xd, .size_in_kb = 128, }, +}; + +static struct slm_encode xe2_preferred_slm_allocation_size_table[] = { + { .encode = 0x0, .size_in_kb = 0, }, + { .encode = 0x1, .size_in_kb = 16, }, + { .encode = 0x2, .size_in_kb = 32, }, + { .encode = 0x3, .size_in_kb = 64, }, + { .encode = 0x4, .size_in_kb = 96, }, + { .encode = 0x5, .size_in_kb = 128, }, + { .encode = 0x6, .size_in_kb = 160, }, + { .encode = 0x7, .size_in_kb = 192, }, + { .encode = 0x8, .size_in_kb = 224, }, + { .encode = 0x9, .size_in_kb = 256, }, + { .encode = 0xA, .size_in_kb = 384, }, +}; + +uint32_t +intel_compute_preferred_slm_encode_size(unsigned gen, uint32_t bytes) +{ + struct slm_encode *table; + unsigned int table_len; + + if (gen >= 20) { + table = xe2_preferred_slm_allocation_size_table; + table_len = ARRAY_SIZE(xe2_preferred_slm_allocation_size_table); + } else { + table = preferred_slm_allocation_size_table; + table_len = ARRAY_SIZE(preferred_slm_allocation_size_table); + } + + return slm_encode_lookup(table, table_len, bytes)->encode; +} diff --git a/src/intel/common/intel_compute_slm.h b/src/intel/common/intel_compute_slm.h index 56866110cf1..471ad7f984a 100644 --- a/src/intel/common/intel_compute_slm.h +++ b/src/intel/common/intel_compute_slm.h @@ -9,3 +9,4 @@ uint32_t intel_compute_slm_calculate_size(unsigned gen, uint32_t bytes); uint32_t intel_compute_slm_encode_size(unsigned gen, uint32_t bytes); +uint32_t intel_compute_preferred_slm_encode_size(unsigned gen, uint32_t bytes);