trace.pl: Add support for colouring context execution
PATCH 1/7 trace.pl: Add support for colouring context execution
From: Tvrtko Ursulin <[email protected]>
Add the command line switch which uses different colours for different context execution boxes.
v2:
* Use HSL to simplify color generation. (Lionel)
* Colour other boxes in the same colour but different shade so it is easier to follow the timeline.
--- scripts/trace.pl | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-)
scripts/trace.pl +48 -6
@@ -40,6 +40,7 @@ my $trace = 0; my $avg_delay_stats = 0; my $squash_context_id = 0; my $gpu_timeline = 0; +my $colour_contexts = 0; my @args;
@@ -110,6 +111,8 @@ Usage: --squash-ctx-id Squash context id by substracting engine id from ctx id. --gpu-timeline Draw overall GPU busy timeline. + --colour-contexts / -c Use different colours for different + context execution boxes. ENDHELP exit 0;
@@ -279,6 +282,20 @@ sub arg_skip_box return @_; } +sub arg_colour_contexts +{ + return unless scalar(@_); + + if ($_[0] eq '--colour-contexts' or + $_[0] eq '--color-contexts' or + $_[0] eq '-c') { + shift @_; + $colour_contexts = 1; + } + + return @_; +} + @args = @ARGV; while (@args) { my $left = scalar(@args);
@@ -294,6 +311,7 @@ while (@args) { @args = arg_split_requests(@args); @args = arg_ignore_ring(@args); @args = arg_skip_box(@args); + @args = arg_colour_contexts(@args); last if $left == scalar(@args); }
@@ -581,6 +599,7 @@ foreach my $key (@sorted_keys) { my $last_ts = 0; my $first_ts; +my ($min_ctx, $max_ctx); foreach my $key (@sorted_keys) { my $ring = $db{$key}->{'ring'};
@@ -590,6 +609,10 @@ foreach my $key (@sorted_keys) { $first_ts = $db{$key}->{'queue'} if not defined $first_ts or $db{$key}->{'queue'} < $first_ts; $last_ts = $end if $end > $last_ts; + $min_ctx = $db{$key}->{'ctx'} if not defined $min_ctx or + $db{$key}->{'ctx'} < $min_ctx; + $max_ctx = $db{$key}->{'ctx'} if not defined $max_ctx or + $db{$key}->{'ctx'} > $max_ctx; $db{$key}->{'context-complete-delay'} = $end - $notify; $db{$key}->{'execute-delay'} = $start - $db{$key}->{'submit'};
@@ -720,6 +743,10 @@ foreach my $key (keys %reqwait) { say sprintf('GPU: %.2f%% idle, %.2f%% busy', $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html; +my $queued_colour = $colour_contexts ? 'multi-colour light' : 'blue'; +my $runnable_colour = $colour_contexts ? 'multi-colour dark' : 'grey'; +my $execute_colour = $colour_contexts ? 'multi-colour' : 'pink'; + print <<ENDHTML if $html; <!DOCTYPE HTML> <html>
@@ -740,9 +767,9 @@ print <<ENDHTML if $html; <button onclick="toggleStackSubgroups()">Toggle stacking</button> <p> -pink = requests executing on the GPU<br> -grey = runnable requests waiting for a slot on GPU<br> -blue = requests waiting on fences and dependencies before they are runnable<br> +$execute_colour = requests executing on the GPU<br> +$runnable_colour = runnable requests waiting for a slot on GPU<br> +$queued_colour = requests waiting on fences and dependencies before they are runnable<br> </p> <p> Boxes are in format 'ctx-id/seqno'.
@@ -860,6 +887,18 @@ sub sortQueue { return $val; } +sub ctx_colour +{ + my ($ctx, $s, $l) = (@_); + my $val; + + return 'Pink;' unless $colour_contexts; + + $val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx); + + return "hsl($val, $s%, $l%);"; +} + my $i = 0; foreach my $key (sort sortQueue keys %db) { my ($name, $ctx, $seqno) = ($db{$key}->{'name'}, $db{$key}->{'ctx'}, $db{$key}->{'seqno'});
@@ -874,7 +913,8 @@ foreach my $key (sort sortQueue keys %db) { # submit to execute unless (exists $skip_box{'queue'}) { $skey = 2 * $max_seqno * $ctx + 2 * $seqno; - $style = 'color: black; background-color: lightblue;'; + $style = 'color: black; background-color: ' . + ctx_colour($ctx, 35, 85); $content = "$name<br>$db{$key}->{'submit-delay'}us <small>($db{$key}->{'execute-delay'}us)</small>"; $startend = 'start: \'' . ts($queue) . '\', end: \'' . ts($submit) . '\''; print "\t{id: $i, key: $skey, $type group: $group, subgroup: 1, subgroupOrder: 1, content: '$content', $startend, style: \'$style\'},\n";
@@ -884,7 +924,8 @@ foreach my $key (sort sortQueue keys %db) { # execute to start unless (exists $skip_box{'ready'}) { $skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1; - $style = 'color: black; background-color: lightgrey;'; + $style = 'color: black; background-color: ' . + ctx_colour($ctx, 35, 45); $content = "<small>$name<br>$db{$key}->{'execute-delay'}us</small>"; $startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\''; print "\t{id: $i, key: $skey, $type group: $group, subgroup: 1, subgroupOrder: 2, content: '$content', $startend, style: \'$style\'},\n";
@@ -897,7 +938,8 @@ foreach my $key (sort sortQueue keys %db) { if (exists $db{$key}->{'incomplete'}) { $style = 'color: white; background-color: red;'; } else { - $style = 'color: black; background-color: pink;'; + $style = 'color: black; background-color: ' . + ctx_colour($ctx, 80, 65); } $content = "$name <small>$db{$key}->{'port'}</small>"; $content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/7 trace.pl: Improve readability of graphical timeline representation
From: Tvrtko Ursulin <[email protected]>
We add stripes for different stages of request execution so it is easier to follow one context in the multi-colour mode.
Vertical stripe pattern indicates pipeline "blockages" - requests waiting for dependencies before they are runnable.
Diagonal stripes indicate runnable requests waiting for GPU time.
Horizontal strips are requests executing on the GPU.
--- scripts/media-bench.pl | 2 +- scripts/trace.pl | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-)
scripts/media-bench.pl +1 -1
@@ -207,7 +207,7 @@ sub trace_workload show_cmd($cmd); system($cmd); - $cmd = "perf script | $tracepl --html -x ctxsave -s --squash-ctx-id "; + $cmd = "perf script | $tracepl --html -x ctxsave -s -c --squash-ctx-id "; $cmd .= join ' ', map("-i $_", @skip_engine); $cmd .= " > ${file}.html"; show_cmd($cmd);
scripts/trace.pl +19 -10
@@ -743,9 +743,9 @@ foreach my $key (keys %reqwait) { say sprintf('GPU: %.2f%% idle, %.2f%% busy', $flat_busy{'gpu-idle'}, $flat_busy{'gpu-busy'}) unless $html; -my $queued_colour = $colour_contexts ? 'multi-colour light' : 'blue'; -my $runnable_colour = $colour_contexts ? 'multi-colour dark' : 'grey'; -my $execute_colour = $colour_contexts ? 'multi-colour' : 'pink'; +my $queued_colour = $colour_contexts ? 'multi-colour light, vertical stripes' : 'blue'; +my $runnable_colour = $colour_contexts ? 'multi-colour dark, angled stripes' : 'grey'; +my $execute_colour = $colour_contexts ? 'multi-colour, horizontal stripes' : 'pink'; print <<ENDHTML if $html; <!DOCTYPE HTML>
@@ -896,7 +896,19 @@ sub ctx_colour $val = int(360 / ($max_ctx - $min_ctx + 1)) * ($ctx - $min_ctx); - return "hsl($val, $s%, $l%);"; + return "hsl($val, $s%, $l%)"; +} + +sub box_style +{ + my ($ctx, $deg, $s, $l) = @_; + + return 'color: black; background: repeating-linear-gradient(' . + $deg . 'deg, ' . + ctx_colour($ctx, $s, $l) . ', ' . + ctx_colour($ctx, $s, $l) . ' 10px, ' . + ctx_colour($ctx, $s, int($l * 0.90)) . ' 10px, ' . + ctx_colour($ctx, $s, int($l * 0.90)) . ' 20px);'; } my $i = 0;
@@ -913,8 +925,7 @@ foreach my $key (sort sortQueue keys %db) { # submit to execute unless (exists $skip_box{'queue'}) { $skey = 2 * $max_seqno * $ctx + 2 * $seqno; - $style = 'color: black; background-color: ' . - ctx_colour($ctx, 35, 85); + $style = box_style($ctx, 90, 35, 85); $content = "$name<br>$db{$key}->{'submit-delay'}us <small>($db{$key}->{'execute-delay'}us)</small>"; $startend = 'start: \'' . ts($queue) . '\', end: \'' . ts($submit) . '\''; print "\t{id: $i, key: $skey, $type group: $group, subgroup: 1, subgroupOrder: 1, content: '$content', $startend, style: \'$style\'},\n";
@@ -924,8 +935,7 @@ foreach my $key (sort sortQueue keys %db) { # execute to start unless (exists $skip_box{'ready'}) { $skey = 2 * $max_seqno * $ctx + 2 * $seqno + 1; - $style = 'color: black; background-color: ' . - ctx_colour($ctx, 35, 45); + $style = box_style($ctx, 45, 35, 45); $content = "<small>$name<br>$db{$key}->{'execute-delay'}us</small>"; $startend = 'start: \'' . ts($submit) . '\', end: \'' . ts($start) . '\''; print "\t{id: $i, key: $skey, $type group: $group, subgroup: 1, subgroupOrder: 2, content: '$content', $startend, style: \'$style\'},\n";
@@ -938,8 +948,7 @@ foreach my $key (sort sortQueue keys %db) { if (exists $db{$key}->{'incomplete'}) { $style = 'color: white; background-color: red;'; } else { - $style = 'color: black; background-color: ' . - ctx_colour($ctx, 80, 65); + $style = box_style($ctx, 0, 80, 65); } $content = "$name <small>$db{$key}->{'port'}</small>"; $content .= ' <small><i>???</i></small> ' if exists $db{$key}->{'incomplete'};
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 3/7 trace.pl: Remove context squashing option
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Timeline id allocation order is not tied with engine ids any more.
Remove the option which assumed that was the case in attempt to provide more readable timeline.
--- scripts/media-bench.pl | 2 +- scripts/trace.pl | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-)
scripts/media-bench.pl +1 -1
@@ -207,7 +207,7 @@ sub trace_workload show_cmd($cmd); system($cmd); - $cmd = "perf script | $tracepl --html -x ctxsave -s -c --squash-ctx-id "; + $cmd = "perf script | $tracepl --html -x ctxsave -s -c "; $cmd .= join ' ', map("-i $_", @skip_engine); $cmd .= " > ${file}.html"; show_cmd($cmd);
scripts/trace.pl +0 -18
@@ -38,7 +38,6 @@ my %skip_box; my $html = 0; my $trace = 0; my $avg_delay_stats = 0; -my $squash_context_id = 0; my $gpu_timeline = 0; my $colour_contexts = 0;
@@ -108,8 +107,6 @@ Usage: --html Generate HTML output. --trace cmd Trace the following command. --avg-delay-stats Print average delay stats. - --squash-ctx-id Squash context id by substracting engine - id from ctx id. --gpu-timeline Draw overall GPU busy timeline. --colour-contexts / -c Use different colours for different context execution boxes.
@@ -145,18 +142,6 @@ sub arg_avg_delay_stats return @_; } -sub arg_squash_ctx_id -{ - return unless scalar(@_); - - if ($_[0] eq '--squash-ctx-id') { - shift @_; - $squash_context_id = 1; - } - - return @_; -} - sub arg_gpu_timeline { return unless scalar(@_);
@@ -303,7 +288,6 @@ while (@args) { @args = arg_help(@args); @args = arg_html(@args); @args = arg_avg_delay_stats(@args); - @args = arg_squash_ctx_id(@args); @args = arg_gpu_timeline(@args); @args = arg_trace(@args); @args = arg_max_items(@args);
@@ -338,8 +322,6 @@ sub sanitize_ctx { my ($ctx, $ring) = @_; - $ctx = $ctx - $ring if $squash_context_id; - if (exists $ctxdb{$ctx}) { return $ctx . '.' . $ctxdb{$ctx}; } else {
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 4/7 trace.pl: Fix engine busy accounting in split mode
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
In split mode all requests have to be added up since they were previously re-arranged so there is no overlap.
--- scripts/trace.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/trace.pl +2 -1
@@ -601,7 +601,8 @@ foreach my $key (@sorted_keys) { $db{$key}->{'submit-delay'} = $db{$key}->{'submit'} - $db{$key}->{'queue'}; $db{$key}->{'duration'} = $notify - $start; - $running{$ring} += $end - $start unless exists $db{$key}->{'no-end'}; + $running{$ring} += $end - $start if $correct_durations or + not exists $db{$key}->{'no-end'}; $runnable{$ring} += $db{$key}->{'execute-delay'}; $queued{$ring} += $start - $db{$key}->{'execute-delay'} - $db{$key}->{'queue'};
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 5/7 trace.pl: Fix incomplete request handling
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Incomplete requests (no notify, no context complete) have to be corrected by looking at the engine timeline, and not the sorted-by-start-time view as was previously used.
Per-engine timelines are generated on demand and cached for later use.
v2: Find end of current context on the engine timeline instead of just
using the next request for adjusting the incomplete start time.
v3: Improve scaling with large datasets by only walking each engine
timeline once and some caching. (John Harrison)
--- scripts/trace.pl | 102 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 27 deletions(-)
scripts/trace.pl +75 -27
@@ -498,39 +498,83 @@ foreach my $key (keys %db) { } } -# Fix up incompletes my $key_count = scalar(keys %db); -foreach my $key (keys %db) { - next unless exists $db{$key}->{'incomplete'}; - # End the incomplete batch at the time next one starts - my $ring = $db{$key}->{'ring'}; - my $ctx = $db{$key}->{'ctx'}; - my $seqno = $db{$key}->{'seqno'}; - my $next_key; - my $i = 1; - my $end; - - do { - $next_key = db_key($ring, $ctx, $seqno + $i); - $i++; - } until ((exists $db{$next_key} and not exists $db{$next_key}->{'incomplete'}) - or $i > $key_count); # ugly stop hack +my %engine_timelines; - if (exists $db{$next_key}) { - $end = $db{$next_key}->{'end'}; - } else { - # No info at all, fake it: - $end = $db{$key}->{'start'} + 999; - } +sub sortEngine { + my $as = $db{$a}->{'global'}; + my $bs = $db{$b}->{'global'}; + my $val; - $db{$key}->{'notify'} = $end; - $db{$key}->{'end'} = $end; + $val = $as <=> $bs; + + die if $val == 0; + + return $val; } -# GPU time accounting -my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count); -my (%submit_avg, %execute_avg, %ctxsave_avg); +sub get_engine_timeline { + my ($ring) = @_; + my @timeline; + + return $engine_timelines{$ring} if exists $engine_timelines{$ring}; + + @timeline = grep { $db{$_}->{'ring'} == $ring } keys %db; + # FIXME seqno restart + @timeline = sort sortEngine @timeline; + + $engine_timelines{$ring} = \@timeline; + + return \@timeline; +} + +# Fix up incompletes by ending them when the last request of a coalesced group +# ends. (Or first of a different context starts.) +foreach my $gid (sort keys %rings) { + my $ring = $ringmap{$rings{$gid}}; + my $timeline = get_engine_timeline($ring); + my $last_complete = -1; + my $complete; + + foreach my $pos (0..$#{$timeline}) { + my $key = @{$timeline}[$pos]; + my $end; + + next unless exists $db{$key}->{'incomplete'}; + + # Find first following complete request + if ($pos > $last_complete) { + my $next = $pos; + + undef $complete; + + while ($next < $#{$timeline}) { + my $next_key = ${$timeline}[++$next]; + + next if exists $db{$next_key}->{'incomplete'}; + + $last_complete = $next; + $complete = $next_key; + last; + } + } + + if (defined $complete) { + if ($db{$key}->{'ctx'} == $db{$complete}->{'ctx'}) { + $end = $db{$complete}->{'end'}; + } else { + $end = $db{$complete}->{'start'}; + } + } else { + # No next submission, fake it. + $end = $db{$key}->{'start'} + 999; + } + + $db{$key}->{'notify'} = $end; + $db{$key}->{'end'} = $end; + } +} sub sortStart { my $as = $db{$a}->{'start'};
@@ -579,6 +623,10 @@ foreach my $key (@sorted_keys) { @sorted_keys = sort sortStart keys %db if $re_sort; +# GPU time accounting +my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count); +my (%submit_avg, %execute_avg, %ctxsave_avg); + my $last_ts = 0; my $first_ts; my ($min_ctx, $max_ctx);
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 6/7 trace.pl: Basic preemption support
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Just forget about earlier request_in events.
--- scripts/trace.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/trace.pl +3 -1
@@ -425,7 +425,9 @@ while (<>) { } elsif ($tp_name eq 'i915:i915_request_in:') { my %req; - die if exists $db{$key}; + # preemption + delete $db{$key} if exists $db{$key}; + die unless exists $queue{$key}; die unless exists $submit{$key};
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 7/7 trace.pl: Fix request split mode
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Request split mode had several bugs, both in the original version and also after the recent refactorings.
One big one was that it wasn't considering different submit ports as a reason to split execution, and also that it was too time based instead of looking at relevant timelines.
In this refactoring we address the former by using the engine timelines introduced in the previous patch. Secondary port submissions are moved to follow the preceding submission as a first step in the correction process.
In the second step, we add context timelines and use then in a similar fashion to separate start and end time of coalesced requests. For each coalesced request we know its boundaries by looking at the engine timeline (via global seqnos), and we know the previous request it should only start after, by looking at the context timeline.
v2:
* Remove some dead code.
* Fix !port0 shifting logic.
v3:
* Refactor for less list walking as with incomplete handling.
--- scripts/trace.pl | 126 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 98 insertions(+), 28 deletions(-)
scripts/trace.pl +98 -28
@@ -27,7 +27,7 @@ use warnings; use 5.010; my $gid = 0; -my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait); +my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait, @ctxtimelines); my @freqs; my $max_items = 3000;
@@ -435,6 +435,7 @@ while (<>) { $req{'ring'} = $ring; $req{'seqno'} = $seqno; $req{'ctx'} = $ctx; + push @ctxtimelines, $ctx . '/' . $ring; $req{'name'} = $ctx . '/' . $seqno; $req{'global'} = $tp{'global'}; $req{'port'} = $tp{'port'};
@@ -589,41 +590,110 @@ sub sortStart { return $val; } -my @sorted_keys = sort sortStart keys %db; -my $re_sort = 0; +my $re_sort = 1; +my @sorted_keys; -die "Database changed size?!" unless scalar(@sorted_keys) == $key_count; +sub maybe_sort_keys +{ + if ($re_sort) { + @sorted_keys = sort sortStart keys %db; + $re_sort = 0; + die "Database changed size?!" unless scalar(@sorted_keys) == + $key_count; + } +} -foreach my $key (@sorted_keys) { - my $ring = $db{$key}->{'ring'}; - my $end = $db{$key}->{'end'}; +maybe_sort_keys(); + +my %ctx_timelines; + +sub sortContext { + my $as = $db{$a}->{'seqno'}; + my $bs = $db{$b}->{'seqno'}; + my $val; + + $val = $as <=> $bs; + + die if $val == 0; + + return $val; +} + +sub get_ctx_timeline { + my ($ctx, $ring, $key) = @_; + my @timeline; + + return $ctx_timelines{$key} if exists $ctx_timelines{$key}; + + @timeline = grep { $db{$_}->{'ring'} == $ring and + $db{$_}->{'ctx'} == $ctx } @sorted_keys; + # FIXME seqno restart + @timeline = sort sortContext @timeline; + + $ctx_timelines{$key} = \@timeline; + + return \@timeline; +} + +# Split out merged batches if requested. +if ($correct_durations) { + # Shift !port0 requests start time to after the previous context on the + # same timeline has finished. + foreach my $gid (sort keys %rings) { + my $ring = $ringmap{$rings{$gid}}; + my $timeline = get_engine_timeline($ring); + my $complete; + + foreach my $pos (0..$#{$timeline}) { + my $key = @{$timeline}[$pos]; + my $prev = $complete; + my $pkey; + + $complete = $key unless exists $db{$key}->{'no-end'}; + $pkey = $complete; + + next if $db{$key}->{'port'} == 0; + + $pkey = $prev if $complete eq $key; + + die unless defined $pkey; + + $db{$key}->{'start'} = $db{$pkey}->{'end'}; + $db{$key}->{'start'} = $db{$pkey}->{'notify'} if $db{$key}->{'start'} > $db{$key}->{'end'}; + + die if $db{$key}->{'start'} > $db{$key}->{'end'}; + + $re_sort = 1; + } + } + + maybe_sort_keys(); + + # Batch with no-end (no request_out) means it was submitted as part of + # colaesced context. This means it's start time should be set to end + # time of a following request on this timeline. + foreach my $tkey (sort @ctxtimelines) { + my ($ctx, $ring) = split '/', $tkey; + my $timeline = get_ctx_timeline($ctx, $ring, $tkey); + my $last_complete = -1; + my $complete; + + foreach my $pos (0..$#{$timeline}) { + my $key = @{$timeline}[$pos]; + my $next_key; + + next unless exists $db{$key}->{'no-end'}; + last if $pos == $#{$timeline}; - # correct duration of merged batches - if ($correct_durations and exists $db{$key}->{'no-end'}) { - my $ctx = $db{$key}->{'ctx'}; - my $seqno = $db{$key}->{'seqno'}; - my $start = $db{$key}->{'start'}; - my $next_key; - my $i = 1; - - do { - $next_key = db_key($ring, $ctx, $seqno + $i); - $i++; - } until (exists $db{$next_key} or $i > $key_count); # ugly stop hack - - # 20us tolerance - if (exists $db{$next_key} and $db{$next_key}->{'start'} < $start + 20) { - my $notify = $db{$key}->{'notify'}; + # Shift following request to start after the current one + $next_key = ${$timeline}[$pos + 1]; + $db{$next_key}->{'start'} = $db{$key}->{'notify'}; $re_sort = 1; - $db{$next_key}->{'start'} = $notify; - $db{$next_key}->{'start'} = $db{$next_key}->{'end'} if $db{$next_key}->{'start'} > $db{$next_key}->{'end'}; - die if $db{$next_key}->{'start'} > $db{$next_key}->{'end'}; } - die if $start > $end; } } -@sorted_keys = sort sortStart keys %db if $re_sort; +maybe_sort_keys(); # GPU time accounting my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v4 7/7 trace.pl: Fix request split mode
From: Tvrtko Ursulin <[email protected]>
Request split mode had several bugs, both in the original version and also after the recent refactorings.
One big one was that it wasn't considering different submit ports as a reason to split execution, and also that it was too time based instead of looking at relevant timelines.
In this refactoring we address the former by using the engine timelines introduced in the previous patch. Secondary port submissions are moved to follow the preceding submission as a first step in the correction process.
In the second step, we add context timelines and use then in a similar fashion to separate start and end time of coalesced requests. For each coalesced request we know its boundaries by looking at the engine timeline (via global seqnos), and we know the previous request it should only start after, by looking at the context timeline.
v2:
* Remove some dead code.
* Fix !port0 shifting logic.
v3:
* Refactor for less list walking as with incomplete handling.
v4:
* Database of context timelines should not contain duplicates! (Converted from array into a hash.)
--- scripts/trace.pl | 126 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 98 insertions(+), 28 deletions(-)
scripts/trace.pl +98 -28
@@ -27,7 +27,7 @@ use warnings; use 5.010; my $gid = 0; -my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait); +my (%db, %queue, %submit, %notify, %rings, %ctxdb, %ringmap, %reqwait, %ctxtimelines); my @freqs; my $max_items = 3000;
@@ -435,6 +435,7 @@ while (<>) { $req{'ring'} = $ring; $req{'seqno'} = $seqno; $req{'ctx'} = $ctx; + $ctxtimelines{$ctx . '/' . $ring} = 1; $req{'name'} = $ctx . '/' . $seqno; $req{'global'} = $tp{'global'}; $req{'port'} = $tp{'port'};
@@ -589,41 +590,110 @@ sub sortStart { return $val; } -my @sorted_keys = sort sortStart keys %db; -my $re_sort = 0; +my $re_sort = 1; +my @sorted_keys; -die "Database changed size?!" unless scalar(@sorted_keys) == $key_count; +sub maybe_sort_keys +{ + if ($re_sort) { + @sorted_keys = sort sortStart keys %db; + $re_sort = 0; + die "Database changed size?!" unless scalar(@sorted_keys) == + $key_count; + } +} -foreach my $key (@sorted_keys) { - my $ring = $db{$key}->{'ring'}; - my $end = $db{$key}->{'end'}; +maybe_sort_keys(); + +my %ctx_timelines; + +sub sortContext { + my $as = $db{$a}->{'seqno'}; + my $bs = $db{$b}->{'seqno'}; + my $val; + + $val = $as <=> $bs; + + die if $val == 0; + + return $val; +} + +sub get_ctx_timeline { + my ($ctx, $ring, $key) = @_; + my @timeline; + + return $ctx_timelines{$key} if exists $ctx_timelines{$key}; + + @timeline = grep { $db{$_}->{'ring'} == $ring and + $db{$_}->{'ctx'} == $ctx } @sorted_keys; + # FIXME seqno restart + @timeline = sort sortContext @timeline; + + $ctx_timelines{$key} = \@timeline; + + return \@timeline; +} + +# Split out merged batches if requested. +if ($correct_durations) { + # Shift !port0 requests start time to after the previous context on the + # same timeline has finished. + foreach my $gid (sort keys %rings) { + my $ring = $ringmap{$rings{$gid}}; + my $timeline = get_engine_timeline($ring); + my $complete; + + foreach my $pos (0..$#{$timeline}) { + my $key = @{$timeline}[$pos]; + my $prev = $complete; + my $pkey; + + $complete = $key unless exists $db{$key}->{'no-end'}; + $pkey = $complete; + + next if $db{$key}->{'port'} == 0; + + $pkey = $prev if $complete eq $key; + + die unless defined $pkey; + + $db{$key}->{'start'} = $db{$pkey}->{'end'}; + $db{$key}->{'start'} = $db{$pkey}->{'notify'} if $db{$key}->{'start'} > $db{$key}->{'end'}; + + die if $db{$key}->{'start'} > $db{$key}->{'end'}; + + $re_sort = 1; + } + } + + maybe_sort_keys(); + + # Batch with no-end (no request_out) means it was submitted as part of + # colaesced context. This means it's start time should be set to end + # time of a following request on this timeline. + foreach my $tkey (sort keys %ctxtimelines) { + my ($ctx, $ring) = split '/', $tkey; + my $timeline = get_ctx_timeline($ctx, $ring, $tkey); + my $last_complete = -1; + my $complete; + + foreach my $pos (0..$#{$timeline}) { + my $key = @{$timeline}[$pos]; + my $next_key; + + next unless exists $db{$key}->{'no-end'}; + last if $pos == $#{$timeline}; - # correct duration of merged batches - if ($correct_durations and exists $db{$key}->{'no-end'}) { - my $ctx = $db{$key}->{'ctx'}; - my $seqno = $db{$key}->{'seqno'}; - my $start = $db{$key}->{'start'}; - my $next_key; - my $i = 1; - - do { - $next_key = db_key($ring, $ctx, $seqno + $i); - $i++; - } until (exists $db{$next_key} or $i > $key_count); # ugly stop hack - - # 20us tolerance - if (exists $db{$next_key} and $db{$next_key}->{'start'} < $start + 20) { - my $notify = $db{$key}->{'notify'}; + # Shift following request to start after the current one + $next_key = ${$timeline}[$pos + 1]; + $db{$next_key}->{'start'} = $db{$key}->{'notify'}; $re_sort = 1; - $db{$next_key}->{'start'} = $notify; - $db{$next_key}->{'start'} = $db{$next_key}->{'end'} if $db{$next_key}->{'start'} > $db{$next_key}->{'end'}; - die if $db{$next_key}->{'start'} > $db{$next_key}->{'end'}; } - die if $start > $end; } } -@sorted_keys = sort sortStart keys %db if $re_sort; +maybe_sort_keys(); # GPU time accounting my (%running, %runnable, %queued, %batch_avg, %batch_total_avg, %batch_count);
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution
URL : https://patchwork.freedesktop.org/series/42887/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4158 -> IGTPW_1328 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/42887/revisions/1/mbox/
== Known issues ==
Here are the changes found in IGTPW_1328 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@debugfs_test@read_all_entries:
fi-snb-2520m: PASS -> INCOMPLETE (fdo#103713)
==== Possible fixes ====
igt@gem_exec_suspend@basic-s3:
fi-skl-guc: FAIL (fdo#105900, fdo#104699) -> PASS
igt@gem_exec_suspend@basic-s4-devices:
fi-kbl-7500u: DMESG-WARN (fdo#105128) -> PASS
igt@kms_frontbuffer_tracking@basic:
fi-hsw-4200u: DMESG-FAIL (fdo#102614, fdo#106103) -> PASS fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#104699 https://bugs.freedesktop.org/show_bug.cgi?id=104699
fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103
== Participating hosts (40 -> 37) ==
Additional (1): fi-byt-j1900
Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-skl-6700hq
== Build changes ==
* IGT: IGT_4465 -> IGTPW_1328
* Piglit: piglit_4465 -> piglit_4467
CI_DRM_4158: b4cf5831333d423c2420f167111c03e4c1729672 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1328: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1328/
IGT_4465: 41eb85f918b02918787fc59d9cb5aab93b81f323 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4465: 33e58d5583eb7ed3966a1b905f875a1dfa959f6b @ git://anongit.freedesktop.org/piglit
piglit_4467: dd20daa579c816498f61e08c819117ad6eb4b4a5 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1328/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution
URL : https://patchwork.freedesktop.org/series/42887/
State : failure
== Summary ==
= CI Bug Log - changes from IGT_4465_full -> IGTPW_1328_full =
== Summary - FAILURE ==
Serious unknown changes coming with IGTPW_1328_full absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_1328_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/42887/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1328_full:
=== IGT changes ===
==== Possible regressions ====
igt@gem_eio@hibernate:
shard-kbl: PASS -> DMESG-FAIL
igt@perf@non-system-wide-paranoid:
shard-kbl: PASS -> FAIL
==== Warnings ====
igt@gem_mocs_settings@mocs-rc6-vebox:
shard-kbl: PASS -> SKIP +2== Known issues ==
Here are the changes found in IGTPW_1328_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_flip@2x-plain-flip-fb-recreate:
shard-hsw: PASS -> FAIL (fdo#100368)
igt@kms_flip@absolute-wf_vblank-interruptible:
shard-glk: PASS -> FAIL (fdo#106087)
igt@kms_flip@flip-vs-expired-vblank-interruptible:
shard-glk: PASS -> FAIL (fdo#105707)
igt@kms_flip@plain-flip-ts-check-interruptible:
shard-glk: PASS -> FAIL (fdo#100368)
igt@kms_setmode@basic:
shard-kbl: PASS -> FAIL (fdo#99912)
igt@perf@blocking:
shard-hsw: PASS -> FAIL (fdo#102252)
igt@perf@buffer-fill:
shard-kbl: PASS -> DMESG-FAIL (fdo#106064)
==== Possible fixes ====
igt@gem_ppgtt@blt-vs-render-ctxn:
shard-kbl: INCOMPLETE (fdo#106023, fdo#103665) -> PASS
igt@kms_flip@2x-dpms-vs-vblank-race-interruptible:
shard-hsw: FAIL (fdo#103060) -> PASS +1
igt@kms_flip@flip-vs-wf_vblank-interruptible:
shard-glk: FAIL (fdo#100368) -> PASS
igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
shard-apl: FAIL (fdo#103167, fdo#104724) -> PASS
igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
shard-snb: FAIL (fdo#103166, fdo#104724) -> PASS
igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
shard-kbl: INCOMPLETE (fdo#103665) -> PASS fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105707 https://bugs.freedesktop.org/show_bug.cgi?id=105707
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106064 https://bugs.freedesktop.org/show_bug.cgi?id=106064
fdo#106087 https://bugs.freedesktop.org/show_bug.cgi?id=106087
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (5 -> 5) ==
No changes in participating hosts
== Build changes ==
* IGT: IGT_4465 -> IGTPW_1328
* Linux: CI_DRM_4157 -> CI_DRM_4158
* Piglit: piglit_4465 -> piglit_4467
CI_DRM_4157: 580a7e5eafe15dd21f0dfc92d860a57a404e622d @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4158: b4cf5831333d423c2420f167111c03e4c1729672 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1328: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1328/
IGT_4465: 41eb85f918b02918787fc59d9cb5aab93b81f323 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4465: 33e58d5583eb7ed3966a1b905f875a1dfa959f6b @ git://anongit.freedesktop.org/piglit
piglit_4467: dd20daa579c816498f61e08c819117ad6eb4b4a5 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1328/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution (rev2)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution (rev2)
URL : https://patchwork.freedesktop.org/series/42887/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4163 -> IGTPW_1334 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/42887/revisions/2/mbox/
== Known issues ==
Here are the changes found in IGTPW_1334 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
fi-skl-guc: PASS -> FAIL (fdo#103191, fdo#104724)
==== Possible fixes ====
igt@drv_module_reload@basic-reload-inject:
fi-glk-j4005: DMESG-WARN (fdo#106248) -> PASS
igt@kms_flip@basic-flip-vs-wf_vblank:
fi-hsw-4770r: FAIL (fdo#100368) -> PASS fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
== Participating hosts (41 -> 37) ==
Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-skl-6700hq
== Build changes ==
* IGT: IGT_4468 -> IGTPW_1334
CI_DRM_4163: 8e1dab6e913be7d014eb9bc355ec65b6b56dcd56 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1334: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1334/
IGT_4468: 548a894dc904c4628522dbbc77cb179a4c965ebc @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4468: 1e60f1499e5b71b6d5a747189d7c28f57359a87f @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1334/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution (rev2)
In reply to Tvrtko Ursulin== Series Details ==
== Series Details ==
Series: series starting with [i-g-t,1/7] trace.pl: Add support for colouring context execution (rev2)
URL : https://patchwork.freedesktop.org/series/42887/
State : success
== Summary ==
= CI Bug Log - changes from IGT_4468_full -> IGTPW_1334_full =
== Summary - WARNING ==
Minor unknown changes coming with IGTPW_1334_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_1334_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/42887/revisions/2/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1334_full:
=== IGT changes ===
==== Warnings ====
igt@drv_selftest@live_execlists:
shard-glk: SKIP -> PASS +1
shard-apl: SKIP -> PASS +1
igt@gem_exec_schedule@deep-blt:
shard-kbl: SKIP -> PASS +2
igt@perf_pmu@rc6:
shard-kbl: PASS -> SKIP== Known issues ==
Here are the changes found in IGTPW_1334_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_ppgtt@blt-vs-render-ctxn:
shard-kbl: PASS -> INCOMPLETE (fdo#103665, fdo#106023)
igt@kms_setmode@basic:
shard-glk: PASS -> FAIL (fdo#99912)
==== Possible fixes ====
igt@drv_selftest@live_hangcheck:
shard-kbl: DMESG-FAIL (fdo#106453) -> PASS
shard-apl: DMESG-FAIL (fdo#106453) -> PASS
shard-glk: DMESG-FAIL (fdo#106453) -> PASS
igt@drv_selftest@mock_breadcrumbs:
shard-hsw: DMESG-WARN (fdo#106453) -> PASS +7
igt@drv_selftest@mock_dmabuf:
shard-glk: DMESG-WARN (fdo#106453) -> PASS +7
igt@drv_selftest@mock_evict:
shard-snb: DMESG-WARN (fdo#106453) -> PASS +7
igt@drv_selftest@mock_requests:
shard-kbl: DMESG-WARN (fdo#106453) -> PASS +7
igt@drv_selftest@mock_vma:
shard-apl: DMESG-WARN (fdo#106453) -> PASS +7
igt@drv_suspend@debugfs-reader:
shard-glk: INCOMPLETE (fdo#103359, k.org#198133) -> PASS
igt@kms_flip@flip-vs-expired-vblank-interruptible:
shard-glk: FAIL (fdo#102887) -> PASS
igt@kms_flip@plain-flip-fb-recreate-interruptible:
shard-hsw: FAIL (fdo#100368) -> PASS
igt@kms_setmode@basic:
shard-kbl: FAIL (fdo#99912) -> PASS fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106453 https://bugs.freedesktop.org/show_bug.cgi?id=106453
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133
== Participating hosts (9 -> 5) ==
Missing (4): pig-snb-2600 pig-glk-j5005 pig-skl-6600 pig-hsw-4770r
== Build changes ==
* IGT: IGT_4468 -> IGTPW_1334
* Linux: CI_DRM_4160 -> CI_DRM_4163
CI_DRM_4160: 6d9a2ccf9fca7c006f24b7ff6193ee356b6d3503 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4163: 8e1dab6e913be7d014eb9bc355ec65b6b56dcd56 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1334: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1334/
IGT_4468: 548a894dc904c4628522dbbc77cb179a4c965ebc @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4468: 1e60f1499e5b71b6d5a747189d7c28f57359a87f @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1334/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev