public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 3/3] i915/gem_exec_schedule: Measure semaphore power consumption
Date: Tue, 02 Apr 2019 18:28:35 -0700	[thread overview]
Message-ID: <87k1gbc1x8.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20190131161717.1359-3-chris@chris-wilson.co.uk>

On Thu, 31 Jan 2019 08:17:17 -0800, Chris Wilson wrote:
> 
> How much energy does spinning on a semaphore consume relative to plain
> old spinning?
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  tests/i915/gem_exec_schedule.c | 72 +++++++++++++++++++++++++++++++++-
>  1 file changed, 71 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/gem_exec_schedule.c b/tests/i915/gem_exec_schedule.c
> index 0462ce84f..184ceb7d6 100644
> --- a/tests/i915/gem_exec_schedule.c
> +++ b/tests/i915/gem_exec_schedule.c
> @@ -29,9 +29,10 @@
>  #include <signal.h>
>  
>  #include "igt.h"
> -#include "igt_vgem.h"
> +#include "igt_gpu_power.h"
>  #include "igt_rand.h"
>  #include "igt_sysfs.h"
> +#include "igt_vgem.h"
>  #include "i915/gem_ring.h"
>  
>  #define LO 0
> @@ -1191,6 +1192,65 @@ static void test_pi_ringfull(int fd, unsigned int engine)
>  	munmap(result, 4096);
>  }
>  
> +static void measure_semaphore_power(int i915)
> +{
> +	struct gpu_power power;
> +	unsigned int engine, signaler;
> +
> +	igt_require(gpu_power_open(&power) == 0);
> +
> +	for_each_physical_engine(i915, signaler) {
> +		struct gpu_power_sample s_spin[2];
> +		struct gpu_power_sample s_sema[2];
> +		double baseline, total;
> +		int64_t jiffie = 1;
> +		igt_spin_t *spin;
> +
> +		spin = __igt_spin_batch_new(i915,
> +					    .engine = signaler,
> +					    .flags = IGT_SPIN_POLL_RUN);
> +		gem_wait(i915, spin->handle, &jiffie); /* waitboost */
> +		igt_assert(spin->running);
> +		igt_spin_busywait_until_running(spin);
> +
> +		gpu_power_read(&power, &s_spin[0]);
> +		usleep(100*1000);
> +		gpu_power_read(&power, &s_spin[1]);
> +
> +		/* Add a waiter to each engine */
> +		for_each_physical_engine(i915, engine) {
>
See the following warning now as a result of this patch, most likely the
code is incorrect too due to the shadowed variable:

ninja: Entering directory `build'
[182/621] Compiling C object 'tests/59830eb@@gem_exec_schedule@exe/i915_gem_exec_schedule.c.o'.
In file included from ../lib/igt.h:40,
                 from ../tests/i915/gem_exec_schedule.c:31:
../tests/i915/gem_exec_schedule.c: In function ‘measure_semaphore_power’:
../lib/igt_gt.h:84:44: warning: declaration of ‘e__’ shadows a previous local [-Wshadow]
  for (const struct intel_execution_engine *e__ = intel_execution_engines;\
                                            ^~~
../tests/i915/gem_exec_schedule.c:1316:3: note: in expansion of macro ‘for_each_physical_engine’
   for_each_physical_engine(i915, engine) {
   ^~~~~~~~~~~~~~~~~~~~~~~~
../lib/igt_gt.h:84:44: note: shadowed declaration is here
  for (const struct intel_execution_engine *e__ = intel_execution_engines;\
                                            ^~~
../tests/i915/gem_exec_schedule.c:1297:2: note: in expansion of macro ‘for_each_physical_engine’
  for_each_physical_engine(i915, signaler) {
  ^~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-04-03  1:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 16:17 [igt-dev] [PATCH i-g-t 1/3] lib/i915: Pretty print HW semaphores Chris Wilson
2019-01-31 16:17 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add GPU power measurement Chris Wilson
2019-01-31 16:17 ` [igt-dev] [PATCH i-g-t 3/3] i915/gem_exec_schedule: Measure semaphore power consumption Chris Wilson
2019-04-03  1:28   ` Ashutosh Dixit [this message]
2019-04-03  6:34     ` Chris Wilson
2019-01-31 16:41 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/i915: Pretty print HW semaphores Patchwork
2019-02-01  0:10 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=87k1gbc1x8.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox