[BUG FIX] Improve error reporting and occupancy in benchmarks#251
Merged
LoserCheems merged 2 commits intomainfrom Mar 18, 2026
Merged
[BUG FIX] Improve error reporting and occupancy in benchmarks#251LoserCheems merged 2 commits intomainfrom
LoserCheems merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves benchmark failure diagnostics by including full Python tracebacks in error messages, and updates Triton forward-kernel launch configuration heuristics intended to improve occupancy (especially for split-KV / decode-like cases).
Changes:
- Include traceback details in
BenchmarkResult.error_messageand print multi-line failure output in benchmark scripts. - Adjust split-KV
TILE_Mselection based onqheads_per_kvheadand retune some SM90 (H100) forward launch configs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
tests/benchmark_forward.py |
Adds traceback capture to benchmark failures and prints full error details. |
tests/benchmark_decode.py |
Same traceback-enhanced error reporting for decode benchmarks. |
tests/benchmark_backward.py |
Same traceback-enhanced error reporting for backward benchmarks. |
flash_sparse_attn/ops/triton/launch_template.py |
Updates forward (dense/sparse/gated) launch config heuristics, including split-KV TILE_M and SM90 configs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
32
to
+36
| if is_split_kv: | ||
| if pack_gqa and qheads_per_kvhead > 1: | ||
| if pack_gqa and qheads_per_kvhead > 16: | ||
| tile_m = triton.next_power_of_2(qheads_per_kvhead) | ||
| else: | ||
| tile_m = 1 | ||
| tile_m = 16 |
| tile_m = triton.next_power_of_2(qheads_per_kvhead) | ||
| else: | ||
| tile_m = 1 | ||
| tile_m = 16 |
Comment on lines
254
to
+258
| if is_split_kv: | ||
| if pack_gqa and qheads_per_kvhead > 1: | ||
| if pack_gqa and qheads_per_kvhead > 16: | ||
| tile_m = triton.next_power_of_2(qheads_per_kvhead) | ||
| else: | ||
| tile_m = 1 | ||
| tile_m = 16 |
Comment on lines
215
to
+229
| @@ -224,7 +226,7 @@ def run_benchmark(cfg: BenchmarkConfig) -> BenchmarkResult: | |||
| triton_gated_tflops=None, | |||
| fa_dense_tflops=None, | |||
| cudnn_dense_tflops=None, | |||
| error_message=str(exc), | |||
| error_message=full_error, | |||
Comment on lines
212
to
+226
| @@ -221,7 +223,7 @@ def run_benchmark(cfg: BenchmarkConfig) -> BenchmarkResult: | |||
| triton_gated_tflops=None, | |||
| fa_dense_tflops=None, | |||
| cudnn_dense_tflops=None, | |||
| error_message=str(exc), | |||
| error_message=full_error, | |||
Comment on lines
272
to
287
| @@ -281,7 +283,7 @@ def run_benchmark(cfg: BenchmarkConfig) -> BenchmarkResult: | |||
| triton_gated_tflops=None, | |||
| fa_dense_tflops=None, | |||
| cudnn_dense_tflops=None, | |||
| error_message=str(exc), | |||
| error_message=full_error, | |||
| ) | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root Cause
Changes
qheads_per_kvheadfor improved occupancy.Reproduction
Tests
Compatibility
Checklist