Skip to content

[ROCm] Remove stale SDPA and skinny GEMM workarounds - #50907

Merged
mgoin merged 21 commits into
mainfrom
akaratza_resolve_sdp_issue
Aug 11, 2026
Merged

mgoin merged 21 commits into
mainfrom
akaratza_resolve_sdp_issue

Conversation

@AndreasKaratzas

@AndreasKaratzas AndreasKaratzas commented Aug 3, 2026

Copy link
Copy Markdown
Member
  • Remove ROCm-wide Math SDPA forcing from Transformers multimodal execution and affected test conftests.
  • Remove blanket skinny GEMM disable overrides while retaining independent backend and determinism settings.
  • Make non-contiguous skinny GEMM activations contiguous and fall back safely for unsupported weight or bias layouts.
  • Use default speech attention on MI250 while retaining supported AITER routing on CDNA3+ hardware.
  • Keep embedding reference comparisons aligned with the server's per-request execution geometry.

This addresses #37736, where stale ROCm Math SDPA forcing made the 32-image Gemma3 profiling forward OOM on MI250. With default SDPA selection, the same profile completes while preserving model behavior. Removing blanket skinny GEMM disables exposed a non-contiguous activation bug in the ROCm GEMM dispatcher, which is fixed by normalizing supported inputs and falling back for unsupported operand layouts. Broad multimodal and targeted ROCm validation passed, with unrelated model-access and optional-dependency failures classified separately.

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
@mergify

mergify Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--50907.org.readthedocs.build/en/50907/

@mergify mergify Bot added documentation Improvements or additions to documentation multi-modality Related to multi-modality (#4194) rocm Related to AMD ROCm labels Aug 3, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Aug 3, 2026
@AndreasKaratzas

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #82434 for commit 698fbdb7cb20.

@AndreasKaratzas

Copy link
Copy Markdown
Member Author

AndreasKaratzas and others added 4 commits August 5, 2026 17:54
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
…issue

# Conflicts:
#	vllm/v1/core/kv_cache_utils.py

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @AndreasKaratzas.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Comment on lines 6330 to +6559
@@ -6522,16 +6537,26 @@ def _init_minimal_kv_cache_for_profiling(self) -> None:
@staticmethod
@contextmanager
def _freeze_gc():
gc_was_enabled = gc.isenabled()
gc.collect()
should_freeze = not envs.VLLM_ENABLE_CUDAGRAPH_GC
if should_freeze:
gc.freeze()
# A Triton kernel finalized during stream capture unloads its
# module and invalidates the captured graph.
gc.disable()
try:
yield
finally:
if should_freeze:
gc.unfreeze()
gc.collect()
try:
gc.unfreeze()
gc.collect()
finally:
if gc_was_enabled:
gc.enable()
else:
gc.disable()

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 patch addresses a latent, timing-sensitive initialization bug. The key difference is how Triton specializes the rejection-sampling kernel:

Phase is_greedy value Triton specialization
Previous dummy warmup Tensor/pointer Mixed sampling
Real suffix inference None All-greedy sampling

Previously, initialization only compiled the mixed-sampling specialization. The first real all-greedy request therefore triggered JIT compilation during inference. Shortly afterward, ROCm reported a null-address GPU memory fault. The Python stack at .cpu().numpy() was only where the asynchronous GPU error became visible.

To resolve this, we:

  • Warm both mixed and all-greedy kernel specializations during initialization.
  • Synchronize afterward, so any GPU failure surfaces immediately during startup.
  • Disable cyclic GC during graph capture, then restore its previous state.

…issue

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>

# Conflicts:
#	vllm/v1/core/kv_cache_utils.py
@mergify mergify Bot removed the needs-rebase label Aug 7, 2026
@AndreasKaratzas AndreasKaratzas added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 7, 2026
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
@github-actions

Copy link
Copy Markdown

✅ Queued 5 failed job(s) for retry in Buildkite CI #83067.

@mergify

mergify Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @AndreasKaratzas.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Aug 10, 2026
Preserve default ROCm SDPA selection while retaining the incoming Transformers multimodal hardening.

Assisted-by: OpenAI Codex
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@AndreasKaratzas

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #83188 for commit 64d1a9100f14.

@AndreasKaratzas

Copy link
Copy Markdown
Member Author

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Queued 4 failed job(s) for retry in Buildkite CI #83188.

Assisted-by: OpenAI Codex
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Leave explicit checkpoint layout handling to #50727.

Assisted-by: OpenAI Codex
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
@AndreasKaratzas

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #83310 for commit d67e25ea7f66.

@mergify mergify Bot removed the needs-rebase label Aug 11, 2026
@AndreasKaratzas

Copy link
Copy Markdown
Member Author

Full build again successful here (none of the modified test groups are failing):

@hmellor

hmellor commented Aug 11, 2026

Copy link
Copy Markdown
Member

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Queued 2 failed job(s) for retry in Buildkite CI #83310.

@github-project-automation github-project-automation Bot moved this from To Triage to Ready in gpt-oss Issues & Enhancements Aug 11, 2026
@mgoin
mgoin merged commit 1ab2801 into main Aug 11, 2026
256 checks passed
@mgoin
mgoin deleted the akaratza_resolve_sdp_issue branch August 11, 2026 18:19
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Aug 11, 2026
JohnQinAMD added a commit to JohnQinAMD/vllm-amd that referenced this pull request Aug 18, 2026
wvSplitKQ stages the activation by walking stride(0) for N rows while its
compute loop stops at the valid width K, so a strided activation is read
(stride(0) - K) elements past its extent per row. The over-read never
reaches the math, so results stay correct and it only surfaces when it
crosses an unmapped page -- an allocator-dependent fault far from its cause.

PR vllm-project#50907 fixed this for the call sites in layers/utils.py. scaled_mm/rocm.py
was not covered, and there is a reachable path to it that runs entirely on
is_contiguous() reporting True for a single-row view: QuantFP8.forward_hip
gates the aiter path on that flag, rocm_aiter_ops.per_tensor_quant allocates
with torch.empty_like which preserves the row stride, and
ScaledMMLinearKernel's view(-1, shape[-1]) is a no-op on an already-2D
tensor. At 2 and 4 rows the flag is False and the output comes back dense,
so the exposure is single-row decode -- which is what this dispatch is for.

Densify there with an explicit stride test rather than .contiguous(), which
is a no-op on a single-row view for the same reason. State the contract in
the kernel wrapper as well, so a future call site fails at the boundary
instead of over-reading.

Reproduced on MI355X: an 8 MB over-read faults under
PYTORCH_NO_CUDA_MEMORY_CACHING=1; over-reads of 8 KB, 24 KB and 504 KB
survive and return correct results, which is why no allclose test caught it.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Yanyuan Qin <yanyuan.qin@amd.com>
zyp2014 pushed a commit to zyp2014/vllm that referenced this pull request Aug 21, 2026
)

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation gpt-oss Related to GPT-OSS models kv-connector multi-modality Related to multi-modality (#4194) 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.

4 participants