diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-23 12:37:38 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-03-24 11:25:38 +0000 |
commit | 4e2a785e2412f148693b993d1a29d62f48da4937 (patch) | |
tree | 6f2a976811df61b9c1dc960bc6b8dd3898c0e774 | |
parent | 6867b87b73f3fc0d70d5b64efce7ec096007dd20 (diff) |
benchmarks/gem_exec_nop: Include a measurement across all rings
For sync, it really is just the average latency across all rings, but
for continuous we can expect to see the effect of concurrent dispatch
across rings. Hopefully.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | benchmarks/gem_exec_nop.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/benchmarks/gem_exec_nop.c b/benchmarks/gem_exec_nop.c index 2c39b9c3a..07162a99c 100644 --- a/benchmarks/gem_exec_nop.c +++ b/benchmarks/gem_exec_nop.c @@ -47,6 +47,11 @@ #define LOCAL_I915_EXEC_NO_RELOC (1<<11) #define LOCAL_I915_EXEC_HANDLE_LUT (1<<12) +#define LOCAL_I915_EXEC_BSD_SHIFT (13) +#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT) + +#define ENGINE_FLAGS (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK) + #define SYNC 0x1 static double elapsed(const struct timespec *start, @@ -67,6 +72,8 @@ static int loop(unsigned ring, int reps, unsigned flags) { struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_exec_object2 gem_exec; + unsigned engines[16]; + unsigned nengine; int fd; fd = drm_open_driver(DRIVER_INTEL); @@ -77,15 +84,26 @@ static int loop(unsigned ring, int reps, unsigned flags) memset(&execbuf, 0, sizeof(execbuf)); execbuf.buffers_ptr = (uintptr_t)&gem_exec; execbuf.buffer_count = 1; - execbuf.flags = ring; execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT; execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC; if (__gem_execbuf(fd, &execbuf)) { - execbuf.flags = ring; + execbuf.flags = 0; if (__gem_execbuf(fd, &execbuf)) return 77; } + nengine = 0; + if (ring == -1) { + for (ring = 1; ring < 16; ring++) { + execbuf.flags &= ~ENGINE_FLAGS; + execbuf.flags |= ring; + if (__gem_execbuf(fd, &execbuf) == 0) + engines[nengine++] = ring; + } + } else + engines[nengine++] = ring; + + while (reps--) { struct timespec start, end; unsigned count = 0; @@ -95,10 +113,14 @@ static int loop(unsigned ring, int reps, unsigned flags) clock_gettime(CLOCK_MONOTONIC, &start); do { - do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf); - count++; - if (flags & SYNC) - gem_sync(fd, gem_exec.handle); + for (int inner = 0; inner < 1024; inner++) { + execbuf.flags &= ~ENGINE_FLAGS; + execbuf.flags |= engines[count++ % nengine]; + gem_execbuf(fd, &execbuf); + if (flags & SYNC) + gem_sync(fd, gem_exec.handle); + } + clock_gettime(CLOCK_MONOTONIC, &end); } while (elapsed(&start, &end) < 2.); @@ -128,6 +150,8 @@ int main(int argc, char **argv) ring = I915_EXEC_BLT; else if (strcmp(optarg, "vecs") == 0) ring = I915_EXEC_VEBOX; + else if (strcmp(optarg, "all") == 0) + ring = -1; else ring = atoi(optarg); break; |