summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2018-08-14 10:41:30 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2018-09-14 12:53:27 +0100
commit0ff0804b0d52e034459a80ab27c39965d5ea1e39 (patch)
treee1bb6b7f1166ce592f462db775071a08cea2231a /benchmarks
parent5cdff3c00bdff3dc8c6ab4f5b2f11978bf06e59e (diff)
gem_wsim: Context priority support
A new workload command ('P') is added which enables per context dynamic priority control. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/gem_wsim.c48
-rw-r--r--benchmarks/wsim/README18
2 files changed, 65 insertions, 1 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 395a5dff..282b986d 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -82,7 +82,8 @@ enum w_type
THROTTLE,
QD_THROTTLE,
SW_FENCE,
- SW_FENCE_SIGNAL
+ SW_FENCE_SIGNAL,
+ CTX_PRIORITY
};
struct deps
@@ -114,6 +115,7 @@ struct w_step
int target;
int throttle;
int fence_signal;
+ int priority;
};
/* Implementation details */
@@ -162,6 +164,7 @@ struct workload
unsigned int nr_ctxs;
struct {
uint32_t id;
+ int priority;
unsigned int static_vcs;
} *ctx_list;
@@ -342,6 +345,36 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w)
step.period = tmp;
goto add_step;
}
+ } else if (!strcmp(field, "P")) {
+ unsigned int nr = 0;
+ while ((field = strtok_r(fstart, ".", &fctx)) !=
+ NULL) {
+ tmp = atoi(field);
+ if (tmp <= 0 && nr == 0) {
+ if (verbose)
+ fprintf(stderr,
+ "Invalid context at step %u!\n",
+ nr_steps);
+ return NULL;
+ }
+
+ if (nr == 0) {
+ step.context = tmp;
+ } else if (nr == 1) {
+ step.priority = tmp;
+ } else {
+ if (verbose)
+ fprintf(stderr,
+ "Invalid priority format at step %u!\n",
+ nr_steps);
+ return NULL;
+ }
+
+ nr++;
+ }
+
+ step.type = CTX_PRIORITY;
+ goto add_step;
} else if (!strcmp(field, "s")) {
if ((field = strtok_r(fstart, ".", &fctx)) !=
NULL) {
@@ -1790,6 +1823,19 @@ static void *run_workload(void *data)
inc = cur_seqno - wrk->sync_seqno;
sw_sync_timeline_inc(wrk->sync_timeline, inc);
continue;
+ } else if (w->type == CTX_PRIORITY) {
+ if (w->priority != wrk->ctx_list[w->context].priority) {
+ struct drm_i915_gem_context_param param = {
+ .ctx_id = wrk->ctx_list[w->context].id,
+ .param = I915_CONTEXT_PARAM_PRIORITY,
+ .value = w->priority,
+ };
+
+ gem_context_set_param(fd, &param);
+ wrk->ctx_list[w->context].priority =
+ w->priority;
+ }
+ continue;
}
if (do_sleep || w->type == PERIOD) {
diff --git a/benchmarks/wsim/README b/benchmarks/wsim/README
index 01766d37..fd9bff34 100644
--- a/benchmarks/wsim/README
+++ b/benchmarks/wsim/README
@@ -3,6 +3,7 @@ Workload descriptor format
ctx.engine.duration_us.dependency.wait,...
<uint>.<str>.<uint>[-<uint>].<int <= 0>[/<int <= 0>][...].<0|1>,...
+P.<uint>.<int>
d|p|s|t|q|a.<int>,...
f
@@ -22,6 +23,7 @@ Additional workload steps are also supported:
'q' - Throttle to n max queue depth.
'f' - Create a sync fence.
'a' - Advance the previously created sync fence.
+ 'P' - Context priority.
Engine ids: RCS, BCS, VCS, VCS1, VCS2, VECS
@@ -110,3 +112,19 @@ created at the second step. They are submitted ahead of time while still not
runnable. When the second RCS batch completes the standalone fence is signaled
which allows the two VCS batches to be executed. Finally we wait until the both
VCS batches have completed before starting the (optional) next iteration.
+
+Context priority
+----------------
+
+ P.1.-1
+ 1.RCS.1000.0.0
+ P.2.1
+ 2.BCS.1000.-2.0
+
+Context 1 is marked as low priority (-1) and then a batch buffer is submitted
+against it. Context 2 is marked as high priority (1) and then a batch buffer
+is submitted against it which depends on the batch from context 1.
+
+Context priority command is executed at workload runtime and is valid until
+overriden by another (optional) same context priority change. Actual driver
+ioctls are executed only if the priority level has changed for the context.