Skip to contentSkip to conversation

tests/xe_evict_ccs:Add check to update object param

PATCH In review Sobin Thomas 2 participants 3 messages Jul 23, 2025 – Jul 28, 2025

lore
Share & tools
lore
#0 lore raw

cover tests/xe_evict_ccs:Add check to update object param

This change will modify the parameters for the test based on the available visible ram and update the max object size that is calculated based on the existing method
This change is needed to dynamically change the object size as per the visible RAM size of the platform.

Sobin Thomas (1):
tests/xe_evict_ccs:Add check to update object param as per visible RAM

 tests/intel/xe_evict_ccs.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 tests/xe_evict_ccs:Add check to update object param as per visible RAM

This change will modify the parameters for the test based on the available visible ram and update the max object size that is calculated based on the existing method

---
 tests/intel/xe_evict_ccs.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tests/intel/xe_evict_ccs.c +26 -0
index 281d27015..9abff1389 100644
@@ -343,6 +343,31 @@ static void set_config(int fd, uint32_t flags, const struct param *param,
 	igt_debug("nproc: %d, mem per proc: %dMB\n", nproc, config->mb_per_proc);
 }
 
+static void adjust_params_for_vram_size(uint64_t vram_size)
+{
+	uint64_t vram_mb = vram_size / (1024 * 1024);
+	int recommended_max_size_kb;
+	bool user_set_max_size = (params.max_size_kb != MAX_OBJ_KB);
+	int max_object_mb = vram_mb / 64;
+
+	max_object_mb = max_t(int, 2, min_t(int, max_object_mb, 256));
+	recommended_max_size_kb = max_object_mb * 1024;
+
+	igt_info("VRAM (%"PRIu64"MB): Calculated %d%% usage, %dMB max objects\n",
+		 vram_mb, params.vram_percent, max_object_mb);
+
+	if (user_set_max_size) {
+		igt_warn("User specified max object size (%dKB) may not be
+				optimal for %"PRIu64"MB VRAM (recommended: %dKB)\n",
+				params.max_size_kb, vram_mb, recommended_max_size_kb);
+	} else {
+		params.max_size_kb = recommended_max_size_kb;
+	}
+
+	igt_info("Final settings: %d%% VRAM, %dMB max object\n",
+		 params.vram_percent, params.max_size_kb / 1024);
+}
+
 static void evict_ccs(int fd, uint32_t flags, const struct param *param)
 {
 	struct config config;
@@ -500,6 +525,7 @@ igt_main_args("bdDn:p:s:S:V", NULL, help_str, opt_handler, NULL)
 		igt_require(xe_has_vram(fd));
 		vram_size = xe_visible_vram_size(fd, 0);
 		igt_assert(vram_size);
+		adjust_params_for_vram_size(vram_size);
 		has_flatccs = HAS_FLATCCS(intel_get_drm_devid(fd));
 	}
 
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH i-g-t 1/1] tests/xe_evict_ccs:Add check to update object param as per visible RAM

Hi Sobin,
On 2025-07-23 at 15:05:08 +0000, Sobin Thomas wrote:

I have few nits, first about subject:

[PATCH i-g-t 1/1] tests/xe_evict_ccs:Add check to update object param as per visible RAM

imho better:

[PATCH i-g-t 1/1] tests/intel/xe_evict_ccs: Ajust object size

Quoted 3 lines

This change will modify the parameters for the test based on the available visible ram and update the max object size that is calculated based on the existing method

Rather then translating C-code into english, write here why and when change is needed, also is this a fix for some VRAM versus SRAM scenarios? What problem are you solving?

Quoted 11 lines
---
 tests/intel/xe_evict_ccs.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tests/intel/xe_evict_ccs.c +0 -0
index 281d27015..9abff1389 100644

tests/intel/xe_evict_ccs.c static void set_config(int fd, uint32_t flags, const struct param *param, · line 351

Quoted 9 lines
tests/intel/xe_evict_ccs.c +6 -0
@@ -343,6 +343,31 @@ static void set_config(int fd, uint32_t flags, const struct param *param,
 	igt_debug("nproc: %d, mem per proc: %dMB\n", nproc, config->mb_per_proc);
 }
 
+static void adjust_params_for_vram_size(uint64_t vram_size)
+{
+	uint64_t vram_mb = vram_size / (1024 * 1024);
+	int recommended_max_size_kb;
+	bool user_set_max_size = (params.max_size_kb != MAX_OBJ_KB);
+	int max_object_mb = vram_mb / 64;

Why '64' is used here? If that is used also elsewhere make it a define.

Regards,
Kamil

Quoted 33 lines
tests/intel/xe_evict_ccs.c +20 -0
+
+	max_object_mb = max_t(int, 2, min_t(int, max_object_mb, 256));
+	recommended_max_size_kb = max_object_mb * 1024;
+
+	igt_info("VRAM (%"PRIu64"MB): Calculated %d%% usage, %dMB max objects\n",
+		 vram_mb, params.vram_percent, max_object_mb);
+
+	if (user_set_max_size) {
+		igt_warn("User specified max object size (%dKB) may not be
+				optimal for %"PRIu64"MB VRAM (recommended: %dKB)\n",
+				params.max_size_kb, vram_mb, recommended_max_size_kb);
+	} else {
+		params.max_size_kb = recommended_max_size_kb;
+	}
+
+	igt_info("Final settings: %d%% VRAM, %dMB max object\n",
+		 params.vram_percent, params.max_size_kb / 1024);
+}
+
 static void evict_ccs(int fd, uint32_t flags, const struct param *param)
 {
 	struct config config;
@@ -500,6 +525,7 @@ igt_main_args("bdDn:p:s:S:V", NULL, help_str, opt_handler, NULL)
 		igt_require(xe_has_vram(fd));
 		vram_size = xe_visible_vram_size(fd, 0);
 		igt_assert(vram_size);
+		adjust_params_for_vram_size(vram_size);
 		has_flatccs = HAS_FLATCCS(intel_get_drm_devid(fd));
 	}
 
Signature · 1 line
2.34.1