Repository navigation
Benchmarks - Add experimental MI455X MXFP4 hipBLASLt GEMM - #882
gusui-msft wants to merge 16 commits into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Client flag syntax needs correction, and end-to-end GPU/client behavior remains unvalidated.
1 open finding
What changed in this PR
Adds experimental, opt-in MXFP4 support to the existing ROCm hipBLASLt GEMM benchmark without changing legacy defaults.
Changes:
- Adds device, client capability, argument, and result validation.
- Adds synthetic tests for MXFP4 commands and failure handling.
- Documents requirements, metrics, and pending hardware qualification.
| File | Description |
|---|---|
| tests/benchmarks/micro_benchmarks/test_hipblaslt_function.py | Adds synthetic MXFP4 and invalid-throughput tests. |
| superbench/benchmarks/micro_benchmarks/hipblaslt_function.py | Adds gated MXFP4 execution and validated metrics. |
| docs/user-tutorial/benchmarks/micro-benchmarks.md | Documents experimental usage and validation limits. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #882 +/- ##
==========================================
+ Coverage 86.62% 86.73% +0.11%
==========================================
Files 114 114
Lines 9224 9291 +67
==========================================
+ Hits 7990 8059 +69
+ Misses 1234 1232 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🔵 Needs a closer look
The MXFP4 path has only synthetic coverage, requiring human merge judgment while native gfx950/RocRoller execution, packing and scales, correctness tolerances, and kernel timing remain unvalidated.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human review is needed because the experimental gfx950/ROCm MXFP4 path has only synthetic coverage, leaving vendor packing/scales, verification tolerance, and GPU-event timing unvalidated on hardware.
1 open issue
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human review is needed to judge whether the experimental opt-in gate is sufficient given synthetic-only coverage and missing native gfx950 validation of MXFP4 packing, correctness, and verification thresholds.
1 open issue
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Native gfx950 validation remains pending, so human hardware review is needed to confirm MXFP4 kernel execution, decoded-input verification, the 1e-5 tolerance, and exclusion of setup and verification from measured latency.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
e5bc5ed to
56a45be
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
MI455X/gfx1250 hardware qualification is still needed to confirm native MXFP4 execution, calibrate the numerical-error bound, and validate client compatibility and repeatable GPU-event timing.
No open issues 🎉
Review effort: Balanced
Add an opt-in gfx950 MXFP4 path using the ROCm 7.2.4 client contract: E2M1 inputs, 32-element E8M0 blocks, FP32 output, and mandatory CPU verification. Preserve legacy commands and metrics while rejecting invalid throughput and validating the new result contract.\n\nAdd capability, command, parser, failure, and regression coverage. Native client builds, GPU correctness, kernel evidence, and performance baselines remain pending; no production configuration is enabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pass verify, GPU timing and kernel-info options as standalone boolean switches to the pinned hipBLASLt client. Add a token-contract regression that catches value-consuming syntax independently of the expected command string. Apply the repository-pinned YAPF formatting to both changed Python files. Validate the complete generated argv with the original vendor option parser on CPU and keep native GPU qualification pending. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Require the reported alpha and beta to equal the requested values. Compare their decimal values exactly so alternate printed forms are valid but a different operation cannot produce correctness or performance metrics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Record experimental metrics only after validating the MXFP4 case. Preserve existing throughput behavior for other precisions, accept equivalent capability text and diagnostic footers, and shorten the tutorial and table-driven regression cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate recognition of a unique result row from metric validation and apply the same finite-positive rule to device throughput and latency. This keeps the parser within the existing complexity limit without changing the legacy path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retain full client help only on failure or explicit raw logging. Exercise the results parser without probing a device or client, and use distinct M/N/K dimensions so a swapped output cannot pass. Keep the MXFP4 metrics in the existing GEMM table. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep existing precision arguments, parser formatting and test helpers intact. Restore the public tutorial and leave the example, deployment scope and hardware qualification notes in the PR description instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Selecting mxfp4 already opts in to the experimental path. Drop the duplicate boolean option while retaining the default FP16 input, architecture, client and verification checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the gfx1250 hipBLASLt client contract rather than obsolete block-dimension options. Check B32E8 on both operands, support the MAF2 input pattern, require strict CPU verification and kernel identification, and retain the default and legacy precision behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Consolidate command checks and keep the subprocess failure case that can otherwise record misleading metrics from a valid result row. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check the advertised scale and initialization values. Let the client reject unsupported ordinary switches during execution, where a nonzero exit already suppresses metrics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return argument diagnostics directly and query the visible GPU architecture once. Only classify missing fields or invalid scalar text and case values as client output errors; leave wrapper bookkeeping failures to the benchmark runner. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use strict verification without the redundant verify flag, and name the row parser and test benchmark factory for what they return. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reject mixed --in_types whenever mxfp4 or maf2_0 is requested, not only with maf2_0 initialization, so mixed lists with hpl or trig_float fail argument validation instead of aborting device preflight across legacy datatypes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Count result headers directly instead of guessing trailing CSV rows, and stop re-parsing hardcoded CLI constants with Decimal while preserving case, kernel, timing and verification guards. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b01008a to
24ac72b
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
MI455X/gfx1250 hardware validation is needed to confirm native MXFP4 execution, strict CPU verification, and the uncalibrated norm_error < 1e-5 acceptance bound, which CPU mocks cannot establish.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
| # Keep the wrapper's conservative FP32-output bound in addition to the client's strict verification. | ||
| norm_error = float(row['norm_error']) | ||
| if not ( | ||
| 0 <= norm_error < 1e-5 |
There was a problem hiding this comment.
[SHOULD-FIX] Uncalibrated norm_error < 1e-5 bound can reject every real MXFP4 run
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- _record_mxfp4_result
Evidence:
# Keep the wrapper's conservative FP32-output bound in addition to the client's strict verification.
norm_error = float(row['norm_error'])
if not (
0 <= norm_error < 1e-5Issue:
Verified: upstream norm.hpp returns 0.3 for HIP_R_4F_E2M1 and norm_tolerance() takes std::max over output and input types, so --verify_strict already fails the client (exit 2) at norm_error >= 0.3. The wrapper adds an extra bound that is ~30,000x tighter. Inferred: FP32 accumulation-order differences between GPU and CPU reference grow roughly with sqrt(K)*eps; at the default K=8192 this is on the order of 5e-6, i.e. right at the 1e-5 boundary. The bound is only exercised by synthetic rows (1e-6, 9.999e-6), and the PR description itself states it "needs hardware calibration".
Impact:
On gfx1250, valid runs (especially large-K shapes) may be reported as MICROBENCHMARK_RESULT_PARSING_FAILURE with no throughput published.
Recommendation:
Calibrate on MI455X across the documented shapes before merging, or make the bound configurable and rely on --verify_strict by default, e.g.:
self._parser.add_argument('--mxfp4_max_norm_error', type=float, default=None, required=False,
help='Optional extra norm_error bound for mxfp4 on top of --verify_strict.')
...
limit = self._args.mxfp4_max_norm_error
if not (math.isfinite(norm_error) and norm_error >= 0 and (limit is None or norm_error < limit)):
raise ValueError(...)|
|
||
| self._bin_name = 'hipblaslt-bench' | ||
| self._in_types = ['fp32', 'fp16', 'bf16', 'fp8'] | ||
| self._in_types = ['fp32', 'fp16', 'bf16', 'fp8', 'mxfp4'] |
There was a problem hiding this comment.
[SHOULD-FIX] User docs not updated for mxfp4, maf2_0, MXFP4 constraints and new metrics
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- HipBlasLtBenchmark.init / _record_mxfp4_result; docs/user-tutorial/benchmarks/micro-benchmarks.md
Evidence:
self._in_types = ['fp32', 'fp16', 'bf16', 'fp8', 'mxfp4']
...
self._result.add_result(f'{metric}_time', latency)
self._result.add_result(f'{metric}_norm_error', norm_error)
self._result.add_result(f'{metric}_correctness', 1)Issue:
docs/user-tutorial/benchmarks/micro-benchmarks.md only documents hipblaslt-gemm/${dtype}_${batch}_${m}_${n}_${k}_flops. It does not mention the mxfp4 in_type, maf2_0 initialization, the required overrides (defaults --transA N and --initialization rand_int are rejected), the gfx1250 / dedicated-instance / K%32 / batch 0 constraints, or the new _time, _norm_error, _correctness metrics.
Impact:
Users enabling in_types: [mxfp4] with default parameters get INVALID_ARGUMENT without guidance; downstream result consumers do not know about the three new metric suffixes.
Recommendation:
Add an experimental MXFP4 note under cublaslt-gemm / hipblaslt-gemm (required parameters, gfx1250 only, dedicated instance) and add hipblaslt-gemm/mxfp4_${batch}_${m}_${n}_${k}_{time,norm_error,correctness} rows to the metrics table (time unit: us).
| self.assertEqual(benchmark.return_code, ReturnCode.MICROBENCHMARK_RESULT_PARSING_FAILURE) | ||
| self.assertEqual(set(benchmark.result), {'return_code'}) | ||
|
|
||
| def mxfp4_output(self, overrides=None, missing=(), reverse=False): |
There was a problem hiding this comment.
[SHOULD-FIX] MXFP4 tests rely only on synthetic client output, not the real CSV/help format
Location: tests/benchmarks/micro_benchmarks/test_hipblaslt_function.py -- mxfp4_output / _MXFP4_HELP_OPTIONS
Evidence:
def mxfp4_output(self, overrides=None, missing=(), reverse=False):
"""Build synthetic CSV, not a captured GPU result."""Issue:
Verified: the real client (ArgumentModel) prints ~30 more columns, an indented value row, and --Solution index / --Solution name lines before --kernel name:; real --help lines are padded (setw 34/82) and end with (Default value is: N). The current regexes were checked against that format and do match today, but no fixture locks this in.
Impact:
A client output/help formatting change, or a mismatch with the real format, would not be caught by CI; on hardware it would surface as preflight INVALID_ARGUMENT or a parsing failure.
Recommendation:
Add one fixture copied from real hipblaslt-bench output for a TN f4 problem (full column set, indented row, solution/kernel lines) and one real-format --help excerpt for --scaleA, --scaleB, --initialization. Keep the synthetic mutation tests.
| _MXFP4_ARGS = ( | ||
| '--a_type f4_r --b_type f4_r --c_type f32_r --d_type f32_r --compute_type f32_r' | ||
| ' --scaleA 3 --scaleB 3 --alpha 1 --beta 0 --algo_method heuristic --requested_solution 1' | ||
| ' --verify_strict --use_gpu_timer --print_kernel_info' |
There was a problem hiding this comment.
[NON-BLOCKING] Always-on CPU reference verification is expensive at default shapes
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- _MXFP4_ARGS
Evidence:
' --verify_strict --use_gpu_timer --print_kernel_info'Issue:
Upstream help: --verify_strict "Implies --verify. Computes a CPU reference per problem". The base default --shapes is 2048,4096,8192 cubed, so an mxfp4 run without explicit shapes performs CPU GEMMs up to ~1.1 TFLOP each.
Impact:
Very long runtimes and possible benchmark timeouts when users do not override shapes.
Recommendation:
Document the cost and recommend small shapes for mxfp4, or reject/warn when mxfp4 is used with the default shape list.
| 0 <= norm_error < 1e-5 | ||
| and all(math.isfinite(v) and v >= 0 for v in (float(row['atol']), float(row['rtol']))) | ||
| ): | ||
| raise ValueError('MXFP4 verification error columns must be finite and within bounds.') |
There was a problem hiding this comment.
[NON-BLOCKING] Numerical verification failure is logged as a result-format error
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- _record_mxfp4_result / _process_raw_result
Evidence:
raise ValueError('MXFP4 verification error columns must be finite and within bounds.')
...
self._result.add_result(f'{metric}_correctness', 1)Issue:
A genuine accuracy failure (e.g. norm_error >= 1e-5) raises ValueError, which _process_raw_result maps to MICROBENCHMARK_RESULT_PARSING_FAILURE with the message "The result format is invalid". _correctness is therefore either 1 or absent, never 0 (unlike cublas_function.py).
Impact:
Operators cannot easily tell a numerical failure from malformed client output; _correctness carries no information beyond metric presence.
Recommendation:
Either emit _correctness = 0 (and skip flops) on a verification miss with a distinct log message, or document that _correctness is emitted only on success and log verification failures separately.
| return False | ||
|
|
||
| for (_m, _n, _k, _b, _in_type) in self._shapes_to_run: | ||
| command = f'{self.__bin_path} -m {_m} -n {_n} -k {_k} -j {self._args.num_warmup}' + \ |
There was a problem hiding this comment.
[NON-BLOCKING] Executable path quoted in help probe but not in benchmark command
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- _preprocess
Evidence:
command = f'{self.__bin_path} -m {_m} -n {_n} -k {_k} -j {self._args.num_warmup}' + \Issue:
_check_mxfp4_support uses shlex.quote(self.__bin_path), but the main command (run via run_command, shell=True) does not. Pre-existing for the main command; the PR introduces the inconsistency.
Impact:
A bin_dir with spaces passes preflight but fails at execution.
Recommendation:
Use shlex.quote(self.__bin_path) in the command as well.
| float(fields[gflops_col]) / 1000 | ||
| ) | ||
| except BaseException as e: | ||
| except (KeyError, ValueError) as e: |
There was a problem hiding this comment.
[NON-BLOCKING] Exception narrowing changes failure mode for wrapper bookkeeping bugs
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- _process_raw_result
Evidence:
except (KeyError, ValueError) as e:Issue:
Verified: client output can only raise KeyError/ValueError in this path, so parsing behavior is unchanged. However, an IndexError/TypeError from a wrapper bug now escapes to Benchmark.run() (except BaseException -> RUNTIME_EXCEPTION_ERROR) and aborts remaining commands, whereas previously it was a per-command parsing failure. This is intentional and tested (test_mxfp4_result_requires_valid_command_index).
Impact:
Affects all precisions, not only mxfp4; no impact on valid client output.
Recommendation:
Keep as is, but call the behavior change out in the PR description since it applies to legacy precisions too.
| error = self._mxfp4_argument_error() | ||
| if error: | ||
| self._result.set_return_code(ReturnCode.INVALID_ARGUMENT) | ||
| logger.error('Invalid MXFP4 arguments - benchmark: %s, message: %s', self._name, error) |
There was a problem hiding this comment.
[NON-BLOCKING] Mixed logger formatting styles and inline magic constants
Location: superbench/benchmarks/micro_benchmarks/hipblaslt_function.py -- _check_mxfp4_support / _preprocess / _record_mxfp4_result
Evidence:
logger.error('Invalid MXFP4 arguments - benchmark: %s, message: %s', self._name, error)Issue:
New code mixes %s, .format() and f-strings in adjacent logger calls. The expected CSV values (f4_r, f32_r, scale 3), 'gfx1250', block size 32, rel_tol=0.01 and 1e-5 are inline literals duplicated between _MXFP4_ARGS and _record_mxfp4_result.
Impact:
Minor readability; future changes to MXFP4 options require synchronized edits in several places.
Recommendation:
Use one logger style, and hoist the shared type/scale values and tolerances into named module constants used by both command generation and validation.


Scope
Add
mxfp4to the existing ROCmhipblaslt-gemmwrapper for AMD Instinct MI455X (gfx1250). Usein_types: [mxfp4]with the layout and initialization shown below; FP16 remains the default. Existing FP32/FP16/BF16/FP8 commands and metrics are unchanged. No new package, image, production SKU configuration or threshold is introduced.Use a dedicated benchmark instance with a compatible
hipblaslt-bench. The reference client encodes 32-element E8M0 blocks for both inputs as--scaleA 3 --scaleB 3(B32E8); it does not use separate block row/column switches. The upstream gfx1250 test includes FP4 inputs, FP32 compute and output, TN andmaf2_0initialization.The path requests one solution, GPU-event timing, kernel information and strict CPU verification. It checks the returned shape, dtypes, scale modes, timing/throughput consistency and verification fields before recording metrics. The wrapper additionally requires
norm_error < 1e-5; that conservative bound needs hardware calibration. Bothmxfp4andmaf2_0require a dedicatedmxfp4benchmark instance. Preflight validates the requested case, reads the GFX target from visible device 0 once, and checks the scale and initialization values advertised by the client. The verification, GPU-timer and kernel-info switches are passed directly to the client; a nonzero exit produces no metrics for that command.tolerant_faildoes not fall back to another precision.Validation