Skip to content

Commit 9ef658c

Browse files
committed
Implement RUN NEW TEST (retest) sidebar flow in GUI, and suppress console hierarchical report printing when running in FFI/GUI mode
1 parent b663d07 commit 9ef658c

2 files changed

Lines changed: 108 additions & 17 deletions

File tree

cpp_src/core/BenchmarkRunner.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,5 +582,7 @@ void BenchmarkRunner::run(const std::vector<std::string> &benchmarks_to_run) {
582582
if (verbose) {
583583
std::cout << "\r\033[K" << std::flush;
584584
}
585-
formatter->print();
585+
if (!onResult) {
586+
formatter->print();
587+
}
586588
}

gpubench-gui/src/main.rs

Lines changed: 105 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ impl iced::widget::button::StyleSheet for PrimaryGradientButton {
3333
}
3434
}
3535

36+
struct SecondaryBorderButton;
37+
impl iced::widget::button::StyleSheet for SecondaryBorderButton {
38+
type Style = Theme;
39+
fn active(&self, _style: &Self::Style) -> iced::widget::button::Appearance {
40+
iced::widget::button::Appearance {
41+
background: Some(Background::Color(color!(0x1A1A24))),
42+
text_color: color!(0x00E5FF),
43+
border: Border { radius: 25.0.into(), width: 1.0, color: color!(0x00E5FF, 0.5) },
44+
..Default::default()
45+
}
46+
}
47+
fn hovered(&self, _style: &Self::Style) -> iced::widget::button::Appearance {
48+
iced::widget::button::Appearance {
49+
background: Some(Background::Color(color!(0x222233))),
50+
text_color: color!(0x00E5FF),
51+
border: Border { radius: 25.0.into(), width: 1.0, color: color!(0x00E5FF, 1.0) },
52+
..Default::default()
53+
}
54+
}
55+
}
56+
3657
struct PillToggle {
3758
is_active: bool,
3859
is_api_selector: bool,
@@ -178,6 +199,11 @@ struct GPUBenchApp {
178199
current_benchmark: String,
179200
current_device: String,
180201
selected_tests: HashSet<String>,
202+
available_backends: Vec<String>,
203+
selected_backend: String,
204+
available_devices: Vec<String>,
205+
selected_device: String,
206+
available_tests: Vec<String>,
181207

182208
// Metrics
183209
gpu_bw: f32,
@@ -221,6 +247,7 @@ enum Message {
221247
BenchmarksComplete,
222248
Tick,
223249
SaveResults,
250+
Retest,
224251
}
225252

226253
impl Application for GPUBenchApp {
@@ -262,12 +289,17 @@ impl Application for GPUBenchApp {
262289
(
263290
Self {
264291
state: AppState::Setup {
265-
available_backends: backends,
266-
selected_backend,
267-
available_devices: devices,
268-
selected_device,
269-
available_tests: tests,
292+
available_backends: backends.clone(),
293+
selected_backend: selected_backend.clone(),
294+
available_devices: devices.clone(),
295+
selected_device: selected_device.clone(),
296+
available_tests: tests.clone(),
270297
},
298+
available_backends: backends,
299+
selected_backend: selected_backend,
300+
available_devices: devices,
301+
selected_device: selected_device,
302+
available_tests: tests,
271303
selected_tests: initial_tests,
272304
current_benchmark: String::from("Waiting to start..."),
273305
current_device: String::from(""),
@@ -311,6 +343,7 @@ impl Application for GPUBenchApp {
311343
Message::BackendSelected(backend) => {
312344
if let AppState::Setup { selected_backend, available_devices, selected_device, .. } = &mut self.state {
313345
*selected_backend = backend.clone();
346+
self.selected_backend = backend.clone();
314347

315348
let hw = gpubench_core::get_available_hardware();
316349
let mut new_devices = Vec::new();
@@ -329,12 +362,15 @@ impl Application for GPUBenchApp {
329362
new_devices.push("0: Default Device".to_string());
330363
}
331364
*available_devices = new_devices.clone();
365+
self.available_devices = new_devices.clone();
332366
*selected_device = new_devices[0].clone();
367+
self.selected_device = new_devices[0].clone();
333368
}
334369
}
335370
Message::DeviceSelected(device) => {
336371
if let AppState::Setup { selected_device, .. } = &mut self.state {
337-
*selected_device = device;
372+
*selected_device = device.clone();
373+
self.selected_device = device;
338374
}
339375
}
340376
Message::TestToggled(name, is_checked) => {
@@ -556,6 +592,44 @@ impl Application for GPUBenchApp {
556592
}
557593
return Command::none();
558594
}
595+
Message::Retest => {
596+
self.state = AppState::Setup {
597+
available_backends: self.available_backends.clone(),
598+
selected_backend: self.selected_backend.clone(),
599+
available_devices: self.available_devices.clone(),
600+
selected_device: self.selected_device.clone(),
601+
available_tests: self.available_tests.clone(),
602+
};
603+
self.current_benchmark = String::from("Waiting to start...");
604+
self.current_device = String::from("");
605+
self.gpu_bw = 0.0;
606+
self.cpu_bw = 0.0;
607+
self.sys_mem_bw = 0.0;
608+
self.sys_mem_bw_single = 0.0;
609+
self.sys_mem_lat = 0.0;
610+
self.gpu_fp64 = 0.0;
611+
self.gpu_fp32 = 0.0;
612+
self.gpu_fp16_vector = 0.0;
613+
self.gpu_fp16_matrix = 0.0;
614+
self.gpu_bf16_vector = 0.0;
615+
self.gpu_bf16_matrix = 0.0;
616+
self.gpu_fp8_vector = 0.0;
617+
self.gpu_fp8_matrix = 0.0;
618+
self.gpu_int8_vector = 0.0;
619+
self.gpu_int8_matrix = 0.0;
620+
self.gpu_int4_vector = 0.0;
621+
self.gpu_int4_matrix = 0.0;
622+
self.gpu_rt_anyhit = 0.0;
623+
self.gpu_rt_blas_build = 0.0;
624+
self.gpu_rt_blas_update = 0.0;
625+
self.gpu_rt_tlas_build = 0.0;
626+
self.gpu_rt_incoherent = 0.0;
627+
self.gpu_rt_intersect = 0.0;
628+
self.gpu_rt_divergence = 0.0;
629+
self.gpu_rt_payload = 0.0;
630+
self.gpu_rt_procedural = 0.0;
631+
return Command::none();
632+
}
559633
}
560634
Command::none()
561635
}
@@ -829,16 +903,31 @@ impl Application for GPUBenchApp {
829903

830904
let split_layout = row![compute_col, rt_col, mem_col].spacing(20);
831905

832-
let save_btn: Element<'_, Message> = if matches!(self.state, AppState::Complete { .. }) {
833-
button(
834-
container(text("SAVE RESULTS").size(14).style(iced::theme::Text::Color(color!(0xFFFFFF))))
835-
.width(Length::Fill)
836-
.center_x()
837-
)
906+
let action_buttons: Element<'_, Message> = if matches!(self.state, AppState::Complete { .. }) {
907+
column![
908+
button(
909+
container(text("SAVE RESULTS").size(14).style(iced::theme::Text::Color(color!(0xFFFFFF))))
910+
.width(Length::Fill)
911+
.center_x()
912+
)
913+
.width(Length::Fill)
914+
.padding([14, 0])
915+
.on_press(Message::SaveResults)
916+
.style(iced::theme::Button::Custom(Box::new(PrimaryGradientButton))),
917+
918+
Space::with_height(10),
919+
920+
button(
921+
container(text("RUN NEW TEST").size(14).style(iced::theme::Text::Color(color!(0xFFFFFF))))
922+
.width(Length::Fill)
923+
.center_x()
924+
)
925+
.width(Length::Fill)
926+
.padding([14, 0])
927+
.on_press(Message::Retest)
928+
.style(iced::theme::Button::Custom(Box::new(SecondaryBorderButton)))
929+
]
838930
.width(Length::Fill)
839-
.padding([14, 0])
840-
.on_press(Message::SaveResults)
841-
.style(iced::theme::Button::Custom(Box::new(PrimaryGradientButton)))
842931
.into()
843932
} else {
844933
Space::with_height(0).into()
@@ -859,7 +948,7 @@ impl Application for GPUBenchApp {
859948
Space::with_height(20),
860949
text(if self.current_benchmark.len() > 30 { "Complete" } else { &self.current_benchmark }).size(12).style(color!(0x666677)),
861950
Space::with_height(Length::Fill),
862-
save_btn
951+
action_buttons
863952
]
864953
)
865954
.width(Length::Fixed(300.0))

0 commit comments

Comments
 (0)