From 300c04614076ed2266509e3b7fa8e82a2b79b0e6 Mon Sep 17 00:00:00 2001 From: Loser Cheems Date: Fri, 29 Aug 2025 11:08:13 +0800 Subject: [PATCH] Standardizes configuration string formatting Improves readability by adding spaces between parameters and using consistent naming conventions (Hq for query heads, Hkv for key-value heads). Ensures both forward and backward benchmark outputs use the same format for easier comparison and analysis. --- benchmarks/backward_performance.py | 2 +- benchmarks/forward_performance.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/benchmarks/backward_performance.py b/benchmarks/backward_performance.py index fceee12..87116a2 100644 --- a/benchmarks/backward_performance.py +++ b/benchmarks/backward_performance.py @@ -864,7 +864,7 @@ def run_backward_performance_benchmark(test_type='all', num_runs=3, warmup_runs= # Format configuration string batch_size, num_heads, num_kv_heads, query_len, key_len, head_dim, keep_window_size, is_causal = config - config_str = f"B{batch_size}H{num_heads}K{num_kv_heads}Q{query_len}K{key_len}D{head_dim}W{keep_window_size}{'C' if is_causal else 'N'}" + config_str = f"B{batch_size} Hq{num_heads} Hkv{num_kv_heads} Q{query_len} K{key_len} D{head_dim} W{keep_window_size} {'C' if is_causal else 'N'}" # Calculate averages and format results sdpa_avg = f"{sum(results['sdpa_backward_times'])/len(results['sdpa_backward_times']):.2f}ms" if results['sdpa_backward_times'] else results['sdpa_backward_status'] diff --git a/benchmarks/forward_performance.py b/benchmarks/forward_performance.py index 2db5359..6bfc1f5 100644 --- a/benchmarks/forward_performance.py +++ b/benchmarks/forward_performance.py @@ -832,9 +832,11 @@ def run_performance_benchmark(test_type='all', num_runs=3, warmup_runs=2): speedup_strs[impl_key] = "N/A" # Format output with shorter config string - config_short = f" b{batch_size} h{num_heads} kv{num_kv_heads} q{query_len} k{key_len} d{head_dim} w{keep_window_size} " + config_short = f" B{batch_size} Hq{num_heads} Hkv{num_kv_heads} Q{query_len} K{key_len} D{head_dim} W{keep_window_size} " if not is_causal: - config_short += "nc" + config_short += "N" + else: + config_short += "C" # Add status icons icons = ""