Skip to content

Commit a2a2175

Browse files
authored
Merge pull request #1769 from Kobzol/codegen-backend-ext
Add codegen backend filters to compare page UI
2 parents 22e7bfa + 2b50e95 commit a2a2175

File tree

4 files changed

+86
-14
lines changed

4 files changed

+86
-14
lines changed

collector/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ The following options alter the behaviour of the `bench_local` subcommand.
148148
`IncrUnchanged`, `IncrPatched`, and `All`. The default is `All`. Note that
149149
`IncrFull` is always run if either of `IncrUnchanged` or `IncrPatched` are
150150
run (even if not requested).
151+
- `--backends <BACKENDS>`: the codegen backends to be benchmarked. The possible
152+
choices are one or more (comma-separated) of `Llvm`, `Cranelift`. The default
153+
is `Llvm`.
151154
- `--self-profile`: use rustc's `-Zself-profile` option to produce
152155
query/function tables in the output. The `measureme` tool must be installed
153156
for this to work.
@@ -474,6 +477,7 @@ The following options alter the behaviour of the `profile_local` subcommand.
474477
diff files will also be produced.
475478
- `--rustdoc <RUSTDOC>` as for `bench_local`.
476479
- `--scenarios <SCENARIOS>`: as for `bench_local`.
480+
- `--backends <BACKENDS>`: as for `bench_local`.
477481
- `--jobs <JOB-COUNT>`: execute `<JOB-COUNT>` benchmarks in parallel. This is only allowed for certain
478482
profilers whose results are not affected by system noise (e.g. `callgrind` or `eprintln`).
479483

