Skip to content

[Bugfix] Disable cpp_itfs sampling on ROCm 10 - #4754

Open
fsx950223 wants to merge 1 commit into
mainfrom
fix/disable-sampling-rocm10
Open

[Bugfix] Disable cpp_itfs sampling on ROCm 10#4754
fsx950223 wants to merge 1 commit into
mainfrom
fix/disable-sampling-rocm10

Conversation

@fsx950223

Copy link
Copy Markdown
Contributor

Summary

  • disable the cpp_itfs sampling package on ROCm 10 and later before the incompatible sampling.cuh JIT path is reached
  • raise ImportError so callers can use their existing fallback path
  • skip the sampling test suite only for this expected ROCm 10 incompatibility

Test plan

  • Simulate ROCm 10 with AITER_ROCM_VERSION=10.0 (352 sampling tests skipped cleanly)
  • Run a ROCm 7.2 top-k renormalization smoke test (1 passed)
  • Run Black 26.5.1 and Ruff 0.16.0 on changed files

Made with Cursor

Fail import before the incompatible sampling.cuh JIT path so callers can fall back cleanly.

Signed-off-by: fsx950223 <fsx950223@outlook.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fsx950223
fsx950223 requested review from a team and a lite review from Copilot August 14, 2026 08:45
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4754 --add-label <label>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents the cpp_itfs sampling JIT path from being entered on ROCm 10+ (where the toolchain is incompatible), by failing fast with an ImportError and conditionally skipping the sampling test suite for that expected incompatibility.

Changes:

  • Add an import-time ROCm 10+ gate for csrc.cpp_itfs.sampling that raises ImportError before JIT compilation is attempted.
  • Update op_tests/test_sampling.py to treat that specific ImportError as an expected condition and skip the module’s tests.

Reviewed changes

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

File Description
op_tests/test_sampling.py Wraps sampling import to skip the test module when the ROCm 10+ disablement ImportError is raised.
csrc/cpp_itfs/sampling/init.py Adds an import-time ROCm version check to disable cpp_itfs sampling on ROCm 10+.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread op_tests/test_sampling.py
Comment on lines +10 to +16
try:
from aiter.ops import sampling
except ImportError as exc:
if "cpp_itfs sampling is disabled on ROCm 10" not in str(exc):
raise
sampling = None
pytestmark = pytest.mark.skip(reason=str(exc))
Comment on lines +6 to +25
import os
import re

import torch


def _get_rocm_major_version() -> int | None:
version = os.environ.get("AITER_ROCM_VERSION") or getattr(
torch.version, "hip", None
)
match = re.match(r"\s*(\d+)", version or "")
return int(match.group(1)) if match else None


_rocm_major_version = _get_rocm_major_version()
if _rocm_major_version is not None and _rocm_major_version >= 10:
raise ImportError(
"AITER cpp_itfs sampling is disabled on ROCm 10 and later because "
"csrc/cpp_itfs/sampling/sampling.cuh is not compatible with this toolchain."
)
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