Skip to content

Fix 14 GPU-only test failures on gfx942 - #14

Merged
demandal25 merged 2 commits into
amd-integrationfrom
gpu-test-failures
Aug 1, 2026
Merged

Fix 14 GPU-only test failures on gfx942#14
demandal25 merged 2 commits into
amd-integrationfrom
gpu-test-failures

Conversation

@demandal25

Copy link
Copy Markdown
Collaborator

Summary

Fixes 14 of the 18 test failures on MI300X / gfx942. The suite was 18-failed/302-passed on GPU while CI stayed green, because every failing test is gated on requires_torch_cuda / device_count() == 0 and this fork's CI is CPU-only.

None of these failures are ROCm-specific. Both root causes are in the tests, not in production code, and would fail identically on NVIDIA.

Root cause 1 — tests skipped a config-resolution step (12 failures)

There are two config types: BenchmarkConfig (what you write; every eval field is Optional and defaults to None) and ResolvedEvalConfig (what evaluators consume; every field populated). cfg.resolve_eval_config(definition) converts one to the other.

The tests passed the unresolved BenchmarkConfig straight to Evaluator.evaluate(), which is annotated for ResolvedEvalConfig. Python does not enforce annotations at runtime, so it ran until the tolerances were actually used:

flashinfer_bench/bench/utils.py:113
    exceeds_tol_mask = (abs_error > cfg.atol) & (rel_error > cfg.rtol)
E   TypeError: '>' not supported between instances of 'Tensor' and 'NoneType'

Production is unaffected — isolated_runner.py:49 and persistent_runner.py:253 both resolve first. The tests now do the same, at all 25 call sites across three files.

Root cause 2 — a stale trace-path assertion (1 failure)

