From 65c8000420b0d03495cfb06aacd2349171800312 Mon Sep 17 00:00:00 2001 From: Ravi Mistry Date: Tue, 18 Jun 2019 16:29:36 +0000 Subject: [PATCH] [skottie-wasm-perf] Add recipe and CPU bot * Creates a new CPU perf bot: Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM * Uses canvaskit build artifacts from Build-Debian9-EMCC-wasm-Release-CanvasKit_CPU * Feeds the build artifacts into skottie-wasm-perf.js and processes it's output. * node on the bots was pretty old so using a newer one from CIPD. NoTry: true Bug: skia:9179 Change-Id: I9713feedb6b40e4ce60a2c259de01d2003271e7c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221558 Commit-Queue: Ravi Mistry Reviewed-by: Joe Gregorio --- infra/bots/gen_tasks.go | 10 +- infra/bots/jobs.json | 1 + .../skottie_wasm_perf.json | 289 +++++++++++++++++ .../skottie_wasm_perf_trybot.json | 291 ++++++++++++++++++ infra/bots/recipes/perf_skottie_wasm.py | 154 +++++++++ infra/bots/tasks.json | 227 ++++++++++++++ 6 files changed, 970 insertions(+), 2 deletions(-) create mode 100644 infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf.json create mode 100644 infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf_trybot.json create mode 100644 infra/bots/recipes/perf_skottie_wasm.py diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go index 3f49eb8157..9795f3978f 100644 --- a/infra/bots/gen_tasks.go +++ b/infra/bots/gen_tasks.go @@ -368,7 +368,7 @@ func deriveCompileTaskName(jobName string, parts map[string]string) string { ec := []string{} if val := parts["extra_config"]; val != "" { ec = strings.Split(val, "_") - ignore := []string{"Skpbench", "AbandonGpuContext", "PreAbandonGpuContext", "Valgrind", "ReleaseAndAbandonGpuContext", "CCPR", "FSAA", "FAAA", "FDAA", "NativeFonts", "GDI", "NoGPUThreads", "ProcDump", "DDL1", "DDL3", "T8888", "DDLTotal", "DDLRecord", "9x9", "BonusConfigs", "SkottieTracing"} + ignore := []string{"Skpbench", "AbandonGpuContext", "PreAbandonGpuContext", "Valgrind", "ReleaseAndAbandonGpuContext", "CCPR", "FSAA", "FAAA", "FDAA", "NativeFonts", "GDI", "NoGPUThreads", "ProcDump", "DDL1", "DDL3", "T8888", "DDLTotal", "DDLRecord", "9x9", "BonusConfigs", "SkottieTracing", "SkottieWASM"} keep := make([]string, 0, len(ec)) for _, part := range ec { if !util.In(part, ignore) { @@ -408,7 +408,7 @@ func deriveCompileTaskName(jobName string, parts map[string]string) string { if strings.Contains(jobName, "PathKit") { ec = []string{"PathKit"} } - if strings.Contains(jobName, "CanvasKit") { + if strings.Contains(jobName, "CanvasKit") || strings.Contains(jobName, "SkottieWASM") { if parts["cpu_or_gpu"] == "CPU" { ec = []string{"CanvasKit_CPU"} } else { @@ -1179,6 +1179,8 @@ func perf(b *specs.TasksCfgBuilder, name string, parts map[string]string, compil recipe = "perf_canvaskit" } else if strings.Contains(name, "SkottieTracing") { recipe = "perf_skottietrace" + } else if strings.Contains(name, "SkottieWASM") { + recipe = "perf_skottie_wasm" } task := kitchenTask(name, recipe, isolate, "", swarmDimensions(parts), nil, OUTPUT_PERF) task.CipdPackages = append(task.CipdPackages, pkgs...) @@ -1201,6 +1203,9 @@ func perf(b *specs.TasksCfgBuilder, name string, parts map[string]string, compil } else if parts["arch"] == "x86" && parts["configuration"] == "Debug" { // skia:6737 timeout(task, 6*time.Hour) + } else if strings.Contains(parts["extra_config"], "SkottieWASM") { + task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("node")) + task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("lottie-samples")) } else if strings.Contains(parts["extra_config"], "Skottie") { task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("lottie-samples")) } @@ -1325,6 +1330,7 @@ func process(b *specs.TasksCfgBuilder, name string) { !strings.Contains(name, "G3_Framework") && !strings.Contains(name, "RecreateSKPs") && !strings.Contains(name, "Housekeeper-PerCommit-Isolate") && + !strings.Contains(name, "SkottieWASM") && !strings.Contains(name, "LottieWeb") { compile(b, compileTaskName, compileTaskParts) if parts["role"] == "Calmbench" { diff --git a/infra/bots/jobs.json b/infra/bots/jobs.json index 6cf747b9f7..7164abb753 100644 --- a/infra/bots/jobs.json +++ b/infra/bots/jobs.json @@ -267,6 +267,7 @@ "Perf-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit", "Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit", "Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit", + "Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM", "Perf-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit", "Perf-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All", "Perf-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All", diff --git a/infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf.json b/infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf.json new file mode 100644 index 0000000000..2184061766 --- /dev/null +++ b/infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf.json @@ -0,0 +1,289 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/cache/work" + ], + "infra_step": true, + "name": "makedirs checkout_path" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "remove", + "[START_DIR]/cache/work/.gclient_entries" + ], + "infra_step": true, + "name": "remove [START_DIR]/cache/work/.gclient_entries" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec-path", + "cache_dir = '[START_DIR]/cache/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': False, 'name': 'skia', 'url': 'https://skia.googlesource.com/skia.git'}]", + "--patch_root", + "skia", + "--revision_mapping_file", + "{\"got_revision\": \"skia\"}", + "--git-cache-dir", + "[START_DIR]/cache/git", + "--cleanup-dir", + "[CLEANUP]/bot_update", + "--output_json", + "/path/to/tmp/json", + "--revision", + "skia@abc123" + ], + "cwd": "[START_DIR]/cache/work", + "env_prefixes": { + "PATH": [ + "RECIPE_REPO[depot_tools]" + ] + }, + "infra_step": true, + "name": "bot_update", + "~followup_annotations": [ + "@@@STEP_TEXT@Some step text@@@", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@", + "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": \"abc123\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/master@{#164710}\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"source_manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"directories\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"git_checkout\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repo_url\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"version\": 0@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_revision@\"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/master@{#164710}\"@@@" + ] + }, + { + "cmd": [ + "npm", + "install" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "npm install" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "listdir", + "[START_DIR]/lottie-samples" + ], + "infra_step": true, + "name": "list lottie files", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/LICENSE@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie1.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie2.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie3.json@@@", + "@@@STEP_LOG_END@listdir@@@" + ] + }, + { + "cmd": [ + "[START_DIR]/node/node/bin/node", + "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf/skottie-wasm-perf.js", + "--input", + "[START_DIR]/lottie-samples/lottie1.json", + "--output", + "[CLEANUP]/g3_try_tmp_1/lottie1.json", + "--canvaskit_js", + "[START_DIR]/build/canvaskit.js", + "--canvaskit_wasm", + "[START_DIR]/build/canvaskit.wasm" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "Run skottie-wasm-perf.js" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[CLEANUP]/g3_try_tmp_1/lottie1.json", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Read perf json" + }, + { + "cmd": [ + "[START_DIR]/node/node/bin/node", + "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf/skottie-wasm-perf.js", + "--input", + "[START_DIR]/lottie-samples/lottie2.json", + "--output", + "[CLEANUP]/g3_try_tmp_1/lottie2.json", + "--canvaskit_js", + "[START_DIR]/build/canvaskit.js", + "--canvaskit_wasm", + "[START_DIR]/build/canvaskit.wasm" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "Run skottie-wasm-perf.js (2)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[CLEANUP]/g3_try_tmp_1/lottie2.json", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Read perf json (2)" + }, + { + "cmd": [ + "[START_DIR]/node/node/bin/node", + "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf/skottie-wasm-perf.js", + "--input", + "[START_DIR]/lottie-samples/lottie3.json", + "--output", + "[CLEANUP]/g3_try_tmp_1/lottie3.json", + "--canvaskit_js", + "[START_DIR]/build/canvaskit.js", + "--canvaskit_wasm", + "[START_DIR]/build/canvaskit.wasm" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "Run skottie-wasm-perf.js (3)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[CLEANUP]/g3_try_tmp_1/lottie3.json", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Read perf json (3)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "rmtree", + "[CLEANUP]/g3_try_tmp_1" + ], + "infra_step": true, + "name": "rmtree [CLEANUP]/g3_try_tmp_1" + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_TASK_ID', '')\n" + ], + "name": "get swarming task id", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_TASK_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/[SWARM_OUT_DIR]" + ], + "infra_step": true, + "name": "makedirs perf_dir" + }, + { + "cmd": [ + "python", + "-u", + "import json\nwith open('[START_DIR]/[SWARM_OUT_DIR]/perf_abc123_1337000001.json', 'w') as outfile:\n json.dump(obj={'gitHash': 'abc123', 'results': {'lottie3.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie1.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie2.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}}, 'swarming_task_id': '', 'renderer': 'skottie-wasm', 'key': {'extra_config': 'SkottieWASM', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'AVX2', 'arch': 'wasm', 'source_type': 'skottie', 'cpu_or_gpu': 'CPU', 'model': 'GCE', 'configuration': 'Release', 'os': 'Debian9', 'compiler': 'EMCC'}, 'swarming_bot_id': ''}, fp=outfile, indent=4)\n" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "write output JSON", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@with open('[START_DIR]/[SWARM_OUT_DIR]/perf_abc123_1337000001.json', 'w') as outfile:@@@", + "@@@STEP_LOG_LINE@python.inline@ json.dump(obj={'gitHash': 'abc123', 'results': {'lottie3.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie1.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie2.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}}, 'swarming_task_id': '', 'renderer': 'skottie-wasm', 'key': {'extra_config': 'SkottieWASM', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'AVX2', 'arch': 'wasm', 'source_type': 'skottie', 'cpu_or_gpu': 'CPU', 'model': 'GCE', 'configuration': 'Release', 'os': 'Debian9', 'compiler': 'EMCC'}, 'swarming_bot_id': ''}, fp=outfile, indent=4)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "name": "$result" + } +] \ No newline at end of file diff --git a/infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf_trybot.json b/infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf_trybot.json new file mode 100644 index 0000000000..b18e91aeff --- /dev/null +++ b/infra/bots/recipes/perf_skottie_wasm.expected/skottie_wasm_perf_trybot.json @@ -0,0 +1,291 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/cache/work" + ], + "infra_step": true, + "name": "makedirs checkout_path" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "remove", + "[START_DIR]/cache/work/.gclient_entries" + ], + "infra_step": true, + "name": "remove [START_DIR]/cache/work/.gclient_entries" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py", + "--spec-path", + "cache_dir = '[START_DIR]/cache/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': False, 'name': 'skia', 'url': 'https://skia.googlesource.com/skia.git'}]", + "--patch_root", + "skia", + "--revision_mapping_file", + "{\"got_revision\": \"skia\"}", + "--git-cache-dir", + "[START_DIR]/cache/git", + "--cleanup-dir", + "[CLEANUP]/bot_update", + "--output_json", + "/path/to/tmp/json", + "--patch_ref", + "https://skia.googlesource.com/skia.git@abc123:89/456789/12", + "--revision", + "skia@abc123" + ], + "cwd": "[START_DIR]/cache/work", + "env_prefixes": { + "PATH": [ + "RECIPE_REPO[depot_tools]" + ] + }, + "infra_step": true, + "name": "bot_update", + "~followup_annotations": [ + "@@@STEP_TEXT@Some step text@@@", + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@", + "@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": \"abc123\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@", + "@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/master@{#164710}\"@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"root\": \"skia\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"source_manifest\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"directories\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"skia\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"git_checkout\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"repo_url\": \"https://fake.org/skia.git\", @@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"version\": 0@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_revision@\"9046e2e693bb92a76e972b694580e5d17ad10748\"@@@", + "@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/master@{#164710}\"@@@" + ] + }, + { + "cmd": [ + "npm", + "install" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "npm install" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "listdir", + "[START_DIR]/lottie-samples" + ], + "infra_step": true, + "name": "list lottie files", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/LICENSE@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie1.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie2.json@@@", + "@@@STEP_LOG_LINE@listdir@[START_DIR]/lottie-samples/lottie3.json@@@", + "@@@STEP_LOG_END@listdir@@@" + ] + }, + { + "cmd": [ + "[START_DIR]/node/node/bin/node", + "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf/skottie-wasm-perf.js", + "--input", + "[START_DIR]/lottie-samples/lottie1.json", + "--output", + "[CLEANUP]/g3_try_tmp_1/lottie1.json", + "--canvaskit_js", + "[START_DIR]/build/canvaskit.js", + "--canvaskit_wasm", + "[START_DIR]/build/canvaskit.wasm" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "Run skottie-wasm-perf.js" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[CLEANUP]/g3_try_tmp_1/lottie1.json", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Read perf json" + }, + { + "cmd": [ + "[START_DIR]/node/node/bin/node", + "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf/skottie-wasm-perf.js", + "--input", + "[START_DIR]/lottie-samples/lottie2.json", + "--output", + "[CLEANUP]/g3_try_tmp_1/lottie2.json", + "--canvaskit_js", + "[START_DIR]/build/canvaskit.js", + "--canvaskit_wasm", + "[START_DIR]/build/canvaskit.wasm" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "Run skottie-wasm-perf.js (2)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[CLEANUP]/g3_try_tmp_1/lottie2.json", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Read perf json (2)" + }, + { + "cmd": [ + "[START_DIR]/node/node/bin/node", + "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf/skottie-wasm-perf.js", + "--input", + "[START_DIR]/lottie-samples/lottie3.json", + "--output", + "[CLEANUP]/g3_try_tmp_1/lottie3.json", + "--canvaskit_js", + "[START_DIR]/build/canvaskit.js", + "--canvaskit_wasm", + "[START_DIR]/build/canvaskit.wasm" + ], + "cwd": "[START_DIR]/cache/work/skia/tools/skottie-wasm-perf", + "name": "Run skottie-wasm-perf.js (3)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "copy", + "[CLEANUP]/g3_try_tmp_1/lottie3.json", + "/path/to/tmp/" + ], + "infra_step": true, + "name": "Read perf json (3)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "rmtree", + "[CLEANUP]/g3_try_tmp_1" + ], + "infra_step": true, + "name": "rmtree [CLEANUP]/g3_try_tmp_1" + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_BOT_ID', '')\n" + ], + "name": "get swarming bot id", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_BOT_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "import os\nprint os.environ.get('SWARMING_TASK_ID', '')\n" + ], + "name": "get swarming task id", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import os@@@", + "@@@STEP_LOG_LINE@python.inline@print os.environ.get('SWARMING_TASK_ID', '')@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", + "--json-output", + "/path/to/tmp/json", + "ensure-directory", + "--mode", + "0777", + "[START_DIR]/[SWARM_OUT_DIR]" + ], + "infra_step": true, + "name": "makedirs perf_dir" + }, + { + "cmd": [ + "python", + "-u", + "import json\nwith open('[START_DIR]/[SWARM_OUT_DIR]/perf_abc123_1337000001.json', 'w') as outfile:\n json.dump(obj={'gitHash': 'abc123', 'results': {'lottie3.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie1.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie2.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}}, 'patch_storage': 'gerrit', 'swarming_task_id': '', 'renderer': 'skottie-wasm', 'key': {'extra_config': 'SkottieWASM', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'AVX2', 'arch': 'wasm', 'source_type': 'skottie', 'cpu_or_gpu': 'CPU', 'model': 'GCE', 'configuration': 'Release', 'os': 'Debian9', 'compiler': 'EMCC'}, 'swarming_bot_id': '', 'patchset': 7, 'issue': 1234}, fp=outfile, indent=4)\n" + ], + "env": { + "CHROME_HEADLESS": "1", + "PATH": ":RECIPE_REPO[depot_tools]" + }, + "name": "write output JSON", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@import json@@@", + "@@@STEP_LOG_LINE@python.inline@with open('[START_DIR]/[SWARM_OUT_DIR]/perf_abc123_1337000001.json', 'w') as outfile:@@@", + "@@@STEP_LOG_LINE@python.inline@ json.dump(obj={'gitHash': 'abc123', 'results': {'lottie3.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie1.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}, 'lottie2.json': {'gl': {'frame_avg_us': 185.8, 'frame_min_us': 85.0, 'frame_max_us': 860.0}}}, 'patch_storage': 'gerrit', 'swarming_task_id': '', 'renderer': 'skottie-wasm', 'key': {'extra_config': 'SkottieWASM', 'bench_type': 'tracing', 'cpu_or_gpu_value': 'AVX2', 'arch': 'wasm', 'source_type': 'skottie', 'cpu_or_gpu': 'CPU', 'model': 'GCE', 'configuration': 'Release', 'os': 'Debian9', 'compiler': 'EMCC'}, 'swarming_bot_id': '', 'patchset': 7, 'issue': 1234}, fp=outfile, indent=4)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "name": "$result" + } +] \ No newline at end of file diff --git a/infra/bots/recipes/perf_skottie_wasm.py b/infra/bots/recipes/perf_skottie_wasm.py new file mode 100644 index 0000000000..2afa908be6 --- /dev/null +++ b/infra/bots/recipes/perf_skottie_wasm.py @@ -0,0 +1,154 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Recipe which runs Skottie-WASM perf. + +import calendar +import re + + +# trim +DEPS = [ + 'flavor', + 'checkout', + 'env', + 'infra', + 'recipe_engine/context', + 'recipe_engine/file', + 'recipe_engine/path', + 'recipe_engine/properties', + 'recipe_engine/python', + 'recipe_engine/step', + 'recipe_engine/tempfile', + 'recipe_engine/time', + 'run', + 'vars', +] + + +def RunSteps(api): + api.vars.setup() + api.flavor.setup() + checkout_root = api.checkout.default_checkout_root + skottie_wasm_perf_dir = checkout_root.join('skia', 'tools', + 'skottie-wasm-perf') + api.checkout.bot_update(checkout_root=checkout_root) + + # Install prerequisites. + env = {} + with api.context(cwd=skottie_wasm_perf_dir, env=env): + api.step('npm install', cmd=['npm', 'install']) + + canvaskit_js_path = api.vars.build_dir.join('canvaskit.js') + canvaskit_wasm_path = api.vars.build_dir.join('canvaskit.wasm') + skottie_wasm_js_path = skottie_wasm_perf_dir.join('skottie-wasm-perf.js') + node_path = api.path['start_dir'].join('node', 'node', 'bin', 'node') + perf_results = {} + with api.tempfile.temp_dir('g3_try') as output_dir: + # Run skottie_wasm.js on each lottie file and parse the trace files. + lottie_files = api.file.listdir( + 'list lottie files', api.flavor.host_dirs.lotties_dir, + test_data=['lottie1.json', 'lottie2.json', 'lottie3.json', 'LICENSE']) + for _, lottie_file in enumerate(lottie_files): + lottie_filename = api.path.basename(lottie_file) + if not lottie_filename.endswith('.json'): + continue + output_file = output_dir.join(lottie_filename) + with api.context(cwd=skottie_wasm_perf_dir, env=env): + api.step('Run skottie-wasm-perf.js', cmd=[ + node_path, skottie_wasm_js_path, + '--input', lottie_file, + '--output', output_file, + '--canvaskit_js', canvaskit_js_path, + '--canvaskit_wasm', canvaskit_wasm_path, + ]) + output_json = api.file.read_json( + 'Read perf json', output_file, + test_data={'frame_avg_us': 185.79982221126556, + 'frame_max_us': 860.0000292062759, + 'frame_min_us': 84.9999487400055} + ) + perf_results[lottie_filename] = { + 'gl': { + 'frame_avg_us': float('%.2f' % output_json['frame_avg_us']), + 'frame_max_us': float('%.2f' % output_json['frame_max_us']), + 'frame_min_us': float('%.2f' % output_json['frame_min_us']), + } + } + + # Construct contents of the output JSON. + perf_json = { + 'gitHash': api.properties['revision'], + 'swarming_bot_id': api.vars.swarming_bot_id, + 'swarming_task_id': api.vars.swarming_task_id, + 'key': { + 'bench_type': 'tracing', + 'source_type': 'skottie', + }, + 'renderer': 'skottie-wasm', + 'results': perf_results, + } + if api.vars.is_trybot: + perf_json['issue'] = api.vars.issue + perf_json['patchset'] = api.vars.patchset + perf_json['patch_storage'] = api.vars.patch_storage + # Add tokens from the builder name to the key. + reg = re.compile('Perf-(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Z]+)-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + '(?P[A-Za-z0-9_]+)-' + 'All(-(?P[A-Za-z0-9_]+)|)') + m = reg.match(api.properties['buildername']) + keys = ['os', 'compiler', 'model', 'cpu_or_gpu', 'cpu_or_gpu_value', 'arch', + 'configuration', 'extra_config'] + for k in keys: + perf_json['key'][k] = m.group(k) + + # Create the output JSON file in perf_data_dir for the Upload task to upload. + api.file.ensure_directory( + 'makedirs perf_dir', + api.flavor.host_dirs.perf_data_dir) + now = api.time.utcnow() + ts = int(calendar.timegm(now.utctimetuple())) + json_path = api.flavor.host_dirs.perf_data_dir.join( + 'perf_%s_%d.json' % (api.properties['revision'], ts)) + api.run( + api.python.inline, + 'write output JSON', + program="""import json +with open('%s', 'w') as outfile: + json.dump(obj=%s, fp=outfile, indent=4) + """ % (json_path, perf_json)) + + +def GenTests(api): + cpu_buildername = ('Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-' + 'SkottieWASM') + yield ( + api.test('skottie_wasm_perf') + + api.properties(buildername=cpu_buildername, + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]') + ) + + yield ( + api.test('skottie_wasm_perf_trybot') + + api.properties(buildername=cpu_buildername, + repository='https://skia.googlesource.com/skia.git', + revision='abc123', + path_config='kitchen', + swarm_out_dir='[SWARM_OUT_DIR]', + patch_ref='89/456789/12', + patch_repo='https://skia.googlesource.com/skia.git', + patch_storage='gerrit', + patch_set=7, + patch_issue=1234, + gerrit_project='skia', + gerrit_url='https://skia-review.googlesource.com/') + ) diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json index b2baa36be2..ac4f4c87d7 100755 --- a/infra/bots/tasks.json +++ b/infra/bots/tasks.json @@ -1351,6 +1351,11 @@ "Upload-Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit" ] }, + "Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM": { + "tasks": [ + "Upload-Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM" + ] + }, "Perf-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit": { "tasks": [ "Upload-Perf-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit" @@ -34671,6 +34676,128 @@ "perf" ] }, + "Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM": { + "caches": [ + { + "name": "vpython", + "path": "cache/vpython" + } + ], + "cipd_packages": [ + { + "name": "infra/tools/luci/kitchen/${platform}", + "path": ".", + "version": "git_revision:d8f38ca9494b5af249942631f9cee45927f6b4bc" + }, + { + "name": "infra/tools/luci-auth/${platform}", + "path": "cipd_bin_packages", + "version": "git_revision:2c805f1c716f6c5ad2126b27ec88b8585a09481e" + }, + { + "name": "infra/tools/luci/vpython/${platform}", + "path": "cipd_bin_packages", + "version": "git_revision:96f81e737868d43124b4661cf1c325296ca04944" + }, + { + "name": "skia/bots/skimage", + "path": "skimage", + "version": "version:39" + }, + { + "name": "skia/bots/skp", + "path": "skp", + "version": "version:191" + }, + { + "name": "skia/bots/svg", + "path": "svg", + "version": "version:9" + }, + { + "name": "skia/bots/node", + "path": "node", + "version": "version:1" + }, + { + "name": "skia/bots/lottie-samples", + "path": "lottie-samples", + "version": "version:1" + } + ], + "command": [ + "./kitchen${EXECUTABLE_SUFFIX}", + "cook", + "-checkout-dir", + "recipe_bundle", + "-mode", + "swarming", + "-luci-system-account", + "system", + "-cache-dir", + "cache", + "-temp-dir", + "tmp", + "-known-gerrit-host", + "android.googlesource.com", + "-known-gerrit-host", + "boringssl.googlesource.com", + "-known-gerrit-host", + "chromium.googlesource.com", + "-known-gerrit-host", + "dart.googlesource.com", + "-known-gerrit-host", + "fuchsia.googlesource.com", + "-known-gerrit-host", + "go.googlesource.com", + "-known-gerrit-host", + "llvm.googlesource.com", + "-known-gerrit-host", + "skia.googlesource.com", + "-known-gerrit-host", + "webrtc.googlesource.com", + "-output-result-json", + "${ISOLATED_OUTDIR}/build_result_filename", + "-workdir", + ".", + "-recipe", + "perf_skottie_wasm", + "-properties", + "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM\",\"patch_issue\":\"<(ISSUE)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"revision\":\"<(REVISION)\",\"swarm_out_dir\":\"perf\",\"task_id\":\"<(TASK_ID)\"}", + "-logdog-annotation-url", + "logdog://logs.chromium.org/skia/<(TASK_ID)/+/annotations" + ], + "dependencies": [ + "Housekeeper-PerCommit-BundleRecipes", + "Build-Debian9-EMCC-wasm-Release-CanvasKit_CPU" + ], + "dimensions": [ + "cpu:x86-64-Haswell_GCE", + "machine_type:n1-standard-16", + "os:Debian-9.8", + "pool:Skia" + ], + "env_prefixes": { + "PATH": [ + "cipd_bin_packages", + "cipd_bin_packages/bin" + ], + "VPYTHON_VIRTUALENV_ROOT": [ + "cache/vpython" + ] + }, + "execution_timeout_ns": 14400000000000, + "expiration_ns": 72000000000000, + "extra_tags": { + "log_location": "logdog://logs.chromium.org/skia/<(TASK_ID)/+/annotations" + }, + "io_timeout_ns": 14400000000000, + "isolate": "perf_skia_bundled.isolate", + "max_attempts": 2, + "outputs": [ + "perf" + ] + }, "Perf-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit": { "caches": [ { @@ -87843,6 +87970,106 @@ "max_attempts": 2, "service_account": "skia-external-nano-uploader@skia-swarming-bots.iam.gserviceaccount.com" }, + "Upload-Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM": { + "caches": [ + { + "name": "vpython", + "path": "cache/vpython" + } + ], + "cipd_packages": [ + { + "name": "infra/tools/luci/kitchen/${platform}", + "path": ".", + "version": "git_revision:d8f38ca9494b5af249942631f9cee45927f6b4bc" + }, + { + "name": "infra/tools/luci-auth/${platform}", + "path": "cipd_bin_packages", + "version": "git_revision:2c805f1c716f6c5ad2126b27ec88b8585a09481e" + }, + { + "name": "infra/tools/luci/vpython/${platform}", + "path": "cipd_bin_packages", + "version": "git_revision:96f81e737868d43124b4661cf1c325296ca04944" + }, + { + "name": "infra/gsutil", + "path": "cipd_bin_packages", + "version": "version:4.28" + } + ], + "command": [ + "./kitchen${EXECUTABLE_SUFFIX}", + "cook", + "-checkout-dir", + "recipe_bundle", + "-mode", + "swarming", + "-luci-system-account", + "system", + "-cache-dir", + "cache", + "-temp-dir", + "tmp", + "-known-gerrit-host", + "android.googlesource.com", + "-known-gerrit-host", + "boringssl.googlesource.com", + "-known-gerrit-host", + "chromium.googlesource.com", + "-known-gerrit-host", + "dart.googlesource.com", + "-known-gerrit-host", + "fuchsia.googlesource.com", + "-known-gerrit-host", + "go.googlesource.com", + "-known-gerrit-host", + "llvm.googlesource.com", + "-known-gerrit-host", + "skia.googlesource.com", + "-known-gerrit-host", + "webrtc.googlesource.com", + "-output-result-json", + "${ISOLATED_OUTDIR}/build_result_filename", + "-workdir", + ".", + "-recipe", + "upload_nano_results", + "-properties", + "{\"$kitchen\":{\"devshell\":true,\"git_auth\":true},\"buildbucket_build_id\":\"<(BUILDBUCKET_BUILD_ID)\",\"buildername\":\"Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM\",\"gs_bucket\":\"skia-perf\",\"patch_issue\":\"<(ISSUE)\",\"patch_ref\":\"<(PATCH_REF)\",\"patch_repo\":\"<(PATCH_REPO)\",\"patch_set\":\"<(PATCHSET)\",\"patch_storage\":\"<(PATCH_STORAGE)\",\"repository\":\"<(REPO)\",\"revision\":\"<(REVISION)\",\"swarm_out_dir\":\"output_ignored\",\"task_id\":\"<(TASK_ID)\"}", + "-logdog-annotation-url", + "logdog://logs.chromium.org/skia/<(TASK_ID)/+/annotations" + ], + "dependencies": [ + "Housekeeper-PerCommit-BundleRecipes", + "Perf-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-SkottieWASM" + ], + "dimensions": [ + "cpu:x86-64-Haswell_GCE", + "gpu:none", + "machine_type:n1-highmem-2", + "os:Debian-9.8", + "pool:Skia" + ], + "env_prefixes": { + "PATH": [ + "cipd_bin_packages", + "cipd_bin_packages/bin" + ], + "VPYTHON_VIRTUALENV_ROOT": [ + "cache/vpython" + ] + }, + "execution_timeout_ns": 3600000000000, + "extra_tags": { + "log_location": "logdog://logs.chromium.org/skia/<(TASK_ID)/+/annotations" + }, + "io_timeout_ns": 3600000000000, + "isolate": "swarm_recipe.isolate", + "max_attempts": 2, + "service_account": "skia-external-nano-uploader@skia-swarming-bots.iam.gserviceaccount.com" + }, "Upload-Perf-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit": { "caches": [ {