Skip to content

[Bugfix] [ROCm] [Critical] fallback to regular abi for ROCm - #44648

Merged
tjtanaa merged 2 commits into
vllm-project:mainfrom
EmbeddedLLM:fixrocmbuild
Jun 5, 2026
Merged

tjtanaa merged 2 commits into
vllm-project:mainfrom
EmbeddedLLM:fixrocmbuild

Conversation

@tjtanaa

@tjtanaa tjtanaa commented Jun 5, 2026 •

Copy link
Copy Markdown
Member

Purpose

#44334 PR requires the feature from Torch 2.11 as described in issue #44641 , however ROCm currently official supports torch 2.10 which is incompatible, this causes the build failure.

Build error message

Build Failure
/app/ellm1/vllm/build/temp.linux-x86_64-cpython-312/csrc/libtorch_stable/hip_view.hip:21:34: error: no member named 'layout' in 'torch::stable::Tensor'
   21 |   const auto layout = cpu_tensor.layout();
      |                       ~~~~~~~~~~ ^
/app/ellm1/vllm/build/temp.linux-x86_64-cpython-312/csrc/libtorch_stable/hip_view.hip:44:9: error: no viable conversion from '(lambda at /app/ellm1/vllm/build/temp.linux-x86_64-cpython-312/csrc/libtorch_stable/hip_view.hip:44:9)' to 'int64_t' (aka 'long')
   44 |         [base = cpu_tensor](void*) {});  // keep cpu tensor alive
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/lib/python3.12/dist-packages/torch/include/torch/csrc/stable/ops.h:470:13: note: passing argument to parameter 'storage_offset' here
  470 |     int64_t storage_offset = 0,
      |             ^
/app/ellm1/vllm/build/temp.linux-x86_64-cpython-312/csrc/libtorch_stable/hip_view.hip:76:65: error: no viable conversion from '(lambda at /app/ellm1/vllm/build/temp.linux-x86_64-cpython-312/csrc/libtorch_stable/hip_view.hip:72:18)' to 'int64_t' (aka 'long')
   76 |                                   contiguous_cpu.scalar_type(), deleter);
      |                                                                 ^~~~~~~
/usr/local/lib/python3.12/dist-packages/torch/include/torch/csrc/stable/ops.h:470:13: note: passing argument to parameter 'storage_offset' here
  470 |     int64_t storage_offset = 0,
      |             ^
3 errors generated when compiling for gfx1100.

Test Plan

  1. Build successfully
  2. Pass test_uva.py

Test Result

  1. Built successfully
  2. pytest -svvvvv tests/kernels/core/test_uva.py
    Results:

tests/kernels/core/test_uva.py::test_cpu_write[cuda:0] PASSED
tests/kernels/core/test_uva.py::test_cpu_write[cuda:1] PASSED
tests/kernels/core/test_uva.py::test_gpu_write[cuda:0] PASSED
tests/kernels/core/test_uva.py::test_gpu_write[cuda:1] PASSED

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 4 passed, 16 warnings in 1.43s ========================

Extra details

The silu_and_mul_per_block_quant that was moved into stable ABI in this PR #44334 works on ROCm.

pytest tests/kernels/core/test_fused_silu_mul_block_quant.py test results:

================= 650 passed, 16 warnings in 210.44s (0:03:30) =================


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>

@claude claude Bot 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@tjtanaa tjtanaa added the rocm Related to AMD ROCm label Jun 5, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Jun 5, 2026
@mergify

mergify Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Hi @tjtanaa, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

@mergify mergify Bot added ci/build nvidia bug Something isn't working labels Jun 5, 2026
@tjtanaa tjtanaa added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 5, 2026
TORCH_BOX(&get_cuda_view_from_cpu_tensor));
}

STABLE_TORCH_LIBRARY_FRAGMENT(_C_cuda_utils, cuda_utils) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The file is moved to group them together under one #ifndef USE_ROCM

Comment thread csrc/cuda_view.cu
@@ -0,0 +1,60 @@
// TODO: Remove this once ROCm upgrade to torch 2.11.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the old implementation of cuda_view.cu, will be removed once ROCm officially upgrade to torch 2.11.

@github-project-automation github-project-automation Bot moved this to Ready in NVIDIA Jun 5, 2026
@tjtanaa
tjtanaa enabled auto-merge (squash) June 5, 2026 12:41
@tjtanaa

tjtanaa commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

@mergify

mergify Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Hi @tjtanaa, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: tjtanaa <tunjian.tan@embeddedllm.com>
@tjtanaa
tjtanaa merged commit aa6fb8a into vllm-project:main Jun 5, 2026
164 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Jun 5, 2026
@github-project-automation github-project-automation Bot moved this from Ready to Done in NVIDIA Jun 5, 2026
@janeyx99

janeyx99 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@tjtanaa Is there a timeline for when ROCm will be on 2.11?

nkzhenhua pushed a commit to nkzhenhua/vllm that referenced this pull request Jun 24, 2026
philippesic pushed a commit to philippesic/vllm-semantic-cache that referenced this pull request Jul 19, 2026
kasakinozomi123 added a commit to flytiger-eco/vllm-for-sail that referenced this pull request Aug 21, 2026
Upstream PR vllm-project#44334 migrated `get_cuda_view_from_cpu_tensor` to the
torch stable ABI (csrc/libtorch_stable/cuda_view.cu), which assumes
torch >= 2.11. The PPU build environment is locked to torch 2.10,
whose stable from_blob() signature ends with
`Layout layout = Strided` and has no deleter slot, so the migrated
file cannot compile on PPU.

Following the same approach as upstream PR vllm-project#44648 (ROCm fallback),
let PPU CUDA also use the regular (non-stable) ABI implementation:

  - Delete csrc/libtorch_stable/cuda_view.cu (stable ABI version).
  - Restore csrc/cuda_view.cu (regular ABI implementation that uses
    torch::from_blob with a deleter callback).
  - CMakeLists.txt:
    * Add csrc/cuda_view.cu to VLLM_EXT_SRC for CUDA path.
    * Drop csrc/libtorch_stable/cuda_view.cu from STABLE_EXT_SRC.
    * Set TORCH_TARGET_VERSION back to 0x020A (torch 2.10) for CUDA.
    * Define VLLM_PPU_REGULAR_ABI_CUDA_VIEW for both _C and
      _C_stable_libtorch targets.
  - Source guards:
    * csrc/ops.h: declare get_cuda_view_from_cpu_tensor under
      `#if defined(USE_ROCM) || defined(VLLM_PPU_REGULAR_ABI_CUDA_VIEW)`.
    * csrc/torch_bindings.cpp: register the regular-ABI op under the
      same combined guard.
    * csrc/libtorch_stable/ops.h: skip the stable-ABI declaration when
      VLLM_PPU_REGULAR_ABI_CUDA_VIEW is defined.
    * csrc/libtorch_stable/torch_bindings.cpp: skip the stable-ABI
      ops.def and STABLE_TORCH_LIBRARY_IMPL(_C, CPU, ops) when
      VLLM_PPU_REGULAR_ABI_CUDA_VIEW is defined; keep the
      _C_cuda_utils library enabled for PPU CUDA.

TODO: Drop this WA once PPU upgrades to torch 2.11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci/build nvidia ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants