From 28742b520b728149fe6e45e62a5778188f75aed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 18 Nov 2025 08:39:13 +0100 Subject: [PATCH 1/2] Validate backends when parsing GitHub commands --- database/src/lib.rs | 18 ++++++++++++------ site/src/request_handlers/github.rs | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/database/src/lib.rs b/database/src/lib.rs index 711ca24fd..9c0d74030 100644 --- a/database/src/lib.rs +++ b/database/src/lib.rs @@ -406,6 +406,10 @@ impl CodegenBackend { CodegenBackend::Cranelift => "cranelift", } } + + pub fn all_values() -> &'static [Self] { + &[Self::Llvm, Self::Cranelift] + } } impl FromStr for CodegenBackend { @@ -1009,12 +1013,7 @@ impl BenchmarkRequest { return Ok(vec![CodegenBackend::Llvm]); } - self.backends - .split(',') - .map(|s| { - CodegenBackend::from_str(s).map_err(|_| anyhow::anyhow!("Invalid backend: {s}")) - }) - .collect() + parse_backends(&self.backends).map_err(|e| anyhow::anyhow!("{e}")) } /// Get the profiles for the request @@ -1040,6 +1039,13 @@ impl BenchmarkRequest { } } +pub fn parse_backends(backends: &str) -> Result, String> { + backends + .split(',') + .map(|s| CodegenBackend::from_str(s).map_err(|_| format!("Invalid backend: {s}"))) + .collect() +} + /// Cached information about benchmark requests in the DB pub struct BenchmarkRequestIndex { /// Tags (SHA or release name) of all known benchmark requests diff --git a/site/src/request_handlers/github.rs b/site/src/request_handlers/github.rs index 85ed7ae21..905e90b77 100644 --- a/site/src/request_handlers/github.rs +++ b/site/src/request_handlers/github.rs @@ -6,7 +6,7 @@ use crate::github::{ use crate::job_queue::should_use_job_queue; use crate::load::SiteCtxt; -use database::BenchmarkRequest; +use database::{parse_backends, BenchmarkRequest, CodegenBackend}; use hashbrown::HashMap; use std::sync::Arc; @@ -265,6 +265,19 @@ fn parse_benchmark_parameters<'a>( }; params.runs = Some(runs as i32); } + if let Some(backends) = ¶ms.backends { + // Make sure that the backends are correct + parse_backends(backends).map_err(|e| { + format!( + "Cannot parse backends: {e}. Valid values are: {}", + CodegenBackend::all_values() + .iter() + .map(|b| b.as_str()) + .collect::>() + .join(", ") + ) + })?; + } if !args.is_empty() { Err(format!( From 7894dec432960e031c403f2af16c949c85027e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 18 Nov 2025 08:43:41 +0100 Subject: [PATCH 2/2] Mention codegen backends in help --- site/frontend/templates/pages/help.html | 55 +++++++++++++++---------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/site/frontend/templates/pages/help.html b/site/frontend/templates/pages/help.html index 06b184c9c..2256c450c 100644 --- a/site/frontend/templates/pages/help.html +++ b/site/frontend/templates/pages/help.html @@ -1,18 +1,18 @@ {% extends "layout.html" %} {% block head %} {% endblock %} @@ -20,29 +20,42 @@

@rust-timer commands

@rust-timer supports several commands, the most common (and simple) being - @rust-timer queue. This command is usually invoked as @bors try @rust-timer queue, - which starts a bors "try" run (not a merge). @rust-timer will wait for the try run to finish, + @rust-timer queue. This command is usually invoked as @bors try @rust-timer + queue, + which starts a bors "try" run (not a merge). @rust-timer will wait for the try run + to finish, and if it succeeds will then queue a perf run.

@rust-timer queue has a few extra options that can be useful:

    -
  • include=<INCLUDE> is a comma-separated list of benchmark prefixes. A benchmark is included in +
  • include=<INCLUDE> is a comma-separated list of benchmark prefixes. A + benchmark is included in the run only if its name matches one of the given prefixes.
  • -
  • exclude=<EXCLUDE> is a comma-separated list of benchmark prefixes, and the inverse of include=. - A benchmark is excluded from the run if its name matches one of the given prefixes.
  • +
  • exclude=<EXCLUDE> is a comma-separated list of benchmark prefixes, and + the inverse of include=. + A benchmark is excluded from the run if its name matches one of the given prefixes. +
  • runs=<RUNS> configures how many times the benchmark is run. <RUNS> - is an integer. All benchmarks run at least once by default, but some run more than one time. You can use - the runs option to override the default run count and make every benchmark run for + is an integer. All benchmarks run at least once by default, but some run more than one time. + You can use + the runs option to override the default run count and make every benchmark run + for <RUNS> times.
  • +
  • backends=<BACKENDS> configures which codegen backends should be + benchmarked. + By default, only the LLVM backend is benchmarked. If you select a non-default codegen backend, + rustc-perf will also gather data for this backend for the parent/baseline commit, so that we + have something to compare to. +
-

@rust-timer build $commit will queue a perf run for the given commit $commit. +

@rust-timer build $commit will queue a perf run for the given commit + $commit. It is usually invoked with the commit from a successful "try" run. (The queue command can be seen as a shortcut that automatically selects the "try" run's commit for the build command) - This command also supports the same include, exclude, and runs options - as @rust-timer queue. + This command also supports the same options as @rust-timer queue.

{% endblock %}