All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 3/7] gem_wsim: Context priority support
Date: Tue, 14 Aug 2018 16:05:15 +0100	[thread overview]
Message-ID: <20180814150519.20204-4-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180814150519.20204-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

A new workload command ('P') is added which enables per context dynamic
priority control.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_wsim.c  | 48 +++++++++++++++++++++++++++++++++++++++++-
 benchmarks/wsim/README | 18 ++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index e5eb1ef70a35..34758419254a 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) {
@@ -1806,6 +1839,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 01766d37564f..fd9bff3401af 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.
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [igt-dev] [PATCH i-g-t 3/7] gem_wsim: Context priority support
Date: Tue, 14 Aug 2018 16:05:15 +0100	[thread overview]
Message-ID: <20180814150519.20204-4-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20180814150519.20204-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

A new workload command ('P') is added which enables per context dynamic
priority control.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 benchmarks/gem_wsim.c  | 48 +++++++++++++++++++++++++++++++++++++++++-
 benchmarks/wsim/README | 18 ++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index e5eb1ef70a35..34758419254a 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) {
@@ -1806,6 +1839,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 01766d37564f..fd9bff3401af 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.
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-08-14 15:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-14 15:05 [PATCH i-g-t 0/7] gem_wsim fixes and new features Tvrtko Ursulin
2018-08-14 15:05 ` [Intel-gfx] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 1/7] gem_wsim: Check sleep times Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:09   ` Chris Wilson
2018-08-14 15:09     ` Chris Wilson
2018-08-14 15:21     ` Tvrtko Ursulin
2018-08-14 15:21       ` Tvrtko Ursulin
2018-08-14 15:27       ` Chris Wilson
2018-08-14 15:27         ` Chris Wilson
2018-08-14 18:27         ` Tvrtko Ursulin
2018-08-14 18:27           ` Tvrtko Ursulin
2018-08-14 18:34           ` Chris Wilson
2018-08-14 18:34             ` Chris Wilson
2018-08-14 15:05 ` [PATCH i-g-t 2/7] gem_wsim: Make workload commands case sensitive Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:05 ` Tvrtko Ursulin [this message]
2018-08-14 15:05   ` [igt-dev] [PATCH i-g-t 3/7] gem_wsim: Context priority support Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 4/7] gem_wsim: Stop keeping batches mapped Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:13   ` Chris Wilson
2018-08-14 15:13     ` Chris Wilson
2018-08-14 15:16     ` Tvrtko Ursulin
2018-08-14 15:16       ` Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 5/7] gem_wsim: Make batches preemptable by default Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 6/7] gem_wsim: Per context preemption point control Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 15:05 ` [PATCH i-g-t 7/7] gem_wsim: Fix BCS usage under VCS2 remap warning Tvrtko Ursulin
2018-08-14 15:05   ` [igt-dev] " Tvrtko Ursulin
2018-08-14 16:27 ` [igt-dev] ✓ Fi.CI.BAT: success for gem_wsim fixes and new features Patchwork
2018-08-14 22:29 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180814150519.20204-4-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.