Skip to content

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

Merged
zufayu merged 1 commit into
mainfrom
fix/disable-sampling-rocm10
Aug 18, 2026
Merged

zufayu merged 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 <[email protected]>
Co-authored-by: Cursor <[email protected]>
@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 Resolved
Comment thread csrc/cpp_itfs/sampling/__init__.py Resolved
@zufayu
zufayu self-requested a review August 17, 2026 01:36
@zufayu zufayu added the ci:all label Aug 17, 2026
@zufayu

zufayu commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

torch.version.hip is torch's build-time ROCm, but sampling.cuh is compiled by the system hipcc from PATH. These diverge during a ROCm 10 migration, so the guard won't fire when it matters.

Could you paste the actual hipcc error? It decides whether this belongs in sampling or in the shared -mllvm flags.

@fsx950223

Copy link
Copy Markdown
Contributor Author

torch.version.hip is torch's build-time ROCm, but sampling.cuh is compiled by the system hipcc from PATH. These diverge during a ROCm 10 migration, so the guard won't fire when it matters.

Could you paste the actual hipcc error? It decides whether this belongs in sampling or in the shared -mllvm flags.

clang (LLVM option parsing): Unknown command line argument '-amdgpu-coerce-illegal-types=1'. Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '--amdgpu-mode-register=1'?
failed to execute:/opt/python/lib/python3.14/site-packages/rocm_sdk_devel/lib/llvm/bin/clang++ --offload-arch=gfx950 --offload-arch=gfx950 --offload-arch=gfx950 --offload-arch=gfx950 --offload-arch=gfx950 --offload-arch=gfx950 --offload-arch=gfx950 --offload-arch=gfx950 -O3 -mllvm -amdgpu-coerce-illegal-types=1 -x hip -c /dev/null -o "/dev/null"
(EngineCore pid=682) [aiter WARNING] 2026-08-13 05:27:05.292 - EngineCore:682 - /opt/python/lib/python3.14/site-packages/aiter_meta/csrc/cpp_itfs/utils.py:141 - hip_flag_checker
(EngineCore pid=682) -mllvm -amdgpu-coerce-illegal-types=1 is not supported by hipcc.
hipcc -fPIC -DUSE_PROF_API=1 -Wno-switch-bool -Wno-vla-cxx-extension -mllvm --amdgpu-kernarg-preload-count=16 -D__HIP_PLATFORM_HCC
_=1 -D__HIP_PLATFORM_AMD__=1 -fgpu-flush-denormals-to-zero -mllvm -enable-post-misched=0 -mllvm -amdgpu-early-inline-all=true -U__HIP_NO_HALF_OPERATORS__ --offload-arch=gfx950 -DLEGACY_HIPBLAS_DIRECT -O3 -mllvm -amdgpu-function-calls=false -Wno-undefined-func-template -fno-offload-uniform-block -DENABLE_FP8 -std=c++20 -U__HIP_NO_HALF_CONVERSIONS__ -mllvm --lsr-drop-solution=1 -Wno-unused-result -DUSE_ROCM -DENABLE_CK=1 -I/root/.aiter/build/top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7/include -c top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7.cpp -o top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7.o
In file included from top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7.cpp:18:
/root/.aiter/build/top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7/include/sampling.cuh:87:29: error: no type named 'Traits' in namespace 'hipcub'
87 | device typename hipcub::Traits::UnsignedBits twiddle_in(T key, bool select_min) {
| ~~~~~~~~~~~~~~~~~^~~~~~
/root/.aiter/build/top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7/include/sampling.cuh:87:35: error: expected unqualified-id
87 | device typename hipcub::Traits::UnsignedBits twiddle_in(T key, bool select_min) {
| ^
/root/.aiter/build/top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7/include/sampling.cuh:101:43: error: no type named 'Traits' in namespace 'hipcub'
101 | device T twiddle_out(typename hipcub::Traits::UnsignedBits bits, bool select_min) {
| ~~~~~~~~~~~~~~~~~^~~~~~
/root/.aiter/build/top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7/include/sampling.cuh:101:49: error: expected ')'
101 | device T twiddle_out(typename hipcub::Traits::UnsignedBits bits, bool select_min) {
| ^
/root/.aiter/build/top_k_top_p_sampling_from_probs_51f5779b2644c0a61347d39ea3295db7/include/sampling.cuh:101:25: note: to match this '('
101 | device T twiddle_out(typename hipcub::Traits::UnsignedBits bits, bool select_min) {

@zufayu

zufayu commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

On ROCm 7.0, where hipcub::Traits exists, removing one include from sampling.cuh reproduces your error exactly — all six diagnostics, same lines and columns. sampling.cuh never includes util_type.hpp; only block_scan.hpp reaches it. A missing include and a removed API look identical here. Please post:

grep -n "struct Traits" $(dirname $(command -v hipcc))/../include/hipcub/backend/rocprim/util_type.hpp

@fsx950223

Copy link
Copy Markdown
Contributor Author

On ROCm 7.0, where hipcub::Traits exists, removing one include from sampling.cuh reproduces your error exactly — all six diagnostics, same lines and columns. sampling.cuh never includes util_type.hpp; only block_scan.hpp reaches it. A missing include and a removed API look identical here. Please post:

grep -n "struct Traits" $(dirname $(command -v hipcc))/../include/hipcub/backend/rocprim/util_type.hpp

On ROCm 7.0, where hipcub::Traits exists, removing one include from sampling.cuh reproduces your error exactly — all six diagnostics, same lines and columns. sampling.cuh never includes util_type.hpp; only block_scan.hpp reaches it. A missing include and a removed API look identical here. Please post:

grep -n "struct Traits" $(dirname $(command -v hipcc))/../include/hipcub/backend/rocprim/util_type.hpp

I want to disable the kernel on rocm10. It works in my dev container

@zufayu

zufayu commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

If we merge this, sampling on ROCm 10 will quietly switch to the slow PyTorch path and stay there. That may be the right call — but only if hipcub::Traits is really gone.

I don't think we know that yet. I tested on ROCm 7.0, where Traits definitely exists. I deleted one #include from sampling.cuh and got your exact error: all six messages, same line and column numbers.

Here's why that's possible. sampling.cuh uses hipcub::Traits, but it never includes hipcub/util_type.hpp. It only gets Traits by accident, through block_scan.hpp.

So your error has two possible causes, and they look identical:

  1. hipCUB removed Traits in ROCm 10.
  2. We forgot an #include, and the accidental path is gone.

We don't have a ROCm 10 machine. Can you run this?

grep -n "struct Traits" $(dirname $(command -v hipcc))/../include/hipcub/backend/rocprim/util_type.hpp
  • Prints nothing → cause 1. I'll approve this PR.
  • Prints a line → cause 2. We add one #include and keep the fast kernels.

One more thing, from my first review: the check uses torch.version.hip. That's the ROCm version torch was built with, not the one hipcc uses now. During a ROCm 10 migration, hipcc is 10 but torch is often still a 7.x build. Then the check does nothing — in exactly the case it's meant for.

@zufayu

zufayu commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Facts

  1. sampling.cuh includes only hipcub/block/*.hpp but uses Traits (L87),
    Min (L505), Max (L1063) — util_type.hpp and thread_operators.hpp are
    never included directly. On ROCm 7.0 I deleted one #include and got your six
    diagnostics, same lines and columns.
  2. The guard misses its own target case. compile() is call-time
    (top_k_top_p_sampling_from_probs.py:68) and hipcc failure raises
    CalledProcessError (utils.py:242), not ImportError. In a real ROCm 10
    migration you install the new SDK first and torch is still a 7.x build, so
    torch.version.hip reads 7, the gate stays silent, and you crash at first
    sample — the exact scenario this PR exists for.
  3. compile_template_op already keys five flag decisions off get_hip_version()
    (utils.py:216-228) — including the -amdgpu-coerce-illegal-types=1 your log
    flags. The new guard is the only place using torch.version.hip.

Supporting, not conclusive: Traits is still present and undeprecated on
hipCUB@develop (util_type.hpp:839), and hipCUB has no ROCm 10 tag. Your grep
still settles it.

Asks

  1. Add #include <hipcub/util_type.hpp> + thread_operators.hpp to
    sampling.cuh — unblocks you either way, no need to settle the root cause.
  2. Key the guard off get_hip_version(), consistent with the rest of the file.

Then I'll approve.

@zufayu zufayu 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.

Approving — this is a no-op on every currently supported ROCm and unblocks the
ROCm 10 work, so it shouldn't wait on the root-cause question.

Filed #4819 to keep that question alive: sampling.cuh uses hipcub::Traits
(L87), Min (L505) and Max (L1063) but never includes util_type.hpp or
thread_operators.hpp — all three arrive transitively today, so this may be a
missing include rather than a removed API. Traits is still present and
undeprecated on hipCUB@develop. The AITER_ROCM_VERSION override means that
can be tested after this lands, no revert needed.

@zufayu
zufayu merged commit fc2e5d5 into main Aug 18, 2026
90 of 92 checks passed
@zufayu
zufayu deleted the fix/disable-sampling-rocm10 branch August 18, 2026 08:58
jvadakat added a commit to jvadakat/vllm that referenced this pull request Aug 18, 2026
To accomdate the aiter fix ROCm/aiter#4754
zufayu pushed a commit that referenced this pull request Aug 20, 2026
…dency (#4843)

* fix(sampling): support ROCm 10 by dropping hipcub::Traits dependency

ROCm 10's hipcub removed the deprecated `hipcub::Traits<T>` class, so
`csrc/cpp_itfs/sampling/sampling.cuh` failed to compile:

    error: no type named 'Traits' in namespace 'hipcub'

which is why #4754 disabled cpp_itfs sampling on ROCm 10 entirely.

The radix_topk code only used `hipcub::Traits<T>::UnsignedBits`, and only
ever with T=float. Replace it with a self-contained `radix_traits<float>`
(UnsignedBits = uint32_t). The float twiddle logic is byte-identical to the
previous float branch (select_min was already a no-op for float), so runtime
behavior is unchanged.

With the toolchain incompatibility fixed, re-enable the kernels on ROCm 10:
- remove the ROCm-10 import guard (csrc/cpp_itfs/sampling/__init__.py)
- revert the ROCm-10 skip in op_tests/test_sampling.py

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(sampling): drop removed hipcub::Max/Min functors for ROCm 10

ROCm 10 hipcub (CCCL 3.0) no longer exposes the deprecated hipcub::Max /
hipcub::Min reduction functors, so BlockReduce().Reduce(..., hipcub::Max()/Min())
failed with "no member named 'Max'/'Min' in namespace 'hipcub'". This surfaced
only on the real ROCm 10 image after the hipcub::Traits fix.

Replace them with self-contained AiterMaxOp / AiterMinOp functors (same
semantics), keeping sampling.cuh independent of hipcub symbols that change
across ROCm versions.

Validated on rocm/ufb-private ...rocm10.0.0rc3 (hipcub 5.0 / CCCL 3.0,
torch 2.12.0+rocm10.0.0rc3, MI308X): all three sampling ops compile for
gfx942/gfx950 and op_tests/test_sampling.py passes 348 passed, 4 skipped
(matched runtime, no HIP_LAUNCH_BLOCKING).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: sixifang <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
gyohuangxin added a commit that referenced this pull request Aug 20, 2026
* [HIP] fix(sampling): support ROCm 10 by dropping hipcub::Traits dependency (#4843)

* fix(sampling): support ROCm 10 by dropping hipcub::Traits dependency

ROCm 10's hipcub removed the deprecated `hipcub::Traits<T>` class, so
`csrc/cpp_itfs/sampling/sampling.cuh` failed to compile:

    error: no type named 'Traits' in namespace 'hipcub'

which is why #4754 disabled cpp_itfs sampling on ROCm 10 entirely.

The radix_topk code only used `hipcub::Traits<T>::UnsignedBits`, and only
ever with T=float. Replace it with a self-contained `radix_traits<float>`
(UnsignedBits = uint32_t). The float twiddle logic is byte-identical to the
previous float branch (select_min was already a no-op for float), so runtime
behavior is unchanged.

With the toolchain incompatibility fixed, re-enable the kernels on ROCm 10:
- remove the ROCm-10 import guard (csrc/cpp_itfs/sampling/__init__.py)
- revert the ROCm-10 skip in op_tests/test_sampling.py

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(sampling): drop removed hipcub::Max/Min functors for ROCm 10

ROCm 10 hipcub (CCCL 3.0) no longer exposes the deprecated hipcub::Max /
hipcub::Min reduction functors, so BlockReduce().Reduce(..., hipcub::Max()/Min())
failed with "no member named 'Max'/'Min' in namespace 'hipcub'". This surfaced
only on the real ROCm 10 image after the hipcub::Traits fix.

Replace them with self-contained AiterMaxOp / AiterMinOp functors (same
semantics), keeping sampling.cuh independent of hipcub symbols that change
across ROCm versions.

Validated on rocm/ufb-private ...rocm10.0.0rc3 (hipcub 5.0 / CCCL 3.0,
torch 2.12.0+rocm10.0.0rc3, MI308X): all three sampling ops compile for
gfx942/gfx950 and op_tests/test_sampling.py passes 348 passed, 4 skipped
(matched runtime, no HIP_LAUNCH_BLOCKING).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: sixifang <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

* [HIP] fix(topk_per_row): support ROCm 10 by dropping hipcub::Traits dependency (#4853)

* [topk_per_row] include <optional> where it is used

topk_per_row_kernels.cu declares its own entry points taking
std::optional<aiter_tensor_t> (L2849/2854/2962) but never includes
<optional>; it does not include its own header csrc/include/topk_per_row.h,
which does. The TU only compiled because something else in the include set
happened to drag <optional> in.

On ROCm 7.0.0 nothing does, and pristine upstream fails to build:

  topk_per_row_kernels.cu:2849:33: error: no template named 'optional' in namespace 'std'
  topk_per_row_kernels.cu:2854:75: error: no member named 'nullopt' in namespace 'std'

Most likely fallout from #4702 de-torching this TU: dropping the torch
headers dropped the transitive <optional> with them, and the ROCm 7.2 CI
image still supplies it by another path so nobody noticed.

Include what we use. No functional change -- the code object is bit-identical
either way; this only decides whether the file compiles.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* [topk_per_row] drop the hipcub::Traits dependency

ROCm 10 ships hipcub built on CCCL 3.0, which removed the public
hipcub::Traits<> class. topk_per_row_kernels.cu used it in 13 places
(11 live, 2 inside a commented-out twiddle_out), so the two modules that
compile this TU -- module_top_k_per_row and module_topk_plain -- cannot be
built on ROCm 10.

This is the same breakage #4843 is fixing in csrc/cpp_itfs/sampling/
sampling.cuh, and literally the same code: the radix top-k twiddle_in was
written in this file (#1394, 2025-11), copied within it a second time
(#3087, 2026-05-10), and copied into sampling.cuh two weeks later (#3217).
#4843 fixes the third copy; this fixes the first two.

Rather than add a third private stand-in, put it where #4594 already moved
the hipcub comparison functors -- csrc/include/hip_reduce.h now also carries
aiter::radix_traits. #4594 skipped sampling.cuh because Traits "had no local
equivalent"; this adds that equivalent, so #4843's local radix_traits can
collapse onto it later (sampling is built through cpp_itfs, whose include
list is an explicit file whitelist, so that needs three one-line changes in
csrc/cpp_itfs/sampling/*.py -- out of scope here).

radix_traits<float>::UnsignedBits is uint32_t, which is exactly what hipcub
resolved: NumericTraits<float> -> BaseTraits<FLOATING_POINT, true, false,
unsigned int, float>. It is deliberately left undefined for every other T:
every instantiation of this file's radix paths is <float, ...>
(mb::standalone_stable_radix_topk and ob::dispatch_topk_oneblock, 14 call
sites), so a new dtype should fail to compile rather than silently pick a
width. The non-float branch of twiddle_in is dropped for the same reason and
replaced by a static_assert; select_min was already dead there for float
(the mask is symmetric, the ordering flip lives at the call sites). The
float bit math is transcribed unchanged.

Validated on gfx942 + gfx950, ROCm 7.0.0 / hipcc 7.0.51831, by compiled
output rather than tests alone:

- ISA is byte-identical, both arches. .text, .rodata and the full
  disassembly of every code object in .hip_fatbin all match the pre-change
  build (gfx942 .text d115e671f0ea2eeb, 19 kernels, 138991 lines;
  gfx950 .text 051fa067e0199306, 19 kernels, 138548 lines). The raw ELF
  bytes are not a usable check -- .dynsym/.dynstr/.strtab/.hash differ
  between two builds of the *same* source -- so the harness was first
  self-checked by building the baseline twice and confirming .text and the
  disassembly are stable.
- No new warnings. The 3 -Wc++23-extensions warnings the TU now emits come
  from block_reduce in hip_reduce.h and are pre-existing: the unmodified
  header alone emits the same 3, as does topk_softmax_kernels.cu and every
  other consumer.
- module_top_k_per_row builds (19.6s). op_tests/test_topk_per_row.py 737/737
  rows pass plus mb_workspace_reuse PASS; test_topk_per_row_stable.py
  "RESULT: ALL PASS"; test_topk_row_prefill.py standard and fast kernels
  both pass.

Known gaps, deliberately not addressed:

- Not verified on ROCm 10 -- no such toolchain here. The claim rests on this
  being the same edit #4843 validated in a rocm10.0.0rc3 container, removing
  the one symbol that errored there.
- This TU still uses hipcub BlockScan / BlockLoad / BlockStore, which #4843
  proves survive CCCL 3.0, and BlockRadixSort, whose ROCm 10 status neither
  PR covers. So this makes topk_per_row build on ROCm 10 as far as Traits is
  concerned; it does not make the file hipcub-free.
- module_topk_plain still cannot be built here, but for an unrelated
  pre-existing reason: topk_plain_kernels.cu fails with
  ComputeTypeTraits<unsigned short> not specialized (12 errors on pristine
  upstream too). That file does not include hip_reduce.h.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: zufayu <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: who who who <[email protected]>
Co-authored-by: sixifang <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: zufayu <[email protected]>
Co-authored-by: zufayu <[email protected]>
nsakkine pushed a commit to nsakkine/aiter that referenced this pull request Aug 21, 2026
Fail import before the incompatible sampling.cuh JIT path so callers can fall back cleanly.

Signed-off-by: fsx950223 <[email protected]>
Co-authored-by: Cursor <[email protected]>
nsakkine pushed a commit to nsakkine/aiter that referenced this pull request Aug 21, 2026
…dency (ROCm#4843)

* fix(sampling): support ROCm 10 by dropping hipcub::Traits dependency

ROCm 10's hipcub removed the deprecated `hipcub::Traits<T>` class, so
`csrc/cpp_itfs/sampling/sampling.cuh` failed to compile:

    error: no type named 'Traits' in namespace 'hipcub'

which is why ROCm#4754 disabled cpp_itfs sampling on ROCm 10 entirely.

The radix_topk code only used `hipcub::Traits<T>::UnsignedBits`, and only
ever with T=float. Replace it with a self-contained `radix_traits<float>`
(UnsignedBits = uint32_t). The float twiddle logic is byte-identical to the
previous float branch (select_min was already a no-op for float), so runtime
behavior is unchanged.

With the toolchain incompatibility fixed, re-enable the kernels on ROCm 10:
- remove the ROCm-10 import guard (csrc/cpp_itfs/sampling/__init__.py)
- revert the ROCm-10 skip in op_tests/test_sampling.py

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(sampling): drop removed hipcub::Max/Min functors for ROCm 10

ROCm 10 hipcub (CCCL 3.0) no longer exposes the deprecated hipcub::Max /
hipcub::Min reduction functors, so BlockReduce().Reduce(..., hipcub::Max()/Min())
failed with "no member named 'Max'/'Min' in namespace 'hipcub'". This surfaced
only on the real ROCm 10 image after the hipcub::Traits fix.

Replace them with self-contained AiterMaxOp / AiterMinOp functors (same
semantics), keeping sampling.cuh independent of hipcub symbols that change
across ROCm versions.

Validated on rocm/ufb-private ...rocm10.0.0rc3 (hipcub 5.0 / CCCL 3.0,
torch 2.12.0+rocm10.0.0rc3, MI308X): all three sampling ops compile for
gfx942/gfx950 and op_tests/test_sampling.py passes 348 passed, 4 skipped
(matched runtime, no HIP_LAUNCH_BLOCKING).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: sixifang <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
nsakkine pushed a commit to nsakkine/aiter that referenced this pull request Aug 24, 2026
Fail import before the incompatible sampling.cuh JIT path so callers can fall back cleanly.

Signed-off-by: fsx950223 <[email protected]>
Co-authored-by: Cursor <[email protected]>
nsakkine pushed a commit to nsakkine/aiter that referenced this pull request Aug 24, 2026
…dency (ROCm#4843)

* fix(sampling): support ROCm 10 by dropping hipcub::Traits dependency

ROCm 10's hipcub removed the deprecated `hipcub::Traits<T>` class, so
`csrc/cpp_itfs/sampling/sampling.cuh` failed to compile:

    error: no type named 'Traits' in namespace 'hipcub'

which is why ROCm#4754 disabled cpp_itfs sampling on ROCm 10 entirely.

The radix_topk code only used `hipcub::Traits<T>::UnsignedBits`, and only
ever with T=float. Replace it with a self-contained `radix_traits<float>`
(UnsignedBits = uint32_t). The float twiddle logic is byte-identical to the
previous float branch (select_min was already a no-op for float), so runtime
behavior is unchanged.

With the toolchain incompatibility fixed, re-enable the kernels on ROCm 10:
- remove the ROCm-10 import guard (csrc/cpp_itfs/sampling/__init__.py)
- revert the ROCm-10 skip in op_tests/test_sampling.py

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(sampling): drop removed hipcub::Max/Min functors for ROCm 10

ROCm 10 hipcub (CCCL 3.0) no longer exposes the deprecated hipcub::Max /
hipcub::Min reduction functors, so BlockReduce().Reduce(..., hipcub::Max()/Min())
failed with "no member named 'Max'/'Min' in namespace 'hipcub'". This surfaced
only on the real ROCm 10 image after the hipcub::Traits fix.

Replace them with self-contained AiterMaxOp / AiterMinOp functors (same
semantics), keeping sampling.cuh independent of hipcub symbols that change
across ROCm versions.

Validated on rocm/ufb-private ...rocm10.0.0rc3 (hipcub 5.0 / CCCL 3.0,
torch 2.12.0+rocm10.0.0rc3, MI308X): all three sampling ops compile for
gfx942/gfx950 and op_tests/test_sampling.py passes 348 passed, 4 skipped
(matched runtime, no HIP_LAUNCH_BLOCKING).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: sixifang <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants