Skip to content

Enhancement - Fix hipblaslt-gemm result parsing for hipBLASLt v1500+ output format#791

Open
polarG wants to merge 3 commits intomainfrom
dev/hongtaozhang/fix-hipblaslt-parse-in-new-version
Open

Enhancement - Fix hipblaslt-gemm result parsing for hipBLASLt v1500+ output format#791
polarG wants to merge 3 commits intomainfrom
dev/hongtaozhang/fix-hipblaslt-parse-in-new-version

Conversation

@polarG
Copy link
Copy Markdown
Contributor

@polarG polarG commented Mar 20, 2026

Description
The hipblaslt-gemm benchmark result parser fails with MICROBENCHMARK_RESULT_PARSING_FAILURE (return code 33) when running against hipBLASLt v1500+. The benchmark kernels execute successfully and produce valid TFLOPS data, but SuperBench cannot parse the results into structured metrics.

Root cause: The parser hardcodes len(fields) != 23 to validate the output CSV, but hipBLASLt v1500 outputs 34 columns — it added a_type, b_type, c_type, d_type, scaleA, scaleB, scaleC, scaleD, amaxD, bias_type, aux_type, and hipblaslt-GB/s. This causes two bugs:

  1. The field count check rejects every result line as invalid.
  2. Even if it passed, fields[-2] would return hipblaslt-GB/s instead of hipblaslt-Gflops.

Fix
Replace the hardcoded field-count check and positional index with header-based column lookup:

  • Parse the CSV header line to dynamically find the column index of hipblaslt-Gflops.
  • Validate that the data line has the same number of columns as the header (instead of a magic number).
  • Use the discovered column index to extract the Gflops value.

This approach is:

  • Backward compatible — works with the old 23-column format (hipBLASLt v600).
  • Forward compatible — will handle any future column additions as long as hipblaslt-Gflops remains in the header.

@polarG polarG requested a review from a team as a code owner March 20, 2026 17:52
Copilot AI review requested due to automatic review settings March 20, 2026 17:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates hipblaslt-gemm result parsing to support hipBLASLt v1500+ CSV output by using header-based column lookup instead of hardcoded field counts/positions.

Changes:

  • Parse the CSV header to dynamically locate the hipblaslt-Gflops column and validate row width against the header.
  • Add a unit test covering the new v1500+ (34-column) output format.
  • Clarify parsing intent via inline comments.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/benchmarks/micro_benchmarks/test_hipblaslt_function.py Adds a new test case for v1500+ output and annotates the existing old-format test.
superbench/benchmarks/micro_benchmarks/hipblaslt_function.py Switches parsing to header-based hipblaslt-Gflops extraction and header/data column-count validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/benchmarks/micro_benchmarks/test_hipblaslt_function.py Outdated
Comment thread superbench/benchmarks/micro_benchmarks/hipblaslt_function.py Outdated
Comment thread superbench/benchmarks/micro_benchmarks/hipblaslt_function.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.37%. Comparing base (6b8e810) to head (7e01df9).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../benchmarks/micro_benchmarks/hipblaslt_function.py 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #791      +/-   ##
==========================================
- Coverage   85.70%   84.37%   -1.34%     
==========================================
  Files         102      103       +1     
  Lines        7703     8307     +604     
==========================================
+ Hits         6602     7009     +407     
- Misses       1101     1298     +197     
Flag Coverage Δ
cpu-python3.10-unit-test 70.44% <81.81%> (-0.52%) ⬇️
cpu-python3.12-unit-test 70.44% <81.81%> (-0.52%) ⬇️
cpu-python3.7-unit-test 69.87% <81.81%> (-0.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@polarG polarG self-assigned this Mar 23, 2026
@polarG polarG added enhancement New feature or request ROCm labels Mar 23, 2026
Hongtao Zhang added 2 commits May 2, 2026 00:11
…sserts

- Use exact match (col_name.strip() == 'hipblaslt-Gflops') for the FLOPS column lookup, avoiding accidental matches against future names like 'hipblaslt-Gflops-peak'.
- Rewrite the inline comment to drop misleading positional index claims and use the correct 'hipblaslt-GB/s' name instead of 'GB_s'.
- Replace brittle assertEqual(2, len(...)) and exact float assertEqual with assertIn(...) + assertAlmostEqual(..., places=3) for the new-format test.
- Harden first-header-field rank-marker stripping with an anchored regex
  (re.sub r'^\s*\[\d+\]:?'), so a column whose name happens to contain
  ']' is not truncated.
- Add an explicit IndexError guard before reading lines[index + 1] so
  hipblaslt-bench output that ends on the header (e.g., crash after
  printing it) yields a clear ValueError instead of a generic IndexError.
Copilot AI review requested due to automatic review settings May 3, 2026 04:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +158 to 160
# batch_count (index 3) and m,n,k (indices 4-6) are stable across all known formats
self._result.add_result(
f'{self._precision_in_commands[cmd_idx]}_{fields[3]}_{"_".join(fields[4:7])}_flops',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ROCm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants