[canvaskit] Increase timeout for RenderSKPs

Also add a skiplist to bypass a skp that is (hopefully temporarily)
timing out.

Change-Id: I912bd901a985ae86adfed13db102a1e7fee5686a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320060
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2020-09-28 10:26:29 -04:00
parent 59d660c075
commit f83f4c63fd
2 changed files with 52 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import (
"go.skia.org/infra/go/exec"
"go.skia.org/infra/go/skerr"
"go.skia.org/infra/go/sklog"
"go.skia.org/infra/go/util"
"go.skia.org/infra/task_driver/go/lib/os_steps"
"go.skia.org/infra/task_driver/go/td"
)
@ -150,6 +151,12 @@ func setup(ctx context.Context, benchmarkPath, nodeBinPath string) error {
return nil
}
var cpuSkiplist = []string{
// When the SKPs were generated on Sept 27 2020, this started to timeout on CPU
"desk_carsvg.skp",
}
var gpuSkiplist = []string{}
// benchSKPs serves skps from a folder and runs the RenderSKPs benchmark on each of them
// individually. The benchmark is run N times to reduce the noise of the resulting data.
// The output for each will be a JSON file in $benchmarkPath/out/ corresponding to the skp name
@ -175,11 +182,18 @@ func benchSKPs(ctx context.Context, perf perfJSONFormat, benchmarkPath, canvaski
if err != nil {
return td.FailStep(ctx, skerr.Wrap(err))
}
skiplist := cpuSkiplist
if perf.Key[perfKeyCpuOrGPU] != "CPU" {
skiplist = gpuSkiplist
}
sklog.Infof("Identified %d skp files to benchmark", len(skpFiles))
for _, skp := range skpFiles {
name := filepath.Base(skp)
if util.In(name, skiplist) {
sklog.Infof("Skipping skp %s", name)
continue
}
err = td.Do(ctx, td.Props(fmt.Sprintf("Benchmark %s", name)), func(ctx context.Context) error {
// See comment in setup about why we specify the absolute path for node.
args := []string{filepath.Join(nodeBinPath, "node"),
@ -187,6 +201,7 @@ func benchSKPs(ctx context.Context, perf perfJSONFormat, benchmarkPath, canvaski
"--bench_html", "render-skp.html",
"--canvaskit_js", filepath.Join(canvaskitBinPath, "canvaskit.js"),
"--canvaskit_wasm", filepath.Join(canvaskitBinPath, "canvaskit.wasm"),
"--timeout", "90", // 90 seconds before timeout
"--input_skp", skp,
"--output", filepath.Join(benchmarkPath, "out", name+".json"),
}

View File

@ -84,6 +84,7 @@ func TestBenchSKPs_CPUHasNoUseGPUFlag(t *testing.T) {
"--bench_html", "render-skp.html",
"--canvaskit_js", "/fake/path/to/canvaskit/canvaskit.js",
"--canvaskit_wasm", "/fake/path/to/canvaskit/canvaskit.wasm",
"--timeout", "90",
"--input_skp", filepath.Join(skps, "first_skp"),
"--output", "/fake/path/to/perf-puppeteer/out/first_skp.json"}, cmd.Args)
return nil
@ -92,6 +93,39 @@ func TestBenchSKPs_CPUHasNoUseGPUFlag(t *testing.T) {
require.Empty(t, res.Exceptions)
}
func TestBenchSKPs_SkiplistIsUsed(t *testing.T) {
skps, err := ioutil.TempDir("", "skps")
require.NoError(t, err)
defer testutils.RemoveAll(t, skps)
require.NoError(t, ioutil.WriteFile(filepath.Join(skps, "desk_carsvg.skp"), []byte("doesnt matter"), 0777))
const fakeNodeBinPath = "/fake/path/to/node/bin"
const fakeCanvasKitPath = "/fake/path/to/canvaskit"
const fakeBenchmarkPath = "/fake/path/to/perf-puppeteer"
perfObj := perfJSONFormat{
Key: map[string]string{
perfKeyCpuOrGPU: "CPU",
},
}
res := td.RunTestSteps(t, false, func(ctx context.Context) error {
mock := exec.CommandCollector{}
ctx = td.WithExecRunFn(ctx, mock.Run)
err := benchSKPs(ctx, perfObj, fakeBenchmarkPath, fakeCanvasKitPath, skps, fakeNodeBinPath)
if err != nil {
assert.NoError(t, err)
return err
}
// Should be skipped
require.Len(t, mock.Commands(), 0)
return nil
})
require.Empty(t, res.Errors)
require.Empty(t, res.Exceptions)
}
func TestBenchSKPs_GPUHasFlag(t *testing.T) {
skps, err := ioutil.TempDir("", "skps")
require.NoError(t, err)
@ -124,6 +158,7 @@ func TestBenchSKPs_GPUHasFlag(t *testing.T) {
"--bench_html", "render-skp.html",
"--canvaskit_js", "/fake/path/to/canvaskit/canvaskit.js",
"--canvaskit_wasm", "/fake/path/to/canvaskit/canvaskit.wasm",
"--timeout", "90",
"--input_skp", filepath.Join(skps, "first_skp"),
"--output", "/fake/path/to/perf-puppeteer/out/first_skp.json",
"--use_gpu"}, cmd.Args)
@ -166,6 +201,7 @@ func TestBenchSKPs_WebGL1(t *testing.T) {
"--bench_html", "render-skp.html",
"--canvaskit_js", "/fake/path/to/canvaskit/canvaskit.js",
"--canvaskit_wasm", "/fake/path/to/canvaskit/canvaskit.wasm",
"--timeout", "90",
"--input_skp", filepath.Join(skps, "first_skp"),
"--output", "/fake/path/to/perf-puppeteer/out/first_skp.json",
"--use_gpu",