mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 23:06:29 +00:00
benchmarks/gem_blt: Fixup a couple of non-llc foibles
When extending the batch for multiple copies, we need to remember to flag it as being in the CPU write domain so that the new values get flushed out to main memory before execution. We also have to be careful not to specify NO_RELOC for the extended batch as the execobjects will have been updated but we write the wrong presumed offsets. Subsequent iterations will be correct and we can tell the kernel then to skip the relocations entirely. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
143a216058
commit
4c14aa18c1
@ -166,7 +166,7 @@ static int run(int object, int batch, int count, int set, int reps)
|
|||||||
struct drm_i915_gem_exec_object2 exec[3];
|
struct drm_i915_gem_exec_object2 exec[3];
|
||||||
struct drm_i915_gem_relocation_entry *reloc;
|
struct drm_i915_gem_relocation_entry *reloc;
|
||||||
uint32_t *buf, handle, src, dst;
|
uint32_t *buf, handle, src, dst;
|
||||||
int fd, len, gen, size;
|
int fd, len, gen, size, nreloc;
|
||||||
int ring;
|
int ring;
|
||||||
|
|
||||||
size = ALIGN(batch * 64, 4096);
|
size = ALIGN(batch * 64, 4096);
|
||||||
@ -183,17 +183,18 @@ static int run(int object, int batch, int count, int set, int reps)
|
|||||||
dst = gem_create(fd, object);
|
dst = gem_create(fd, object);
|
||||||
|
|
||||||
len = gem_linear_blt(fd, buf, 0, 0, 1, object, reloc);
|
len = gem_linear_blt(fd, buf, 0, 0, 1, object, reloc);
|
||||||
|
if (has_64bit_reloc)
|
||||||
|
nreloc = len > 56 ? 4 : 2;
|
||||||
|
else
|
||||||
|
nreloc = len > 40 ? 4 : 2;
|
||||||
|
|
||||||
memset(exec, 0, sizeof(exec));
|
memset(exec, 0, sizeof(exec));
|
||||||
exec[0].handle = src;
|
exec[0].handle = src;
|
||||||
exec[1].handle = dst;
|
exec[1].handle = dst;
|
||||||
|
|
||||||
exec[2].handle = handle;
|
exec[2].handle = handle;
|
||||||
if (has_64bit_reloc)
|
|
||||||
exec[2].relocation_count = len > 56 ? 4 : 2;
|
|
||||||
else
|
|
||||||
exec[2].relocation_count = len > 40 ? 4 : 2;
|
|
||||||
exec[2].relocs_ptr = (uintptr_t)reloc;
|
exec[2].relocs_ptr = (uintptr_t)reloc;
|
||||||
|
exec[2].relocation_count = nreloc;
|
||||||
|
|
||||||
ring = 0;
|
ring = 0;
|
||||||
if (gen >= 6)
|
if (gen >= 6)
|
||||||
@ -205,7 +206,6 @@ static int run(int object, int batch, int count, int set, int reps)
|
|||||||
execbuf.batch_len = len;
|
execbuf.batch_len = len;
|
||||||
execbuf.flags = ring;
|
execbuf.flags = ring;
|
||||||
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
|
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
|
||||||
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
|
|
||||||
|
|
||||||
if (__gem_execbuf(fd, &execbuf)) {
|
if (__gem_execbuf(fd, &execbuf)) {
|
||||||
gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
|
gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
|
||||||
@ -217,24 +217,25 @@ static int run(int object, int batch, int count, int set, int reps)
|
|||||||
gem_sync(fd, handle);
|
gem_sync(fd, handle);
|
||||||
|
|
||||||
if (batch > 1) {
|
if (batch > 1) {
|
||||||
int nreloc = exec[2].relocation_count;
|
|
||||||
|
|
||||||
if (execbuf.flags & LOCAL_I915_EXEC_HANDLE_LUT) {
|
if (execbuf.flags & LOCAL_I915_EXEC_HANDLE_LUT) {
|
||||||
src = 0;
|
src = 0;
|
||||||
dst = 1;
|
dst = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
|
||||||
for (int i = 1; i < batch; i++) {
|
for (int i = 1; i < batch; i++) {
|
||||||
len = gem_linear_blt(fd, buf, len - 8,
|
len = gem_linear_blt(fd, buf, len - 8,
|
||||||
src, dst, object,
|
src, dst, object,
|
||||||
reloc + exec[2].relocation_count);
|
reloc + nreloc * i);
|
||||||
exec[2].relocation_count += nreloc;
|
|
||||||
}
|
}
|
||||||
|
exec[2].relocation_count = nreloc * batch;
|
||||||
execbuf.batch_len = len;
|
execbuf.batch_len = len;
|
||||||
|
|
||||||
gem_execbuf(fd, &execbuf);
|
gem_execbuf(fd, &execbuf);
|
||||||
gem_sync(fd, handle);
|
gem_sync(fd, handle);
|
||||||
}
|
}
|
||||||
|
if (execbuf.flags & LOCAL_I915_EXEC_HANDLE_LUT)
|
||||||
|
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
|
||||||
|
|
||||||
while (reps--) {
|
while (reps--) {
|
||||||
double min = HUGE_VAL;
|
double min = HUGE_VAL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user