site/frontend/src/pages/compare/compile/common.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export type CompileBenchmarkFilter = {
1414
incrUnchanged: boolean;
1515
incrPatched: boolean;
1616
};
17+
backend: {
18+
llvm: boolean;
19+
cranelift: boolean;
20+
};
1721
category: {
1822
primary: boolean;
1923
secondary: boolean;
@@ -40,6 +44,10 @@ export const defaultCompileFilter: CompileBenchmarkFilter = {
4044
incrUnchanged: true,
4145
incrPatched: true,
4246
},
47+
backend: {
48+
llvm: true,
49+
cranelift: true,
50+
},
4351
category: {
4452
primary: true,
4553
secondary: true,
@@ -121,6 +129,17 @@ export function computeCompileComparisonsWithNonRelevant(
121129
}
122130
}
123131

132+
function backendFilter(backend: string): boolean {
133+
if (backend === "llvm") {
134+
return filter.backend.llvm;
135+
} else if (backend === "cranelift") {
136+
return filter.backend.cranelift;
137+
} else {
138+
// Unknown, but by default we should show things
139+
return true;
140+
}
141+
}
142+
124143
function artifactFilter(metadata: CompileBenchmarkMetadata | null): boolean {
125144
if (metadata?.binary === null) return true;
126145

@@ -139,13 +158,14 @@ export function computeCompileComparisonsWithNonRelevant(
139158
}
140159

141160
function shouldShowTestCase(comparison: TestCaseComparison<CompileTestCase>) {
142-
const name = `${comparison.testCase.benchmark} ${comparison.testCase.profile} ${comparison.testCase.scenario}`;
161+
const name = `${comparison.testCase.benchmark} ${comparison.testCase.profile} ${comparison.testCase.scenario} ${comparison.testCase.backend}`;
143162
const nameFilter = filter.name && filter.name.trim();
144163
const nameFiltered = !nameFilter || name.includes(nameFilter);
145164

146165
return (
147166
profileFilter(comparison.testCase.profile) &&
148167
scenarioFilter(comparison.testCase.scenario) &&
168+
backendFilter(comparison.testCase.backend) &&
149169
categoryFilter(comparison.testCase.category) &&
150170
artifactFilter(benchmarkMap[comparison.testCase.benchmark] ?? null) &&
151171
nameFiltered

site/frontend/src/pages/compare/compile/compile-page.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ function loadFilterFromUrl(
6565
defaultFilter.scenario.incrPatched
6666
),
6767
},
68+
backend: {
69+
llvm: getBoolOrDefault(
70+
urlParams,
71+
"backend-llvm",
72+
defaultFilter.backend.llvm
73+
),
74+
cranelift: getBoolOrDefault(
75+
urlParams,
76+
"backend-clif",
77+
defaultFilter.backend.cranelift
78+
),
79+
},
6880
category: {
6981
primary: getBoolOrDefault(
7082
urlParams,
@@ -138,6 +150,12 @@ function storeFilterToUrl(
138150
filter.scenario.incrPatched,
139151
defaultFilter.scenario.incrPatched
140152
);
153+
storeOrReset("backend-llvm", filter.backend.llvm, defaultFilter.backend.llvm);
154+
storeOrReset(
155+
"backend-clif",
156+
filter.backend.cranelift,
157+
defaultFilter.backend.cranelift
158+
);
141159
storeOrReset(
142160
"primary",
143161
filter.category.primary,

site/frontend/src/pages/compare/compile/filters.vue

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
6262
id="profile-check"
6363
v-model="filter.profile.check"
6464
/>
65-
<span class="cache-label">check</span>
65+
<span class="label">check</span>
6666
</label>
6767
<Tooltip>Check build that does not generate any code.</Tooltip>
6868
</li>
@@ -73,7 +73,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
7373
id="profile-debug"
7474
v-model="filter.profile.debug"
7575
/>
76-
<span class="cache-label">debug</span>
76+
<span class="label">debug</span>
7777
</label>
7878
<Tooltip>Debug build that produces unoptimized code.</Tooltip>
7979
</li>
@@ -84,7 +84,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
8484
id="profile-opt"
8585
v-model="filter.profile.opt"
8686
/>
87-
<span class="cache-label">opt</span>
87+
<span class="label">opt</span>
8888
</label>
8989
<Tooltip
9090
>Release build that produces as optimized code as possible.
@@ -97,7 +97,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
9797
id="profile-doc"
9898
v-model="filter.profile.doc"
9999
/>
100-
<span class="cache-label">doc</span>
100+
<span class="label">doc</span>
101101
</label>
102102
<Tooltip
103103
>Documentation build that produces HTML documentation site
@@ -124,7 +124,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
124124
id="build-full"
125125
v-model="filter.scenario.full"
126126
/>
127-
<span class="cache-label">full</span>
127+
<span class="label">full</span>
128128
</label>
129129
<Tooltip
130130
>A non-incremental full build starting with empty cache.
@@ -137,7 +137,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
137137
id="build-incremental-full"
138138
v-model="filter.scenario.incrFull"
139139
/>
140-
<span class="cache-label">incr-full</span>
140+
<span class="label">incr-full</span>
141141
</label>
142142
<Tooltip
143143
>An incremental build starting with empty cache.
@@ -150,7 +150,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
150150
id="build-incremental-unchanged"
151151
v-model="filter.scenario.incrUnchanged"
152152
/>
153-
<span class="cache-label">incr-unchanged</span>
153+
<span class="label">incr-unchanged</span>
154154
</label>
155155
<Tooltip
156156
>An incremental build starting with complete cache, and
@@ -165,7 +165,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
165165
id="build-incremental-patched"
166166
v-model="filter.scenario.incrPatched"
167167
/>
168-
<span class="cache-label">incr-patched</span>
168+
<span class="label">incr-patched</span>
169169
</label>
170170
<Tooltip
171171
>An incremental build starting with complete cache, and an
@@ -176,6 +176,36 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
176176
</li>
177177
</ul>
178178
</div>
179+
<div class="section section-list-wrapper">
180+
<div class="section-heading">
181+
<div style="width: 160px">
182+
<span>Backends</span>
183+
<Tooltip
184+
>The different codegen backends used to generate executable
185+
code.
186+
</Tooltip>
187+
</div>
188+
</div>
189+
<ul class="states-list">
190+
<li>
191+
<label>
192+
<input type="checkbox" v-model="filter.backend.llvm" />
193+
<span class="label">LLVM</span>
194+
</label>
195+
<Tooltip>The default LLVM backend. </Tooltip>
196+
</li>
197+
<li>
198+
<label>
199+
<input type="checkbox" v-model="filter.backend.cranelift" />
200+
<span class="label">Cranelift</span>
201+
</label>
202+
<Tooltip
203+
>Alternative Cranelift backend, used primarily for faster
204+
debug builds.
205+
</Tooltip>
206+
</li>
207+
</ul>
208+
</div>
179209
<div class="section section-list-wrapper">
180210
<div class="section-heading">
181211
<div style="width: 160px">
@@ -190,14 +220,14 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
190220
<li>
191221
<label>
192222
<input type="checkbox" v-model="filter.category.primary" />
193-
<span class="cache-label">primary</span>
223+
<span class="label">primary</span>
194224
</label>
195225
<Tooltip>Real-world benchmarks.</Tooltip>
196226
</li>
197227
<li>
198228
<label>
199229
<input type="checkbox" v-model="filter.category.secondary" />
200-
<span class="cache-label">secondary</span>
230+
<span class="label">secondary</span>
201231
</label>
202232
<Tooltip>Artificial benchmarks and stress-tests.</Tooltip>
203233
</li>
@@ -217,13 +247,13 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
217247
<li>
218248
<label>
219249
<input type="checkbox" v-model="filter.artifact.binary" />
220-
<span class="cache-label">binary</span>
250+
<span class="label">binary</span>
221251
</label>
222252
</li>
223253
<li>
224254
<label>
225255
<input type="checkbox" v-model="filter.artifact.library" />
226-
<span class="cache-label">library</span>
256+
<span class="label">library</span>
227257
</label>
228258
</li>
229259
</ul>
@@ -313,7 +343,7 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
313343
margin-right: 15px;
314344
}
315345
316-
.cache-label {
346+
.label {
317347
font-weight: bold;
318348
}
319349
</style>

0 commit comments

Comments
 (0)