[CI] run_benchmark: treat runtime pytest.skip as skipped, not failed#842
Merged
Conversation
run_benchmark.sh invokes each kernel test as a plain script (python3
tests/kernels/test_*.py), not through pytest. When such a file reaches a
pytest.skip()/pytest.importorskip() at runtime -- e.g. a single-GPU runner
hitting the layernorm multi-GPU test ("needs >=2 GPUs"), an arch guard, or the
mla_decode test hitting an aiter API drift (hk_mla_decode_fwd removed) -- the
skip raises an uncaught Skipped exception, the script exits non-zero, and the
op was counted as "failed", turning the whole benchmark job (and thus CI) red.
The pytest suite already tolerates these (they show up as skips), so only the
benchmark step was going red; this made main and several unrelated PRs fail for
purely environmental reasons.
Add a _fail_or_skip helper that downgrades a non-zero benchmark exit to
"skipped" when its log contains a "Skipped:" marker (mirroring the existing
grep -q "Skipped:" handling already used for hgemm/fp8), and route the plain
failure branches (softmax, layernorm, rmsnorm, flash_attn, mla, gemm,
gemm_async, hgemm, moe, moe_w4a16, RDNA WMMA) through it. Genuine failures
still count and dump their log tail. Report a Skipped count in the summary;
the job still fails iff FAIL_COUNT > 0.
The arch-specific blocks (fp8_8wave_rowscale, gemm_fp4, moe_fp4, moe_a8w4)
keep their existing bespoke skip detection.
This was referenced Jul 15, 2026
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.
Problem
test (linux-flydsl-*)has been red onmainand on multiple open PRs (#785, #801, …). The test suites actually pass — the failure is entirely in the benchmark step.scripts/run_benchmark.shruns each kernel test as a plain script (python3 tests/kernels/test_*.py), not through pytest. When one of those files reaches apytest.skip()/pytest.importorskip()at runtime, the skip raises an uncaughtSkippedexception, the process exits non‑zero, and the op was counted as failed → the whole job (and CI) goes red.Two independent triggers of the same flaw:
mla(CDNA runners, andmainitself): upstreamaiterdropped/renamedhk_mla_decode_fwd→hk_mla_v32_decode_fwd.test_mla_decode.pyguards the import withpytest.skip(allow_module_level=True)(added in [Fix]: mla_decode test aborts whole collection on aiter API drift #840), which correctly skips under pytest but hard‑fails when run as a script.layernorm(all single‑GPU runners incl. navi):test_layernorm.py's multi‑GPU test callspytest.skip("needs >=2 GPUs").So
mainand several PRs were failing for purely environmental reasons, not because of their own changes.Fix
Add a small
_fail_or_skiphelper that downgrades a non‑zero benchmark exit to skipped when the log contains aSkipped:marker — mirroring thegrep -q "Skipped:"handling this script already uses forhgemm/fp8. Route the plain failure branches through it:softmax, layernorm, rmsnorm, flash_attn, mla, gemm, gemm_async, hgemm, moe, moe_w4a16, RDNA WMMA.Skipped:count; the job still fails iffFAIL_COUNT > 0.fp8_8wave_rowscale,gemm_fp4,moe_fp4,moe_a8w4) keep their existing bespoke skip detection.Scope / non‑goals
main, [2/5] autotune: add opt-in search and RMSNorm waves-per-EU tuning (#770) #785, [layernorm] Add backward pass for training (PR 3/3, #769) #801 (themla+layernormskips).aiterAPI drift — a follow‑up should either pinaiteror movetest_mla_decode.pytohk_mla_v32_decode_fwd.tests/unit/test_autotune.py, emptycaplog) — that's a separate code bug in that PR.Test plan
bash -nandsh -npass (POSIX‑sh clean; script is#!/bin/sh).Skipped:→SKIP_COUNT, a log withAssertionError→FAIL_COUNT.mla/layernormshould now showskipand the benchmark summary should endFailed: 0→ job green.Made with Cursor