Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion site/frontend/src/pages/compare/compile/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export type CompileBenchmarkFilter = {
llvm: boolean;
cranelift: boolean;
};
target: {
x86_64_unknown_linux_gnu: boolean;
};
category: {
primary: boolean;
secondary: boolean;
Expand Down Expand Up @@ -54,6 +57,9 @@ export const defaultCompileFilter: CompileBenchmarkFilter = {
llvm: true,
cranelift: true,
},
target: {
x86_64_unknown_linux_gnu: true,
},
category: {
primary: true,
secondary: true,
Expand All @@ -72,6 +78,7 @@ export const defaultCompileFilter: CompileBenchmarkFilter = {
export type Profile = "check" | "debug" | "opt" | "doc";
export type CodegenBackend = "llvm" | "cranelift";
export type Category = "primary" | "secondary";
export type Target = "x86_64-unknown-linux-gnu";

export type CompileBenchmarkMap = Dict<CompileBenchmarkMetadata>;

Expand All @@ -95,6 +102,7 @@ export interface CompileBenchmarkComparison {
profile: Profile;
scenario: string;
backend: CodegenBackend;
target: Target;
comparison: StatComparison;
}

Expand All @@ -103,6 +111,7 @@ export interface CompileTestCase {
profile: Profile;
scenario: string;
backend: CodegenBackend;
target: Target;
category: Category;
}

Expand Down Expand Up @@ -151,6 +160,15 @@ export function computeCompileComparisonsWithNonRelevant(
}
}

function targetFilter(target: Target): boolean {
if (target === "x86_64-unknown-linux-gnu") {
return filter.target.x86_64_unknown_linux_gnu;
} else {
// Unknown, but by default we should show things
return true;
}
}

function artifactFilter(metadata: CompileBenchmarkMetadata | null): boolean {
if (metadata?.binary === null) return true;

Expand Down Expand Up @@ -183,6 +201,7 @@ export function computeCompileComparisonsWithNonRelevant(
profileFilter(comparison.testCase.profile) &&
scenarioFilter(comparison.testCase.scenario) &&
backendFilter(comparison.testCase.backend) &&
targetFilter(comparison.testCase.target) &&
categoryFilter(comparison.testCase.category) &&
artifactFilter(benchmarkMap[comparison.testCase.benchmark] ?? null) &&
changeFilter(comparison) &&
Expand All @@ -198,6 +217,7 @@ export function computeCompileComparisonsWithNonRelevant(
profile: c.profile,
scenario: c.scenario,
backend: c.backend,
target: c.target,
category: (benchmarkMap[c.benchmark] || {}).category || "secondary",
};
return calculateComparison(c.comparison, testCase);
Expand Down Expand Up @@ -242,18 +262,20 @@ export function transformDataForBackendComparison(
cranelift: number | null;
benchmark: string;
profile: Profile;
target: Target;
scenario: string;
}
> = new Map();
for (const comparison of comparisons) {
const key = `${comparison.benchmark};${comparison.profile};${comparison.scenario}`;
const key = `${comparison.benchmark};${comparison.profile};${comparison.scenario};${comparison.target}`;
if (!benchmarkMap.has(key)) {
benchmarkMap.set(key, {
llvm: null,
cranelift: null,
benchmark: comparison.benchmark,
profile: comparison.profile,
scenario: comparison.scenario,
target: comparison.target,
});
}
const record = benchmarkMap.get(key);
Expand All @@ -271,6 +293,7 @@ export function transformDataForBackendComparison(
scenario: entry.scenario,
// Treat LLVM as the baseline
backend: "llvm",
target: entry.target,
comparison: {
statistics: [entry.llvm, entry.cranelift],
is_relevant: true,
Expand Down
12 changes: 12 additions & 0 deletions site/frontend/src/pages/compare/compile/compile-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ function loadFilterFromUrl(
defaultFilter.backend.cranelift
),
},
target: {
x86_64_unknown_linux_gnu: getBoolOrDefault(
urlParams,
"target-x86_64-unknown-linux-gnu",
defaultFilter.target.x86_64_unknown_linux_gnu
),
},
category: {
primary: getBoolOrDefault(
urlParams,
Expand Down Expand Up @@ -174,6 +181,11 @@ function storeFilterToUrl(
filter.backend.cranelift,
defaultFilter.backend.cranelift
);
storeOrReset(
"target-x86_64-unknown-linux-gnu",
filter.target.x86_64_unknown_linux_gnu,
defaultFilter.target.x86_64_unknown_linux_gnu
);
storeOrReset(
"primary",
filter.category.primary,
Expand Down
20 changes: 20 additions & 0 deletions site/frontend/src/pages/compare/compile/filters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,26 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
</li>
</ul>
</div>
<div class="section section-list-wrapper">
<div class="section-heading">
<div style="width: 160px">
<span>Targets</span>
<Tooltip>The host target of the benchmarked compiler. </Tooltip>
</div>
</div>
<ul class="states-list">
<li>
<label>
<input
type="checkbox"
v-model="filter.target.x86_64_unknown_linux_gnu"
/>
<span class="label">x86_64-unknown-linux-gnu</span>
</label>
<Tooltip>The default Linux x64 target.</Tooltip>
</li>
</ul>
</div>
<div class="section section-list-wrapper">
<div class="section-heading">
<div style="width: 160px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {TestCaseComparison} from "../../data";
import Tooltip from "../../tooltip.vue";
import {ArtifactDescription} from "../../types";
import {percentClass} from "../../shared";
import {formatTarget, percentClass} from "../../shared";
import {CompileBenchmarkMap, CompileTestCase} from "../common";
import {computed} from "vue";
import {testCaseKey} from "../common";
Expand Down Expand Up @@ -62,6 +62,7 @@ const unit = computed(() => {
<th>Profile</th>
<th>Scenario</th>
<th v-if="showBackend">Backend</th>
<th>Target</th>
<th>% Change</th>
<th class="narrow">
Significance Threshold
Expand Down Expand Up @@ -101,6 +102,9 @@ const unit = computed(() => {
</td>
<td>{{ comparison.testCase.scenario }}</td>
<td v-if="showBackend">{{ comparison.testCase.backend }}</td>
<td :title="comparison.testCase.target">
{{ formatTarget(comparison.testCase.target) }}
</td>
<td>
<div class="numeric-aligned">
<span v-bind:class="percentClass(comparison.percent)">
Expand Down
10 changes: 10 additions & 0 deletions site/frontend/src/pages/compare/shared.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {Target} from "./compile/common";

export function formatDate(dateString: string): string {
const date = new Date(dateString);
function padStr(i) {
Expand Down Expand Up @@ -93,3 +95,11 @@ export function benchmarkNameMatchesFilter(
return benchmarkName.includes(trimmedFilterName);
}
}

const TARGET_SHORTCUTS: {[target in Target]: string} = {
"x86_64-unknown-linux-gnu": "x64",
};

export function formatTarget(target: Target): string {
return TARGET_SHORTCUTS[target] ?? target;
}
1 change: 1 addition & 0 deletions site/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ pub mod comparison {
pub profile: String,
pub scenario: String,
pub backend: String,
pub target: String,
pub comparison: StatComparison,
}

Expand Down
4 changes: 4 additions & 0 deletions site/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use collector::Bound;
use database::{
metric::Metric,
selector::{self, BenchmarkQuery, CompileBenchmarkQuery, RuntimeBenchmarkQuery, TestCase},
Target,
};
use database::{ArtifactId, Benchmark, Lookup, Profile, Scenario};
use serde::Serialize;
Expand Down Expand Up @@ -152,6 +153,7 @@ pub async fn handle_compare(
profile: comparison.profile.to_string(),
scenario: comparison.scenario.to_string(),
backend: comparison.backend.to_string(),
target: comparison.target.to_string(),
comparison: comparison.comparison.into(),
})
.collect();
Expand Down Expand Up @@ -742,6 +744,7 @@ async fn compare_given_commits(
scenario: test_case.scenario,
benchmark: test_case.benchmark,
backend: test_case.backend,
target: test_case.target,
comparison,
},
)
Expand Down Expand Up @@ -1315,6 +1318,7 @@ pub struct CompileTestResultComparison {
profile: Profile,
scenario: Scenario,
backend: CodegenBackend,
target: Target,
comparison: TestResultComparison,
}

Expand Down
Loading