[PATCH i-g-t v3 5/5] tests/xe_compute_preempt: consume all ram for wmtp

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Apr 8 18:50:45 UTC 2025


When swap exists on the platform lets try to consume whole ram
triggering wmtp and eviction.

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 | 36 +++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/intel/xe_compute_preempt.c b/tests/intel/xe_compute_preempt.c
index f07e87d4c4..43ffb8dba3 100644
--- a/tests/intel/xe_compute_preempt.c
+++ b/tests/intel/xe_compute_preempt.c
@@ -29,6 +29,12 @@
  * Description:
  *      Exercise multiple walker mid thread preemption scenario
  *
+ * SUBTEST: compute-preempt-many-all-ram
+ * GPU requirement: LNL, PTL
+ * Description:
+ *      Exercise multiple walker mid thread preemption scenario consuming
+ *      whole ram only when there's swap on the machine
+ *
  * SUBTEST: compute-threadgroup-preempt
  * GPU requirement: LNL, PTL
  * Description:
@@ -46,11 +52,12 @@ igt_main
 {
 	int xe;
 	struct drm_xe_engine_class_instance *hwe;
-	uint64_t ram_mb;
+	uint64_t ram_mb, swap_mb;
 
 	igt_fixture {
 		xe = drm_open_driver(DRIVER_XE);
 		ram_mb = igt_get_avail_ram_mb();
+		swap_mb = igt_get_total_swap_mb();
 	}
 
 	igt_subtest_with_dynamic("compute-preempt") {
@@ -88,6 +95,33 @@ igt_main
 		}
 	}
 
+	igt_subtest_with_dynamic("compute-preempt-many-all-ram") {
+		igt_require(swap_mb > CONTEXT_MB * 10);
+
+		xe_for_each_engine(xe, hwe) {
+			if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COMPUTE)
+				continue;
+
+			igt_dynamic_f("engine-%s", xe_engine_class_string(hwe->engine_class)) {
+				int child_count;
+
+				/*
+				 * Get whole ram, then divide by
+				 * CONTEXT_MB * 2 (long and short) job
+				 */
+				child_count = ram_mb / 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)
+					test_compute_preempt(xe, hwe, false);
+				igt_waitchildren();
+			}
+		}
+	}
+
 	igt_subtest_with_dynamic("compute-threadgroup-preempt") {
 		xe_for_each_engine(xe, hwe) {
 			if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COMPUTE)
-- 
2.34.1



More information about the igt-dev mailing list