[PATCH i-g-t v2 4/5] tests/xe_compute_preempt: adjust number of children according to ram size

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Apr 4 12:31:39 UTC 2025


Setting arbitrary number or children is prone to oom scenario and
getting test to be killed.

Single job with sip turned on takes ~100MB for Xe2 tasks so adjust
number of children to consume ~50% ram.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Francois Dugast <francois.dugast at intel.com>
Cc: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
---
 tests/intel/xe_compute_preempt.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tests/intel/xe_compute_preempt.c b/tests/intel/xe_compute_preempt.c
index 876e538237..f07e87d4c4 100644
--- a/tests/intel/xe_compute_preempt.c
+++ b/tests/intel/xe_compute_preempt.c
@@ -40,13 +40,18 @@ test_compute_preempt(int fd, struct drm_xe_engine_class_instance *hwe, bool thre
 	igt_require_f(run_intel_compute_kernel_preempt(fd, hwe, threadgroup_preemption), "GPU not supported\n");
 }
 
+#define CONTEXT_MB 100
+
 igt_main
 {
 	int xe;
 	struct drm_xe_engine_class_instance *hwe;
+	uint64_t ram_mb;
 
-	igt_fixture
+	igt_fixture {
 		xe = drm_open_driver(DRIVER_XE);
+		ram_mb = igt_get_avail_ram_mb();
+	}
 
 	igt_subtest_with_dynamic("compute-preempt") {
 		xe_for_each_engine(xe, hwe) {
@@ -64,13 +69,16 @@ igt_main
 				continue;
 
 			igt_dynamic_f("engine-%s", xe_engine_class_string(hwe->engine_class)) {
-				uint16_t dev_id = intel_get_drm_devid(xe);
 				int child_count;
 
-				if (IS_PANTHERLAKE(dev_id))
-					child_count = 50;
-				else
-					child_count = 100;
+				/*
+				 * Get half of ram / 2, then divide by
+				 * CONTEXT_MB * 2 (long and short) job
+				 */
+				child_count = ram_mb / 2 / CONTEXT_MB / 2;
+
+				igt_debug("RAM: %zd, child count: %d\n",
+					  ram_mb, child_count);
 
 				test_compute_preempt(xe, hwe, false);
 				igt_fork(child, child_count)
-- 
2.34.1



More information about the igt-dev mailing list