test_benchmark_with_mixed_results asserted traces/{op_type}/{name}.jsonl. add_traces has written traces/{author}/{op_type}/{name}.jsonl since d3f798c ("Adapt codebase to author-based trace directory layout", flashinfer-ai#379). The code is right and the test was never migrated — verified both directions: the file lands at traces/tester/op/simple_add.jsonl, and TraceSet.from_path rediscovers both traces because the loader rglobs recursively. CLAUDE.md documented the same stale layout (and hardcoded solutions/baseline/, where baseline is one author value) and is corrected to match.

Preventing recurrence

Evaluator.evaluate() now rejects a non-ResolvedEvalConfig at the boundary with a message naming the fix, rather than failing 100 lines deeper with a Tensor > NoneType error that says nothing about config resolution. This is the only production change in the PR; correct callers are unaffected.

Also ignores GPU run artifacts — each suite run on gfx942 leaves a ~900MB root-owned core from the MLA crashes plus .rocprofv3/, which make git add -A fail outright.

Not fixed here

  • The 4 test_mla_paged failures remain red. They are an amd-flashinfer coverage gap (module 'flashinfer' has no attribute 'mla'), not something this PR can address, and are deliberately left failing rather than skipped so the gap stays visible. This PR does not make the GPU suite green.
  • A tests/serve ordering flake present in the original run has not recurred in three full runs since. The 12 evaluator tests previously errored mid-suite, which is the likely source of the state it tripped on.

Follow-ups this work surfaced (separate PRs)

  • flashinfer_bench/cli/main.py:111,155 use trace_set.workload; the field is workloads. flashinfer-bench report merge dies with AttributeError on any input.
  • scripts/collect_stream.py:350,363 still use the pre-Adapt codebase to author-based trace directory layout flashinfer-ai/flashinfer-bench#379 flat trace path, so push_trace never finds the file, logs a warning, and the pipeline reports success having uploaded no traces.
  • trace_set.py:711 interpolates raw solution.author into an on-disk path with no sanitization, while cli/main.py:147 guards the analogous solutions path with _safe_path_segment.
  • The GPU workflow runs only tests/compile tests/agent tests/integration/test_aiter_generator.py — it excludes tests/bench, where 13 of these 18 failures lived. Worth widening once a runner is attached; note that adding tests/integration/flashinfer would go red on the MLA gap above.

Test plan

  • MI300X / gfx942, ROCm 7.2, in the docker/rocm container: 18 failed / 302 passed → 4 failed / 325 passed, stable across runs (325 vs 316 earlier reflects ROCm: fix rocprofv3 region scoping (marker column) #12's new tests, merged in during this work).
  • Confirmed the boundary guard raises the intended TypeError for the old call shape.
  • CPU: 226 passed, unchanged.
  • pre-commit run -a

The suite was 18-failed/302-passed on MI300X while CI was green, because every
one of these tests is gated on `requires_torch_cuda` / `device_count() == 0`
and this fork's CI is CPU-only. None of the failures are ROCm-specific — they
would fail identically on NVIDIA.

Two distinct causes, both in the tests rather than in production code:

1. 12 evaluator tests passed an unresolved `BenchmarkConfig` straight to
   `Evaluator.evaluate()`, which expects a `ResolvedEvalConfig`. On
   `BenchmarkConfig` the tolerances are `Optional[float] = None`, so
   `compute_error_stats` hit `TypeError: '>' not supported between instances of
   'Tensor' and 'NoneType'` at utils.py:113. Production is unaffected: both
   runners call `cfg.resolve_eval_config(definition)` first. The tests now do
   the same, at all 25 call sites across the three files.

2. `test_benchmark_with_mixed_results` asserted the pre-flashinfer-ai#379 flat trace layout.
   `add_traces` has written `traces/{author}/{op_type}/{name}.jsonl` since
   d3f798c ("Adapt codebase to author-based trace directory layout"), and the
   loader `rglob`s recursively, so writer and reader agree — only the test was
   stale. Verified the round trip: the file lands at traces/tester/op/ and
   `TraceSet.from_path` rediscovers both traces. CLAUDE.md documented the same
   stale path and is corrected to match.

Not addressed here, deliberately: the 4 `test_mla_paged` failures are an
amd-flashinfer coverage gap (`module 'flashinfer' has no attribute 'mla'`) and
are left failing rather than skipped.

A `tests/serve` ordering flake that appeared in the original run has not
recurred in two full runs since; the evaluator tests previously errored
mid-suite, which is the likely source of the state it tripped on.

Verified on MI300X / gfx942, ROCm 7.2: 18 failed/302 passed -> 4 failed/316
passed, stable across two runs. CPU unchanged at 226 passed. pre-commit clean.
Self-review of the previous commit surfaced three things it left undone.

- tests/bench/test_isolated_runner.py: the sweep fixed the 25 evaluate() call
  sites but missed compute_error_stats(), still handed a raw BenchmarkConfig.
  It passes today only because that test sets both atol and rtol explicitly;
  drop either and it reproduces the exact TypeError the sweep set out to
  remove. Build a ResolvedEvalConfig directly (no definition is in scope there
  to resolve against).

- evaluators/evaluator.py: fix the class of bug, not just its instances. The
  annotation says ResolvedEvalConfig but Python does not enforce it, so a
  BenchmarkConfig duck-types far enough to fail deep inside compute_error_stats
  with "'>' not supported between instances of 'Tensor' and 'NoneType'" and no
  hint at the cause. Reject it at the boundary with a message naming the fix.

- CLAUDE.md: the previous commit corrected the traces/ layout line and left its
  sibling solutions/ line hardcoding "baseline", which is one author value and
  not a fixed segment (docs/flashinfer-trace/validate.mdx:59 documents
  solutions/<author>/<op_type>/<definition>/).

Also ignore GPU run artifacts: every suite run on gfx942 dumps a ~900MB root
owned `core` from the MLA crashes, plus `.rocprofv3/`. Being untracked and
root-owned, they make `git add -A` fail outright.

Verified: guard raises the intended TypeError for the old call shape; GPU suite
unchanged at 4 failed (MLA only) / 316 passed; CPU 226 passed; pre-commit clean.
Copilot AI review requested due to automatic review settings August 1, 2026 04:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes GPU-only test failures by ensuring evaluator paths consume fully-resolved eval configs (matching production runners), updates the benchmark trace-path assertion to the author-scoped layout, and adds a defensive boundary check in Evaluator.evaluate() to fail fast when an unresolved config is passed.

Changes:

  • Update bench tests to call BenchmarkConfig.resolve_eval_config(definition) (and use ResolvedEvalConfig directly where appropriate).
  • Fix test_benchmark_with_mixed_results to assert the author-scoped trace layout (traces/{author}/{op_type}/{definition}.jsonl).
  • Add a runtime type guard in Evaluator.evaluate() and update docs/ignore patterns for ROCm/GPU-run artifacts.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/bench/test_isolated_runner.py Use ResolvedEvalConfig when calling compute_error_stats (matches function contract).
tests/bench/test_evaluator.py Resolve BenchmarkConfig into ResolvedEvalConfig before calling evaluator entrypoints.
tests/bench/test_dsa_topk_indexer_evaluator.py Resolve eval config before evaluation to avoid None tolerances.
tests/bench/test_dsa_sparse_attention_evaluator.py Resolve eval config before evaluation to avoid None tolerances.
tests/bench/test_benchmark.py Update trace-file assertion to author-scoped trace directory layout.
flashinfer_bench/bench/evaluators/evaluator.py Add fast-fail TypeError when cfg is not a ResolvedEvalConfig.
CLAUDE.md Fix dataset path documentation to author-scoped solutions/ and traces/ layouts.
.gitignore Ignore GPU/rocprof artifacts (needs scoping adjustment per review comment).

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

@demandal25
demandal25 merged commit c5394b1 into amd-integration Aug 1, 2026
3 checks passed
@demandal25
demandal25 deleted the gpu-test-failures branch August 1, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants