All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 4/5] tests: Instrument tests run in simulation to run quickly
Date: Tue, 26 Mar 2013 15:24:38 +0000	[thread overview]
Message-ID: <1364311479-20669-5-git-send-email-damien.lespiau@intel.com> (raw)
In-Reply-To: <1364311479-20669-1-git-send-email-damien.lespiau@intel.com>

We tweak the tests marked as runnable in simulation to run more quickly,
more often then not at the expense of stress testing (which is of an
arguable interest for the initial bring up in simulation). Hopefully the
values chosen still test something, which is not always straightforward.

It does run quickly, the number on an IVB machines are:

$ time sudo IGT_SIMULATION=0 ./piglit-run.py tests/igt.tests foo
[...]
real	2m0.141s
user	0m16.365s
sys	1m33.382s

Vs.

$ time sudo IGT_SIMULATION=1 ./piglit-run.py tests/igt.tests foo
[...]
real	0m0.448s
user	0m0.226s
sys	0m0.183s

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tests/gem_cpu_reloc.c               | 3 +++
 tests/gem_ctx_basic.c               | 5 +++++
 tests/gem_exec_nop.c                | 2 +-
 tests/gem_mmap_gtt.c                | 5 ++++-
 tests/gem_pipe_control_store_loop.c | 2 +-
 tests/gem_render_linear_blits.c     | 6 ++++++
 tests/gem_ring_sync_loop.c          | 2 +-
 tests/gem_storedw_batches_loop.c    | 8 +++++---
 tests/gem_storedw_loop_blt.c        | 8 +++++---
 tests/gem_storedw_loop_bsd.c        | 8 +++++---
 tests/gem_storedw_loop_render.c     | 8 +++++---
 tests/gem_tiled_blits.c             | 6 ++++++
 12 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/tests/gem_cpu_reloc.c b/tests/gem_cpu_reloc.c
index baf8301..ad70e40 100644
--- a/tests/gem_cpu_reloc.c
+++ b/tests/gem_cpu_reloc.c
@@ -153,6 +153,9 @@ int main(int argc, char **argv)
 	}
 
 	count = aper_size / 4096 * 2;
+	if (drmtest_run_in_simulation())
+		count = 10;
+
 	handles = malloc (count * sizeof(uint32_t));
 	assert(handles);
 
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c
index 3757d84..729c79c 100644
--- a/tests/gem_ctx_basic.c
+++ b/tests/gem_ctx_basic.c
@@ -143,6 +143,11 @@ int main(int argc, char *argv[])
 	fd = drm_open_any();
 	devid = intel_get_drm_devid(fd);
 
+	if (drmtest_run_in_simulation()) {
+		num_contexts = 2;
+		iter = 4;
+	}
+
 	parse(argc, argv);
 
 	threads = calloc(num_contexts, sizeof(*threads));
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 8608592..2307983 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -95,7 +95,7 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam
 
 	skipped_all = false;
 
-	for (count = 1; count <= 1<<17; count <<= 1) {
+	for (count = 1; count <= SLOW_QUICK(1<<17, 1<<4); count <<= 1) {
 		struct timeval start, end;
 
 		gettimeofday(&start, NULL);
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index d759340..e53a942 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -40,7 +40,7 @@
 #include "i915_drm.h"
 #include "drmtest.h"
 
-#define OBJECT_SIZE (16*1024*1024)
+static int OBJECT_SIZE = 16*1024*1024;
 
 static void set_domain(int fd, uint32_t handle)
 {
@@ -148,6 +148,9 @@ int main(int argc, char **argv)
 {
 	int fd;
 
+	if (drmtest_run_in_simulation())
+		OBJECT_SIZE = 1 * 1024 * 1024;
+
 	drmtest_subtest_init(argc, argv);
 
 	fd = drm_open_any();
diff --git a/tests/gem_pipe_control_store_loop.c b/tests/gem_pipe_control_store_loop.c
index e03cddd..af6a758 100644
--- a/tests/gem_pipe_control_store_loop.c
+++ b/tests/gem_pipe_control_store_loop.c
@@ -70,7 +70,7 @@ store_pipe_control_loop(void)
 	uint32_t *buf;
 	drm_intel_bo *target_bo;
 
-	for (i = 0; i < 0x10000; i++) {
+	for (i = 0; i < SLOW_QUICK(0x10000, 4); i++) {
 		/* we want to check tlb consistency of the pipe_control target,
 		 * so get a new buffer every time around */
 		target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index a7e0189..c94f451 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -81,8 +81,11 @@ int main(int argc, char **argv)
 	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
 
 	count = 0;
+	if (drmtest_run_in_simulation())
+		count = 2;
 	if (argc > 1)
 		count = atoi(argv[1]);
+
 	if (count == 0)
 		count = 3 * gem_aperture_size(fd) / SIZE / 2;
 	else if (count < 2) {
@@ -127,6 +130,9 @@ int main(int argc, char **argv)
 	for (i = 0; i < count; i++)
 		check_bo(fd, bo[i]->handle, start_val[i]);
 
+	if (drmtest_run_in_simulation())
+		return 0;
+
 	printf("Cyclic blits, backward...\n");
 	for (i = 0; i < count * 4; i++) {
 		struct scratch_buf src, dst;
diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c
index b689bcd..6ba1052 100644
--- a/tests/gem_ring_sync_loop.c
+++ b/tests/gem_ring_sync_loop.c
@@ -62,7 +62,7 @@ store_dword_loop(void)
 
 	srandom(0xdeadbeef);
 
-	for (i = 0; i < 0x100000; i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 10); i++) {
 		int ring = random() % 3 + 1;
 
 		if (ring == I915_EXEC_RENDER) {
diff --git a/tests/gem_storedw_batches_loop.c b/tests/gem_storedw_batches_loop.c
index 86c3469..7d07c59 100644
--- a/tests/gem_storedw_batches_loop.c
+++ b/tests/gem_storedw_batches_loop.c
@@ -60,7 +60,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < SLOW_QUICK(0x80000, 0x10); i++) {
+	for (i = 0; i < SLOW_QUICK(0x80000, 4); i++) {
 		cmd_bo = drm_intel_bo_alloc(bufmgr, "cmd bo", 4096, 4096);
 		if (!cmd_bo) {
 			fprintf(stderr, "failed to alloc cmd bo\n");
@@ -170,8 +170,10 @@ int main(int argc, char **argv)
 
 	store_dword_loop(1);
 	store_dword_loop(2);
-	store_dword_loop(3);
-	store_dword_loop(5);
+	if (!drmtest_run_in_simulation()) {
+		store_dword_loop(3);
+		store_dword_loop(5);
+	}
 
 	drm_intel_bo_unreference(target_bo);
 	drm_intel_bufmgr_destroy(bufmgr);
diff --git a/tests/gem_storedw_loop_blt.c b/tests/gem_storedw_loop_blt.c
index cacae3a..dfb613b 100644
--- a/tests/gem_storedw_loop_blt.c
+++ b/tests/gem_storedw_loop_blt.c
@@ -63,7 +63,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < SLOW_QUICK(0x100000, 0x10); i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 4); i++) {
 		BEGIN_BATCH(4);
 		OUT_BATCH(cmd);
 		OUT_BATCH(0); /* reserved */
@@ -150,8 +150,10 @@ int main(int argc, char **argv)
 
 	store_dword_loop(1);
 	store_dword_loop(2);
-	store_dword_loop(3);
-	store_dword_loop(5);
+	if (!drmtest_run_in_simulation()) {
+		store_dword_loop(3);
+		store_dword_loop(5);
+	}
 
 	drm_intel_bo_unreference(target_buffer);
 	intel_batchbuffer_free(batch);
diff --git a/tests/gem_storedw_loop_bsd.c b/tests/gem_storedw_loop_bsd.c
index 232c3a6..6aefb9a 100644
--- a/tests/gem_storedw_loop_bsd.c
+++ b/tests/gem_storedw_loop_bsd.c
@@ -63,7 +63,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < SLOW_QUICK(0x100000, 0x10); i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 4); i++) {
 		BEGIN_BATCH(4);
 		OUT_BATCH(cmd);
 		OUT_BATCH(0); /* reserved */
@@ -156,8 +156,10 @@ int main(int argc, char **argv)
 
 	store_dword_loop(1);
 	store_dword_loop(2);
-	store_dword_loop(3);
-	store_dword_loop(5);
+	if (!drmtest_run_in_simulation()) {
+		store_dword_loop(3);
+		store_dword_loop(5);
+	}
 
 	drm_intel_bo_unreference(target_buffer);
 	intel_batchbuffer_free(batch);
diff --git a/tests/gem_storedw_loop_render.c b/tests/gem_storedw_loop_render.c
index fe09834..e41ecc7 100644
--- a/tests/gem_storedw_loop_render.c
+++ b/tests/gem_storedw_loop_render.c
@@ -63,7 +63,7 @@ store_dword_loop(int divider)
 	if (!has_ppgtt)
 		cmd |= MI_MEM_VIRTUAL;
 
-	for (i = 0; i < SLOW_QUICK(0x100000, 0x10); i++) {
+	for (i = 0; i < SLOW_QUICK(0x100000, 4); i++) {
 		BEGIN_BATCH(4);
 		OUT_BATCH(cmd);
 		OUT_BATCH(0); /* reserved */
@@ -144,8 +144,10 @@ int main(int argc, char **argv)
 
 	store_dword_loop(1);
 	store_dword_loop(2);
-	store_dword_loop(3);
-	store_dword_loop(5);
+	if (!drmtest_run_in_simulation()) {
+		store_dword_loop(3);
+		store_dword_loop(5);
+	}
 
 	drm_intel_bo_unreference(target_buffer);
 	intel_batchbuffer_free(batch);
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index bb43976..86ff745 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -127,8 +127,11 @@ int main(int argc, char **argv)
 	fd = drm_open_any();
 
 	count = 0;
+	if (drmtest_run_in_simulation())
+		count = 2;
 	if (argc > 1)
 		count = atoi(argv[1]);
+
 	if (count == 0) {
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
 		count += (count & 1) == 0;
@@ -175,6 +178,9 @@ int main(int argc, char **argv)
 	for (i = 0; i < count; i++)
 		check_bo(bo[i], bo_start_val[i]);
 
+	if (drmtest_run_in_simulation())
+		return 0;
+
 	printf("Cyclic blits, backward...\n");
 	for (i = 0; i < count * 4; i++) {
 		int src = (i+1) % count;
-- 
1.7.11.7

  parent reply	other threads:[~2013-03-26 15:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 15:24 Craft a list of tests to run in simulation (and tune them) Damien Lespiau
2013-03-26 15:24 ` [PATCH i-g-t 1/5] README: Reword a few sentences Damien Lespiau
2013-03-26 15:24 ` [PATCH i-g-t 2/5] lib: Rename IGT_QUICK to IGT_SIMULATION Damien Lespiau
2013-03-26 15:24 ` [PATCH i-g-t 3/5] tests: Use IGT_SIMULATION to tune the list of tests to run Damien Lespiau
2013-03-26 15:38   ` Daniel Vetter
2013-03-26 17:00     ` Ben Widawsky
2013-03-27  0:24       ` Daniel Vetter
2013-03-27  2:54         ` Sun, Yi
2013-04-01  7:21         ` Sun, Yi
2013-04-02 17:06           ` Ben Widawsky
2013-04-02 17:16             ` Damien Lespiau
2013-04-02 17:38               ` Daniel Vetter
2013-03-26 15:24 ` Damien Lespiau [this message]
2013-03-26 15:24 ` [PATCH i-g-t 5/5] build: Make grep silent with running make test Damien Lespiau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364311479-20669-5-git-send-email-damien.lespiau@intel.com \
    --to=damien.lespiau@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.