Skip to content

[Bugfix][ROCm] Create linear layer biases with requires_grad=False - #56161

Merged
AndreasKaratzas merged 3 commits into
vllm-project:mainfrom
ROCm:micah/fix-linear-layer
Sep 10, 2026
Merged

AndreasKaratzas merged 3 commits into
vllm-project:mainfrom
ROCm:micah/fix-linear-layer

Conversation

@micah-wil

@micah-wil micah-wil commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Purpose

After upgrading to AITER v0.1.21.post2 on ROCm in #55968, we are seeing the following test failure:

pytest -s -v evals/gpt_oss/test_gpqa_correctness.py::test_gpqa_correctness[gpt-oss-20b-rocm-quark-mxfp4-fp8-triton] --config-list-file=configs/models-gfx950.txt

(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]   File "/usr/local/lib/python3.12/dist-packages/flydsl/compiler/jit_argument.py", line 450, in __init__
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]     dl = dltensor.__dlpack__()
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]          ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]   File "/usr/local/lib/python3.12/dist-packages/torch/_tensor.py", line 1760, in __dlpack__
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]     raise BufferError(
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055] BufferError: Can't export tensors that require gradient, use tensor.detach()
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055] Traceback (most recent call last):
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]   File "/usr/local/lib/python3.12/dist-packages/flydsl/compiler/jit_argument.py", line 446, in __init__
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]     dl = dltensor.__dlpack__(stream=-1)
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]   File "/usr/local/lib/python3.12/dist-packages/torch/_tensor.py", line 1760, in __dlpack__
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055]     raise BufferError(
(Worker_TP1 pid=2684) ERROR 09-09 10:03:01 [multiproc_executor.py:1055] BufferError: Can't export tensors that require gradient, use tensor.detach()

e.g. https://buildkite.com/vllm/amd-ci/builds/12759/list?jid=01a08458-ac70-43e6-89e7-7c9668624b86&tab=output

This happened after ROCm/aiter#5145, which replaced splitk_hgemm / small_m_hgemm FlyDSL kernels with gemm_a16w16_gfx950. This kernel uses DLPack, so the biases are rejected because they use the default requires_grad=True (pytorch prohibits sending tensors to dlpack w/ requires_grad=True):

     dl = dltensor.__dlpack__(stream=-1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/usr/local/lib/python3.12/dist-packages/torch/_tensor.py", line 1760, in __dlpack__
     raise BufferError(
 BufferError: Can't export tensors that require gradient, use tensor.detach()

Weights explicitly set requires_grad=False so they export fine, but linear biases do not (ReplicatedLinear, ColumnParallelLinear, RowParallelLinear). Here, I explicitly set requires_grad=False on the bias tensors to make them compatible with DLPack. This should have no unintended side effects as nothing in vLLM reads a bias's requires_grad.

Test Plan

pytest -s -v evals/gpt_oss/test_gpqa_correctness.py::test_gpqa_correctness[gpt-oss-20b-rocm-quark-mxfp4-fp8-triton] --config-list-file=configs/models-gfx950.txt

Test Result

pytest -s -v evals/gpt_oss/test_gpqa_correctness.py::test_gpqa_correctness[gpt-oss-20b-rocm-quark-mxfp4-fp8-triton] --config-list-file=configs/models-gfx950.txt

============= 1 passed, 14 warnings in 233.59s (0:03:53) ===============

Signed-off-by: Micah Williamson <micah.williamson@amd.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.

@mergify mergify Bot added rocm Related to AMD ROCm bug Something isn't working labels Sep 9, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Sep 9, 2026
@micah-wil micah-wil added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

@micah-wil, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@micah-wil

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88000 for commit 60e422a9d371.

Signed-off-by: Micah Williamson <micah.williamson@amd.com>
@mergify mergify Bot added the ci/build label Sep 10, 2026
@micah-wil

Copy link
Copy Markdown
Collaborator Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88140 for commit 0a23accab080.

@AndreasKaratzas
AndreasKaratzas merged commit 7de70fa into vllm-project:main Sep 10, 2026
118 of 119 checks passed
@AndreasKaratzas
AndreasKaratzas deleted the micah/fix-linear-layer branch September 10, 2026 18:54
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Sep 10, 2026
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 ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants