From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 06/10] gem_wsim: Support scaling workload batch durations
Date: Wed, 17 Jun 2020 17:01:16 +0100 [thread overview]
Message-ID: <20200617160120.16555-7-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20200617160120.16555-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-f <float> on the command line can be used to scale batch buffer durations
in all parsed workloads.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
benchmarks/gem_wsim.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index c1405596c46a..025385a144b8 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -41,6 +41,7 @@
#include <assert.h>
#include <limits.h>
#include <pthread.h>
+#include <math.h>
#include "intel_chipset.h"
#include "intel_reg.h"
@@ -853,6 +854,11 @@ static uint64_t engine_list_mask(const char *_str)
static void allocate_working_set(struct workload *wrk, struct working_set *set);
+static long __duration(long dur, double scale)
+{
+ return round(scale * dur);
+}
+
#define int_field(_STEP_, _FIELD_, _COND_, _ERR_) \
if ((field = strtok_r(fstart, ".", &fctx))) { \
tmp = atoi(field); \
@@ -863,7 +869,8 @@ static void allocate_working_set(struct workload *wrk, struct working_set *set);
} \
static struct workload *
-parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w)
+parse_workload(struct w_arg *arg, unsigned int flags, double scale_dur,
+ struct workload *app_w)
{
struct workload *wrk;
unsigned int nr_steps = 0;
@@ -1129,7 +1136,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w)
tmpl == LONG_MAX,
"Invalid duration at step %u!\n",
nr_steps);
- step.duration.min = tmpl;
+ step.duration.min = __duration(tmpl, scale_dur);
if (sep && *sep == '-') {
tmpl = strtol(sep + 1, NULL, 10);
@@ -1139,7 +1146,8 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w)
tmpl == LONG_MAX,
"Invalid duration range at step %u!\n",
nr_steps);
- step.duration.max = tmpl;
+ step.duration.max = __duration(tmpl,
+ scale_dur);
} else {
step.duration.max = step.duration.min;
}
@@ -2494,7 +2502,8 @@ static void print_help(void)
" command line. Subsequent -s switches it off.\n"
" -S Synchronize the sequence of random batch durations between\n"
" clients.\n"
-" -d Sync between data dependencies in userspace."
+" -d Sync between data dependencies in userspace.\n"
+" -f <scale> Scale factor for batch durations."
);
}
@@ -2556,6 +2565,7 @@ int main(int argc, char **argv)
struct w_arg *w_args = NULL;
unsigned int tolerance_pct = 1;
int exitcode = EXIT_FAILURE;
+ double scale_arg = 1.0f;
int prio = 0;
double t;
int i, c;
@@ -2576,7 +2586,7 @@ int main(int argc, char **argv)
master_prng = time(NULL);
while ((c = getopt(argc, argv,
- "ThqvsSdc:n:r:w:W:a:t:p:I:")) != -1) {
+ "ThqvsSdc:n:r:w:W:a:t:p:I:f:")) != -1) {
switch (c) {
case 'W':
if (master_workload >= 0) {
@@ -2687,6 +2697,9 @@ int main(int argc, char **argv)
case 'I':
master_prng = strtol(optarg, NULL, 0);
break;
+ case 'f':
+ scale_arg = atof(optarg);
+ break;
case 'h':
print_help();
goto out;
@@ -2744,7 +2757,7 @@ int main(int argc, char **argv)
if (append_workload_arg) {
struct w_arg arg = { NULL, append_workload_arg, 0 };
- app_w = parse_workload(&arg, flags, NULL);
+ app_w = parse_workload(&arg, flags, scale_arg, NULL);
if (!app_w) {
wsim_err("Failed to parse append workload!\n");
goto err;
@@ -2762,7 +2775,7 @@ int main(int argc, char **argv)
goto err;
}
- wrk[i] = parse_workload(&w_args[i], flags, app_w);
+ wrk[i] = parse_workload(&w_args[i], flags, scale_arg, app_w);
if (!wrk[i]) {
wsim_err("Failed to parse workload %u!\n", i);
goto err;
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-06-17 16:01 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 16:01 [Intel-gfx] [PATCH i-g-t 00/10] gem_wsim improvements Tvrtko Ursulin
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 01/10] gem_wsim: Rip out userspace balancing Tvrtko Ursulin
2020-06-17 16:07 ` Chris Wilson
2020-06-18 7:14 ` Chris Wilson
2020-06-18 7:40 ` Tvrtko Ursulin
2020-06-18 7:55 ` Chris Wilson
2020-06-18 10:03 ` Tvrtko Ursulin
2020-06-18 10:05 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 02/10] gem_wsim: Buffer objects working sets and complex dependencies Tvrtko Ursulin
2020-06-17 16:57 ` Chris Wilson
2020-06-18 9:05 ` Tvrtko Ursulin
2020-06-18 9:22 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 03/10] gem_wsim: Show workload timing stats Tvrtko Ursulin
2020-06-17 16:58 ` Chris Wilson
2020-06-18 7:46 ` Tvrtko Ursulin
2020-06-18 7:57 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 04/10] gem_wsim: Move BO allocation to a helper Tvrtko Ursulin
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 05/10] gem_wsim: Support random buffer sizes Tvrtko Ursulin
2020-06-17 16:31 ` Chris Wilson
2020-06-18 8:06 ` Tvrtko Ursulin
2020-06-17 16:01 ` Tvrtko Ursulin [this message]
2020-06-17 16:22 ` [Intel-gfx] [PATCH i-g-t 06/10] gem_wsim: Support scaling workload batch durations Chris Wilson
2020-06-18 8:01 ` Tvrtko Ursulin
2020-06-18 8:07 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 07/10] gem_wsim: Log max and active working set sizes in verbose mode Tvrtko Ursulin
2020-06-17 17:07 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 08/10] gem_wsim: Snippet of a workload extracted from carchase Tvrtko Ursulin
2020-06-17 17:45 ` Chris Wilson
2020-06-18 7:53 ` Tvrtko Ursulin
2020-06-18 8:02 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 09/10] gem_wsim: Implement device selection Tvrtko Ursulin
2020-06-17 17:09 ` Chris Wilson
2020-06-17 16:01 ` [Intel-gfx] [PATCH i-g-t 10/10] gem_wsim: Fix calibration handling Tvrtko Ursulin
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=20200617160120.16555-7-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox