intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] i915/gem_exec_nop: Specify timeout in milliseconds
       [not found] <20200512102447.9249-1-janusz.krzysztofik@linux.intel.com>
@ 2020-05-12 17:19 ` Chris Wilson
  2020-05-21 15:23   ` [Intel-gfx] [igt-dev] " Janusz Krzysztofik
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2020-05-12 17:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Chris Wilson

Our 'headless' subtest requires fairly precise measurements to determine
the impact of the dmc upon request latency. The test cannot be effective
if we cannot execute requests quickly, so add a very short pre-pass to
check the test requirements. For this we want to specify the baseline
measurement timeout in milliseconds, allowing us to speed up our other
baseline measurements elsewhere as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_exec_nop.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/tests/i915/gem_exec_nop.c b/tests/i915/gem_exec_nop.c
index 4051e0fd7..21a937c83 100644
--- a/tests/i915/gem_exec_nop.c
+++ b/tests/i915/gem_exec_nop.c
@@ -64,7 +64,7 @@ static double elapsed(const struct timespec *start, const struct timespec *end)
 
 static double nop_on_ring(int fd, uint32_t handle,
 			  const struct intel_execution_engine2 *e,
-			  int timeout,
+			  int timeout_ms,
 			  unsigned long *out)
 {
 	struct drm_i915_gem_execbuffer2 execbuf;
@@ -94,7 +94,7 @@ static double nop_on_ring(int fd, uint32_t handle,
 		count++;
 
 		clock_gettime(CLOCK_MONOTONIC, &now);
-	} while (elapsed(&start, &now) < timeout);
+	} while (elapsed(&start, &now) < timeout_ms * 1e-3);
 	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
 
 	*out = count;
@@ -348,14 +348,15 @@ static void single(int fd, uint32_t handle,
 	double time;
 	unsigned long count;
 
-	time = nop_on_ring(fd, handle, e, 20, &count);
+	time = nop_on_ring(fd, handle, e, 20000, &count);
 	igt_info("%s: %'lu cycles: %.3fus\n",
 		  e->name, count, time*1e6 / count);
 }
 
 static double
 stable_nop_on_ring(int fd, uint32_t handle,
-		   const struct intel_execution_engine2 *e, int timeout,
+		   const struct intel_execution_engine2 *e,
+		   int timeout_ms,
 		   int reps)
 {
 	igt_stats_t s;
@@ -370,7 +371,7 @@ stable_nop_on_ring(int fd, uint32_t handle,
 		unsigned long count;
 		double time;
 
-		time = nop_on_ring(fd, handle, e, timeout, &count);
+		time = nop_on_ring(fd, handle, e, timeout_ms, &count);
 		igt_stats_push_float(&s, time / count);
 	}
 
@@ -390,9 +391,10 @@ static void headless(int fd, uint32_t handle,
 		     const struct intel_execution_engine2 *e)
 {
 	unsigned int nr_connected = 0;
+	double n_display, n_headless;
 	drmModeConnector *connector;
+	unsigned long count;
 	drmModeRes *res;
-	double n_display, n_headless;
 
 	res = drmModeGetResources(fd);
 	igt_require(res);
@@ -409,8 +411,11 @@ static void headless(int fd, uint32_t handle,
 	/* set graphics mode to prevent blanking */
 	kmstest_set_vt_graphics_mode();
 
+	nop_on_ring(fd, handle, e, 10, &count);
+	igt_require_f(count > 100, "submillisecond precision required\n");
+
 	/* benchmark nops */
-	n_display = stable_nop_on_ring(fd, handle, e, 1, 5);
+	n_display = stable_nop_on_ring(fd, handle, e, 500, 5);
 	igt_info("With one display connected: %.2fus\n",
 		 n_display * 1e6);
 
@@ -418,7 +423,7 @@ static void headless(int fd, uint32_t handle,
 	kmstest_unset_all_crtcs(fd, res);
 
 	/* benchmark nops again */
-	n_headless = stable_nop_on_ring(fd, handle, e, 1, 5);
+	n_headless = stable_nop_on_ring(fd, handle, e, 500, 5);
 	igt_info("Without a display connected (headless): %.2fus\n",
 		 n_headless * 1e6);
 
@@ -444,7 +449,7 @@ static void parallel(int fd, uint32_t handle, int timeout)
 		engines[nengine] = e->flags;
 		names[nengine++] = strdup(e->name);
 
-		time = nop_on_ring(fd, handle, e, 1, &count) / count;
+		time = nop_on_ring(fd, handle, e, 250, &count) / count;
 		sum += time;
 		igt_debug("%s: %.3fus\n", e->name, 1e6*time);
 	}
@@ -506,7 +511,7 @@ static void independent(int fd, uint32_t handle, int timeout)
 		engines[nengine] = e->flags;
 		names[nengine++] = strdup(e->name);
 
-		time = nop_on_ring(fd, handle, e, 1, &count) / count;
+		time = nop_on_ring(fd, handle, e, 250, &count) / count;
 		sum += time;
 		igt_debug("%s: %.3fus\n", e->name, 1e6*time);
 	}
@@ -626,7 +631,7 @@ static void series(int fd, uint32_t handle, int timeout)
 
 	nengine = 0;
 	__for_each_physical_engine(fd, e) {
-		time = nop_on_ring(fd, handle, e, 1, &count) / count;
+		time = nop_on_ring(fd, handle, e, 250, &count) / count;
 		if (time > max) {
 			name = e->name;
 			max = time;
@@ -705,7 +710,7 @@ static void sequential(int fd, uint32_t handle, unsigned flags, int timeout)
 	__for_each_physical_engine(fd, e) {
 		unsigned long count;
 
-		time = nop_on_ring(fd, handle, e, 1, &count) / count;
+		time = nop_on_ring(fd, handle, e, 250, &count) / count;
 		sum += time;
 		igt_debug("%s: %.3fus\n", e->name, 1e6*time);
 
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] i915/gem_exec_nop: Specify timeout in milliseconds
  2020-05-12 17:19 ` [Intel-gfx] [PATCH i-g-t] i915/gem_exec_nop: Specify timeout in milliseconds Chris Wilson
@ 2020-05-21 15:23   ` Janusz Krzysztofik
  0 siblings, 0 replies; 2+ messages in thread
From: Janusz Krzysztofik @ 2020-05-21 15:23 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev

On Tue, 2020-05-12 at 18:19 +0100, Chris Wilson wrote:
> Our 'headless' subtest requires fairly precise measurements to determine
> the impact of the dmc upon request latency. The test cannot be effective
> if we cannot execute requests quickly, so add a very short pre-pass to
> check the test requirements. For this we want to specify the baseline
> measurement timeout in milliseconds, allowing us to speed up our other
> baseline measurements elsewhere as well.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

Thanks,
Janusz

> ---
>  tests/i915/gem_exec_nop.c | 29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/i915/gem_exec_nop.c b/tests/i915/gem_exec_nop.c
> index 4051e0fd7..21a937c83 100644
> --- a/tests/i915/gem_exec_nop.c
> +++ b/tests/i915/gem_exec_nop.c
> @@ -64,7 +64,7 @@ static double elapsed(const struct timespec *start, const struct timespec *end)
>  
>  static double nop_on_ring(int fd, uint32_t handle,
>  			  const struct intel_execution_engine2 *e,
> -			  int timeout,
> +			  int timeout_ms,
>  			  unsigned long *out)
>  {
>  	struct drm_i915_gem_execbuffer2 execbuf;
> @@ -94,7 +94,7 @@ static double nop_on_ring(int fd, uint32_t handle,
>  		count++;
>  
>  		clock_gettime(CLOCK_MONOTONIC, &now);
> -	} while (elapsed(&start, &now) < timeout);
> +	} while (elapsed(&start, &now) < timeout_ms * 1e-3);
>  	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
>  
>  	*out = count;
> @@ -348,14 +348,15 @@ static void single(int fd, uint32_t handle,
>  	double time;
>  	unsigned long count;
>  
> -	time = nop_on_ring(fd, handle, e, 20, &count);
> +	time = nop_on_ring(fd, handle, e, 20000, &count);
>  	igt_info("%s: %'lu cycles: %.3fus\n",
>  		  e->name, count, time*1e6 / count);
>  }
>  
>  static double
>  stable_nop_on_ring(int fd, uint32_t handle,
> -		   const struct intel_execution_engine2 *e, int timeout,
> +		   const struct intel_execution_engine2 *e,
> +		   int timeout_ms,
>  		   int reps)
>  {
>  	igt_stats_t s;
> @@ -370,7 +371,7 @@ stable_nop_on_ring(int fd, uint32_t handle,
>  		unsigned long count;
>  		double time;
>  
> -		time = nop_on_ring(fd, handle, e, timeout, &count);
> +		time = nop_on_ring(fd, handle, e, timeout_ms, &count);
>  		igt_stats_push_float(&s, time / count);
>  	}
>  
> @@ -390,9 +391,10 @@ static void headless(int fd, uint32_t handle,
>  		     const struct intel_execution_engine2 *e)
>  {
>  	unsigned int nr_connected = 0;
> +	double n_display, n_headless;
>  	drmModeConnector *connector;
> +	unsigned long count;
>  	drmModeRes *res;
> -	double n_display, n_headless;
>  
>  	res = drmModeGetResources(fd);
>  	igt_require(res);
> @@ -409,8 +411,11 @@ static void headless(int fd, uint32_t handle,
>  	/* set graphics mode to prevent blanking */
>  	kmstest_set_vt_graphics_mode();
>  
> +	nop_on_ring(fd, handle, e, 10, &count);
> +	igt_require_f(count > 100, "submillisecond precision required\n");
> +
>  	/* benchmark nops */
> -	n_display = stable_nop_on_ring(fd, handle, e, 1, 5);
> +	n_display = stable_nop_on_ring(fd, handle, e, 500, 5);
>  	igt_info("With one display connected: %.2fus\n",
>  		 n_display * 1e6);
>  
> @@ -418,7 +423,7 @@ static void headless(int fd, uint32_t handle,
>  	kmstest_unset_all_crtcs(fd, res);
>  
>  	/* benchmark nops again */
> -	n_headless = stable_nop_on_ring(fd, handle, e, 1, 5);
> +	n_headless = stable_nop_on_ring(fd, handle, e, 500, 5);
>  	igt_info("Without a display connected (headless): %.2fus\n",
>  		 n_headless * 1e6);
>  
> @@ -444,7 +449,7 @@ static void parallel(int fd, uint32_t handle, int timeout)
>  		engines[nengine] = e->flags;
>  		names[nengine++] = strdup(e->name);
>  
> -		time = nop_on_ring(fd, handle, e, 1, &count) / count;
> +		time = nop_on_ring(fd, handle, e, 250, &count) / count;
>  		sum += time;
>  		igt_debug("%s: %.3fus\n", e->name, 1e6*time);
>  	}
> @@ -506,7 +511,7 @@ static void independent(int fd, uint32_t handle, int timeout)
>  		engines[nengine] = e->flags;
>  		names[nengine++] = strdup(e->name);
>  
> -		time = nop_on_ring(fd, handle, e, 1, &count) / count;
> +		time = nop_on_ring(fd, handle, e, 250, &count) / count;
>  		sum += time;
>  		igt_debug("%s: %.3fus\n", e->name, 1e6*time);
>  	}
> @@ -626,7 +631,7 @@ static void series(int fd, uint32_t handle, int timeout)
>  
>  	nengine = 0;
>  	__for_each_physical_engine(fd, e) {
> -		time = nop_on_ring(fd, handle, e, 1, &count) / count;
> +		time = nop_on_ring(fd, handle, e, 250, &count) / count;
>  		if (time > max) {
>  			name = e->name;
>  			max = time;
> @@ -705,7 +710,7 @@ static void sequential(int fd, uint32_t handle, unsigned flags, int timeout)
>  	__for_each_physical_engine(fd, e) {
>  		unsigned long count;
>  
> -		time = nop_on_ring(fd, handle, e, 1, &count) / count;
> +		time = nop_on_ring(fd, handle, e, 250, &count) / count;
>  		sum += time;
>  		igt_debug("%s: %.3fus\n", e->name, 1e6*time);
>  

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2020-05-21 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200512102447.9249-1-janusz.krzysztofik@linux.intel.com>
2020-05-12 17:19 ` [Intel-gfx] [PATCH i-g-t] i915/gem_exec_nop: Specify timeout in milliseconds Chris Wilson
2020-05-21 15:23   ` [Intel-gfx] [igt-dev] " Janusz Krzysztofik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).