From 3af20842ca9cfc98d694dfb584389149c557fec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 14 Dec 2023 22:39:44 +0100 Subject: [PATCH 1/2] Add backend filter to compare page --- .../src/pages/compare/compile/common.ts | 22 +++++++- .../pages/compare/compile/compile-page.vue | 18 ++++++ .../src/pages/compare/compile/filters.vue | 56 ++++++++++++++----- 3 files changed, 82 insertions(+), 14 deletions(-) diff --git a/site/frontend/src/pages/compare/compile/common.ts b/site/frontend/src/pages/compare/compile/common.ts index 4074f27a4..130ce03bc 100644 --- a/site/frontend/src/pages/compare/compile/common.ts +++ b/site/frontend/src/pages/compare/compile/common.ts @@ -14,6 +14,10 @@ export type CompileBenchmarkFilter = { incrUnchanged: boolean; incrPatched: boolean; }; + backend: { + llvm: boolean; + cranelift: boolean; + }; category: { primary: boolean; secondary: boolean; @@ -40,6 +44,10 @@ export const defaultCompileFilter: CompileBenchmarkFilter = { incrUnchanged: true, incrPatched: true, }, + backend: { + llvm: true, + cranelift: true, + }, category: { primary: true, secondary: true, @@ -121,6 +129,17 @@ export function computeCompileComparisonsWithNonRelevant( } } + function backendFilter(backend: string): boolean { + if (backend === "llvm") { + return filter.backend.llvm; + } else if (backend === "cranelift") { + return filter.backend.cranelift; + } else { + // Unknown, but by default we should show things + return true; + } + } + function artifactFilter(metadata: CompileBenchmarkMetadata | null): boolean { if (metadata?.binary === null) return true; @@ -139,13 +158,14 @@ export function computeCompileComparisonsWithNonRelevant( } function shouldShowTestCase(comparison: TestCaseComparison) { - const name = `${comparison.testCase.benchmark} ${comparison.testCase.profile} ${comparison.testCase.scenario}`; + const name = `${comparison.testCase.benchmark} ${comparison.testCase.profile} ${comparison.testCase.scenario} ${comparison.testCase.backend}`; const nameFilter = filter.name && filter.name.trim(); const nameFiltered = !nameFilter || name.includes(nameFilter); return ( profileFilter(comparison.testCase.profile) && scenarioFilter(comparison.testCase.scenario) && + backendFilter(comparison.testCase.backend) && categoryFilter(comparison.testCase.category) && artifactFilter(benchmarkMap[comparison.testCase.benchmark] ?? null) && nameFiltered diff --git a/site/frontend/src/pages/compare/compile/compile-page.vue b/site/frontend/src/pages/compare/compile/compile-page.vue index 5fefe31b6..8f96401f1 100644 --- a/site/frontend/src/pages/compare/compile/compile-page.vue +++ b/site/frontend/src/pages/compare/compile/compile-page.vue @@ -65,6 +65,18 @@ function loadFilterFromUrl( defaultFilter.scenario.incrPatched ), }, + backend: { + llvm: getBoolOrDefault( + urlParams, + "backend-llvm", + defaultFilter.backend.llvm + ), + cranelift: getBoolOrDefault( + urlParams, + "backend-clif", + defaultFilter.backend.cranelift + ), + }, category: { primary: getBoolOrDefault( urlParams, @@ -138,6 +150,12 @@ function storeFilterToUrl( filter.scenario.incrPatched, defaultFilter.scenario.incrPatched ); + storeOrReset("backend-llvm", filter.backend.llvm, defaultFilter.backend.llvm); + storeOrReset( + "backend-clif", + filter.backend.cranelift, + defaultFilter.backend.cranelift + ); storeOrReset( "primary", filter.category.primary, diff --git a/site/frontend/src/pages/compare/compile/filters.vue b/site/frontend/src/pages/compare/compile/filters.vue index a601e3e1c..a59950661 100644 --- a/site/frontend/src/pages/compare/compile/filters.vue +++ b/site/frontend/src/pages/compare/compile/filters.vue @@ -62,7 +62,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="profile-check" v-model="filter.profile.check" /> - check + check Check build that does not generate any code. @@ -73,7 +73,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="profile-debug" v-model="filter.profile.debug" /> - debug + debug Debug build that produces unoptimized code. @@ -84,7 +84,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="profile-opt" v-model="filter.profile.opt" /> - opt + opt Release build that produces as optimized code as possible. @@ -97,7 +97,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="profile-doc" v-model="filter.profile.doc" /> - doc + doc Documentation build that produces HTML documentation site @@ -124,7 +124,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="build-full" v-model="filter.scenario.full" /> - full + full A non-incremental full build starting with empty cache. @@ -137,7 +137,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="build-incremental-full" v-model="filter.scenario.incrFull" /> - incr-full + incr-full An incremental build starting with empty cache. @@ -150,7 +150,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="build-incremental-unchanged" v-model="filter.scenario.incrUnchanged" /> - incr-unchanged + incr-unchanged An incremental build starting with complete cache, and @@ -165,7 +165,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); id="build-incremental-patched" v-model="filter.scenario.incrPatched" /> - incr-patched + incr-patched An incremental build starting with complete cache, and an @@ -176,6 +176,36 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); +
+
+
+ Backends + The different codegen backends used to generate executable + code. + +
+
+
    +
  • + + The default LLVM backend. +
  • +
  • + + Alternative Cranelift backend, used primarily for faster + debug builds. + +
  • +
+
@@ -190,14 +220,14 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
  • Real-world benchmarks.
  • Artificial benchmarks and stress-tests.
  • @@ -217,13 +247,13 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
  • @@ -313,7 +343,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED); margin-right: 15px; } -.cache-label { +.label { font-weight: bold; } From 2b50e950597fb726154776906b45c2f0d7e15066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 14 Dec 2023 22:41:56 +0100 Subject: [PATCH 2/2] Document `--backends` option for `bench_local` --- collector/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/collector/README.md b/collector/README.md index 488517d5a..042d4976f 100644 --- a/collector/README.md +++ b/collector/README.md @@ -148,6 +148,9 @@ The following options alter the behaviour of the `bench_local` subcommand. `IncrUnchanged`, `IncrPatched`, and `All`. The default is `All`. Note that `IncrFull` is always run if either of `IncrUnchanged` or `IncrPatched` are run (even if not requested). +- `--backends `: the codegen backends to be benchmarked. The possible + choices are one or more (comma-separated) of `Llvm`, `Cranelift`. The default + is `Llvm`. - `--self-profile`: use rustc's `-Zself-profile` option to produce query/function tables in the output. The `measureme` tool must be installed for this to work. @@ -474,6 +477,7 @@ The following options alter the behaviour of the `profile_local` subcommand. diff files will also be produced. - `--rustdoc ` as for `bench_local`. - `--scenarios `: as for `bench_local`. +- `--backends `: as for `bench_local`. - `--jobs `: execute `` benchmarks in parallel. This is only allowed for certain profilers whose results are not affected by system noise (e.g. `callgrind` or `eprintln`).