Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/xe_create: Unthread create-execqueues tests
@ 2023-12-05 21:10 Jonathan Cavitt
  2023-12-05 22:26 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Cavitt @ 2023-12-05 21:10 UTC (permalink / raw)
  To: igt-dev; +Cc: lucas.demarchi, jonathan.cavitt, saurabhg.gupta

The inclusion of igt_fork in the test is designed to improve performance
by multithreading the process of execqueue creation.  However, after
each execqueue is created on a thread, a context switch appears to occur,
causing all the execqueues created for that thread to be stored in memory
and all the execqueues for the other thread to be loaded.  At scale, the
delays caused by repeated memory loads and unloads actually cause a
reduction in performance, and as such it's actually more performant to
create the execqueues serially rather than rely on forking.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
CC: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
CC: Kamil Konieczny <kamil.konieczny@linux.intel.com>
CC: Lucas de Marchi <lucas.demarchi@intel.com>
CC: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
---
 tests/intel/xe_create.c | 51 +++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 30 deletions(-)

diff --git a/tests/intel/xe_create.c b/tests/intel/xe_create.c
index bbdddc7c9b..f4a80aa155 100644
--- a/tests/intel/xe_create.c
+++ b/tests/intel/xe_create.c
@@ -136,47 +136,38 @@ static uint32_t __xe_exec_queue_create(int fd, uint32_t vm,
 static void create_execqueues(int fd, enum exec_queue_destroy ed)
 {
 	struct timespec tv = { };
-	uint32_t num_engines, exec_queues_per_process, vm;
-	int nproc = sysconf(_SC_NPROCESSORS_ONLN), seconds;
+	struct drm_xe_engine *engine;
+	uint32_t num_engines, vm;
+	int idx, err, i, seconds;
+	uint32_t exec_queue, exec_queues[MAXEXECQUEUES];
 
 	fd = drm_reopen_driver(fd);
 	num_engines = xe_number_engines(fd);
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
-	exec_queues_per_process = max_t(uint32_t, 1, MAXEXECQUEUES / nproc);
-	igt_debug("nproc: %u, exec_queues per process: %u\n", nproc, exec_queues_per_process);
 
 	igt_nsec_elapsed(&tv);
 
-	igt_fork(n, nproc) {
-		struct drm_xe_engine *engine;
-		uint32_t exec_queue, exec_queues[exec_queues_per_process];
-		int idx, err, i;
-
-		srandom(n);
-
-		for (i = 0; i < exec_queues_per_process; i++) {
-			idx = rand() % num_engines;
-			engine = xe_engine(fd, idx);
-			err = __xe_exec_queue_create(fd, vm, &engine->instance,
-						     0, &exec_queue);
-			igt_debug("[%2d] Create exec_queue: err=%d, exec_queue=%u [idx = %d]\n",
-				  n, err, exec_queue, i);
-			if (err)
-				break;
-
-			if (ed == NOLEAK)
-				exec_queues[i] = exec_queue;
-		}
+	for (i = 0; i < MAXEXECQUEUES; i++) {
+		idx = rand() % num_engines;
+		engine = xe_engine(fd, idx);
+		err = __xe_exec_queue_create(fd, vm, &engine->instance,
+					     0, &exec_queue);
+		igt_debug("Create exec_queue: err=%d, exec_queue=%u [idx = %d]\n",
+			  err, exec_queue, i);
+		if (err)
+			break;
+
+		if (ed == NOLEAK)
+			exec_queues[i] = exec_queue;
+	}
 
-		if (ed == NOLEAK) {
-			while (--i >= 0) {
-				igt_debug("[%2d] Destroy exec_queue: %u\n", n, exec_queues[i]);
-				xe_exec_queue_destroy(fd, exec_queues[i]);
-			}
+	if (ed == NOLEAK) {
+		while (--i >= 0) {
+			igt_debug("Destroy exec_queue: %u\n", exec_queues[i]);
+			xe_exec_queue_destroy(fd, exec_queues[i]);
 		}
 	}
-	igt_waitchildren();
 
 	xe_vm_destroy(fd, vm);
 	drm_close_driver(fd);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-07  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 21:10 [igt-dev] [PATCH i-g-t] tests/xe_create: Unthread create-execqueues tests Jonathan Cavitt
2023-12-05 22:26 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2023-12-05 23:49 ` [igt-dev] ✗ CI.xeBAT: " Patchwork
2023-12-07  7:39 ` [igt-dev] [PATCH i-g-t] " Zbigniew Kempczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox