[Intel-gfx] [igt-dev] [PATCH i-g-t 3/3] i915/gem_exec_schedule: Measure semaphore power consumption

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 3 06:34:11 UTC 2019


Quoting Ashutosh Dixit (2019-04-03 02:28:35)
> 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 at 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:

Code is correct. Warning is just a warning that we need new iterators.
-Chris


More information about the Intel-gfx mailing list