mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-04 13:16:19 +00:00
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>
This commit is contained in:
parent
6867b87b73
commit
4e2a785e24
@ -47,6 +47,11 @@
|
|||||||
#define LOCAL_I915_EXEC_NO_RELOC (1<<11)
|
#define LOCAL_I915_EXEC_NO_RELOC (1<<11)
|
||||||
#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
|
#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
|
#define SYNC 0x1
|
||||||
|
|
||||||
static double elapsed(const struct timespec *start,
|
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_execbuffer2 execbuf;
|
||||||
struct drm_i915_gem_exec_object2 gem_exec;
|
struct drm_i915_gem_exec_object2 gem_exec;
|
||||||
|
unsigned engines[16];
|
||||||
|
unsigned nengine;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = drm_open_driver(DRIVER_INTEL);
|
fd = drm_open_driver(DRIVER_INTEL);
|
||||||
@ -77,15 +84,26 @@ static int loop(unsigned ring, int reps, unsigned flags)
|
|||||||
memset(&execbuf, 0, sizeof(execbuf));
|
memset(&execbuf, 0, sizeof(execbuf));
|
||||||
execbuf.buffers_ptr = (uintptr_t)&gem_exec;
|
execbuf.buffers_ptr = (uintptr_t)&gem_exec;
|
||||||
execbuf.buffer_count = 1;
|
execbuf.buffer_count = 1;
|
||||||
execbuf.flags = ring;
|
|
||||||
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
|
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
|
||||||
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
|
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
|
||||||
if (__gem_execbuf(fd, &execbuf)) {
|
if (__gem_execbuf(fd, &execbuf)) {
|
||||||
execbuf.flags = ring;
|
execbuf.flags = 0;
|
||||||
if (__gem_execbuf(fd, &execbuf))
|
if (__gem_execbuf(fd, &execbuf))
|
||||||
return 77;
|
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--) {
|
while (reps--) {
|
||||||
struct timespec start, end;
|
struct timespec start, end;
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
@ -95,10 +113,14 @@ static int loop(unsigned ring, int reps, unsigned flags)
|
|||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||||
do {
|
do {
|
||||||
do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
|
for (int inner = 0; inner < 1024; inner++) {
|
||||||
count++;
|
execbuf.flags &= ~ENGINE_FLAGS;
|
||||||
|
execbuf.flags |= engines[count++ % nengine];
|
||||||
|
gem_execbuf(fd, &execbuf);
|
||||||
if (flags & SYNC)
|
if (flags & SYNC)
|
||||||
gem_sync(fd, gem_exec.handle);
|
gem_sync(fd, gem_exec.handle);
|
||||||
|
}
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||||
} while (elapsed(&start, &end) < 2.);
|
} while (elapsed(&start, &end) < 2.);
|
||||||
|
|
||||||
@ -128,6 +150,8 @@ int main(int argc, char **argv)
|
|||||||
ring = I915_EXEC_BLT;
|
ring = I915_EXEC_BLT;
|
||||||
else if (strcmp(optarg, "vecs") == 0)
|
else if (strcmp(optarg, "vecs") == 0)
|
||||||
ring = I915_EXEC_VEBOX;
|
ring = I915_EXEC_VEBOX;
|
||||||
|
else if (strcmp(optarg, "all") == 0)
|
||||||
|
ring = -1;
|
||||||
else
|
else
|
||||||
ring = atoi(optarg);
|
ring = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user