diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-05-08 13:31:50 +0100 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-05-08 13:31:50 +0100 |
commit | 07a8aa0d848f60768f03e63b98c14234eff780cf (patch) | |
tree | b32ce13a79fe5a140ee3b6438796c27dfd5087ac /benchmarks | |
parent | b0872574d26eac7d0a8a72b9a74930bb0f94ec2d (diff) |
gem_wsim: Support multiple dependencies
Multiple dependencies separated by forward slashes are now supported.
Some media workloads also updated to use this for better efficiency.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'benchmarks')
-rw-r--r-- | benchmarks/gem_wsim.c | 95 | ||||
-rw-r--r-- | benchmarks/wsim/README | 6 | ||||
-rw-r--r-- | benchmarks/wsim/media_mfe2_480p.wsim | 3 | ||||
-rw-r--r-- | benchmarks/wsim/media_mfe3_480p.wsim | 4 | ||||
-rw-r--r-- | benchmarks/wsim/media_mfe4_480p.wsim | 5 |
5 files changed, 73 insertions, 40 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index b7d4395c..9a6007ac 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -79,14 +79,15 @@ struct w_step unsigned int context; unsigned int engine; struct duration duration; - int dependency; + int nr_deps; + int *dep; int wait; /* Implementation details */ unsigned int idx; struct drm_i915_gem_execbuffer2 eb; - struct drm_i915_gem_exec_object2 obj[4]; + struct drm_i915_gem_exec_object2 *obj; struct drm_i915_gem_relocation_entry reloc[3]; unsigned long bb_sz; uint32_t bb_handle; @@ -146,17 +147,6 @@ static int fd; #define RCS_TIMESTAMP (0x2000 + 0x358) #define REG(x) (volatile uint32_t *)((volatile char *)igt_global_mmio + x) -/* - * Workload descriptor: - * - * ctx.engine.duration.dependency.wait,... - * <uint>.<str>.<uint>.<int <= 0>.<0|1>,... - * - * Engine ids: RCS, BCS, VCS, VCS1, VCS2, VECS - * - * "1.VCS1.3000.0.1,1.RCS.1000.-1.0,1.RCS.3700.0.0,1.RCS.1000.-2.0,1.VCS2.2300.-2.0,1.RCS.4700.-1.0,1.VCS2.600.-1.1" - */ - static const char *ring_str_map[NUM_ENGINES] = { [RCS] = "RCS", [BCS] = "BCS", @@ -166,6 +156,40 @@ static const char *ring_str_map[NUM_ENGINES] = { [VECS] = "VECS", }; +static int parse_dependencies(struct w_step *w, char *_desc) +{ + char *desc = strdup(_desc); + char *token, *tctx = NULL, *tstart = desc; + int dep; + + igt_assert(desc); + + w->nr_deps = 0; + w->dep = NULL; + + while ((token = strtok_r(tstart, "/", &tctx)) != NULL) { + tstart = NULL; + + dep = atoi(token); + if (dep > 0) { + if (w->dep) + free(w-dep); + return -1; + } + + if (dep < 0) { + w->nr_deps++; + w->dep = realloc(w->dep, sizeof(*w->dep) * w->nr_deps); + igt_assert(w->dep); + w->dep[w->nr_deps - 1] = dep; + } + } + + free(desc); + + return 0; +} + static struct workload *parse_workload(char *_desc) { struct workload *wrk; @@ -177,9 +201,12 @@ static struct workload *parse_workload(char *_desc) unsigned int valid; int tmp; + igt_assert(desc); + while ((_token = strtok_r(tstart, ",", &tctx)) != NULL) { tstart = NULL; token = strdup(_token); + igt_assert(token); fstart = token; valid = 0; memset(&step, 0, sizeof(step)); @@ -340,15 +367,14 @@ static struct workload *parse_workload(char *_desc) if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { fstart = NULL; - tmp = atoi(field); - if (tmp > 0) { + tmp = parse_dependencies(&step, field); + if (tmp < 0) { if (!quiet) fprintf(stderr, "Invalid forward dependency at step %u!\n", nr_steps); return NULL; } - step.dependency = tmp; valid++; } @@ -515,25 +541,35 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags) { enum intel_engine_id engine = w->engine; unsigned int j = 0; + unsigned int nr_obj = 3 + w->nr_deps; + unsigned int i; + + w->obj = calloc(nr_obj, sizeof(*w->obj)); + igt_assert(w->obj); w->obj[j].handle = gem_create(fd, 4096); w->obj[j].flags = EXEC_OBJECT_WRITE; j++; + igt_assert(j < nr_obj); if (flags & SEQNO) { w->obj[j].handle = wrk->status_page_handle; j++; + igt_assert(j < nr_obj); } - igt_assert(w->dependency <= 0); - if (w->dependency) { - int dep_idx = w->idx + w->dependency; + for (i = 0; i < w->nr_deps; i++) { + igt_assert(w->dep[i] <= 0); + if (w->dep[i]) { + int dep_idx = w->idx + w->dep[i]; - igt_assert(dep_idx >= 0 && dep_idx < wrk->nr_steps); - igt_assert(wrk->steps[dep_idx].type == BATCH); + igt_assert(dep_idx >= 0 && dep_idx < wrk->nr_steps); + igt_assert(wrk->steps[dep_idx].type == BATCH); - w->obj[j].handle = wrk->steps[dep_idx].obj[0].handle; - j++; + w->obj[j].handle = wrk->steps[dep_idx].obj[0].handle; + j++; + igt_assert(j < nr_obj); + } } w->bb_sz = get_bb_sz(w->duration.max); @@ -546,7 +582,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags) w->obj[j].relocation_count = 3; else w->obj[j].relocation_count = 1; - for (int i = 0; i < w->obj[j].relocation_count; i++) + for (i = 0; i < w->obj[j].relocation_count; i++) w->reloc[i].target_handle = 1; } @@ -560,11 +596,12 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags) engine = VCS1; eb_update_flags(w, engine, flags); #ifdef DEBUG - printf("%u: %u:%x|%x|%x|%x %10lu flags=%llx bb=%x[%u] ctx[%u]=%u\n", - w->idx, w->eb.buffer_count, w->obj[0].handle, - w->obj[1].handle, w->obj[2].handle, w->obj[3].handle, - w->bb_sz, w->eb.flags, w->bb_handle, j, - w->context, wrk->ctx_id[w->context]); + printf("%u: %u:|", w->idx, w->eb.buffer_count); + for (i = 0; i <= j; i++) + printf("%x|", w->obj[i].handle); + printf(" %10lu flags=%llx bb=%x[%u] ctx[%u]=%u\n", + w->bb_sz, w->eb.flags, w->bb_handle, j, w->context, + wrk->ctx_id[w->context]); #endif } diff --git a/benchmarks/wsim/README b/benchmarks/wsim/README index 7aa0694a..5d2a90b2 100644 --- a/benchmarks/wsim/README +++ b/benchmarks/wsim/README @@ -2,8 +2,8 @@ Workload descriptor format ========================== ctx.engine.duration_us.dependency.wait,... -<uint>.<str>.<uint>[-<uint>].<int <= 0>.<0|1>,... -d|p|s.<uiny>,... +<uint>.<str>.<uint>[-<uint>].<int <= 0>[/<int <= 0>][...].<0|1>,... +d|p|s|t|q.<uiny>,... For duration a range can be given from which a random value will be picked before every submit. Since this and seqno management requires CPU access to @@ -54,3 +54,5 @@ The above workload described in human language works like this: When workload descriptors are provided on the command line, commas must be used instead of new lines. + +Multiple dependencies can be given separated by forward slashes.
\ No newline at end of file diff --git a/benchmarks/wsim/media_mfe2_480p.wsim b/benchmarks/wsim/media_mfe2_480p.wsim index b59cb60b..18bc756f 100644 --- a/benchmarks/wsim/media_mfe2_480p.wsim +++ b/benchmarks/wsim/media_mfe2_480p.wsim @@ -4,7 +4,6 @@ 4.VCS.12000-15000.0.0 5.RCS.1000-2200.-1.0 6.RCS.800-1600.-1.0 -s.-4 -6.RCS.10000-12000.0.0 +6.RCS.10000-12000.-4.0 6.VCS.2500-3500.-1.0 3.VCS.2500-3500.-2.1 diff --git a/benchmarks/wsim/media_mfe3_480p.wsim b/benchmarks/wsim/media_mfe3_480p.wsim index b4589d22..e12a2e6a 100644 --- a/benchmarks/wsim/media_mfe3_480p.wsim +++ b/benchmarks/wsim/media_mfe3_480p.wsim @@ -7,9 +7,7 @@ 7.VCS.12000-15000.0.0 8.RCS.1000-2200.-1.0 9.RCS.800-1600.-1.0 -s.-8 -s.-4 -9.RCS.10000-12000.0.0 +9.RCS.10000-12000.-7/-4.0 9.VCS.2500-3500.-1.0 3.VCS.2500-3500.-2.0 6.VCS.2500-3500.-3.1 diff --git a/benchmarks/wsim/media_mfe4_480p.wsim b/benchmarks/wsim/media_mfe4_480p.wsim index 3137da34..75d4f67e 100644 --- a/benchmarks/wsim/media_mfe4_480p.wsim +++ b/benchmarks/wsim/media_mfe4_480p.wsim @@ -10,10 +10,7 @@ 10.VCS.12000-15000.0.0 11.RCS.1000-2200.-1.0 12.RCS.800-1600.-1.0 -s.-10 -s.-8 -s.-6 -12.RCS.10000-12000.0.0 +12.RCS.10000-12000.-4/-7/-10.0 12.VCS.2500-3500.-1.0 3.VCS.2500-3500.-2.0 6.VCS.2500-3500.-3.0 |