Skip to content
6 changes: 4 additions & 2 deletions .buildkite/test_areas/models_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ steps:
- tests/models/test_terratorch.py
- tests/models/transformers/test_backend.py
- tests/models/test_registry.py
- tests/models/test_deepseek_v4_vl_rocm.py
commands:
- pytest -v -s models/test_terratorch.py models/transformers/test_backend.py models/test_registry.py
- pytest -v -s models/test_terratorch.py models/transformers/test_backend.py models/test_registry.py models/test_deepseek_v4_vl_rocm.py
mirror:
amd:
label: ":amd: (MI300) Basic Models (Other)"
Expand All @@ -59,9 +60,10 @@ steps:
depends_on:
- image-build-amd
source_file_dependencies:
- tests/models/test_deepseek_v4_vl_rocm.py
- tests/models/test_hyv4_rocm.py
commands:
- pytest -v -s models/test_terratorch.py models/transformers/test_backend.py models/test_registry.py
- pytest -v -s models/test_terratorch.py models/transformers/test_backend.py models/test_registry.py models/test_deepseek_v4_vl_rocm.py
- VLLM_ROCM_USE_AITER=1 pytest -v -s models/test_hyv4_rocm.py -m 'not distributed'

- label: ":nvidia: (B200) Inkling"
Expand Down
95 changes: 95 additions & 0 deletions tests/kernels/attention/test_rocm_triton_attn_dsv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,101 @@ def test_compute_global_topk_ragged_indices_and_indptr() -> None:
torch.testing.assert_close(actual_lens, expected_lens)


@torch.inference_mode()
def test_combine_topk_swa_indices_adds_image_visibility() -> None:
from vllm.models.deepseek_v4.amd.rocm import combine_topk_swa_indices

device = torch.device("cuda")
num_tokens = 8
topk_indices = torch.full((num_tokens, 1), -1, dtype=torch.int32, device=device)
query_start_loc = torch.tensor([0, num_tokens], dtype=torch.int32, device=device)
seq_lens = torch.tensor([num_tokens], dtype=torch.int32, device=device)
gather_lens = seq_lens.clone()
left_visible = torch.tensor(
[0, 0, 0, 1, 2, 3, 4, 0], dtype=torch.int32, device=device
)
right_visible = torch.tensor(
[0, 0, 4, 3, 2, 1, 0, 0], dtype=torch.int32, device=device
)

indices, lens = combine_topk_swa_indices(
topk_indices,
query_start_loc,
seq_lens,
gather_lens,
window_size=4,
compress_ratio=1,
topk=0,
M=16,
N=0,
max_image_tokens=5,
left_visible=left_visible,
right_visible=right_visible,
)

expected_rows = [
[0],
[0, 1],
[0, 1, 2, 3, 4, 5, 6],
[0, 1, 2, 3, 4, 5, 6],
[1, 2, 3, 4, 5, 6],
[2, 3, 4, 5, 6],
[2, 3, 4, 5, 6],
[4, 5, 6, 7],
]
for token_idx, expected in enumerate(expected_rows):
actual = indices[token_idx, : lens[token_idx]].cpu().tolist()
assert actual == expected


@torch.inference_mode()
def test_combine_topk_swa_indices_apc_hit_inside_image() -> None:
from vllm.models.deepseek_v4.amd.rocm import combine_topk_swa_indices

device = torch.device("cuda")
indices, lens = combine_topk_swa_indices(
torch.full((2, 1), -1, dtype=torch.int32, device=device),
torch.tensor([0, 2], dtype=torch.int32, device=device),
torch.tensor([10], dtype=torch.int32, device=device),
# Only positions [5, 10) exist in the gathered SWA workspace.
torch.tensor([5], dtype=torch.int32, device=device),
window_size=4,
compress_ratio=1,
topk=0,
M=10,
N=0,
max_image_tokens=10,
left_visible=torch.tensor([8, 9], dtype=torch.int32, device=device),
# Deliberately extends beyond seq_len to exercise the upper clamp too.
right_visible=torch.tensor([5, 5], dtype=torch.int32, device=device),
)

assert lens.cpu().tolist() == [5, 5]
assert indices[:, :5].cpu().tolist() == [list(range(5)), list(range(5))]


@torch.inference_mode()
def test_combine_topk_swa_indices_keeps_vision_row_width_without_images() -> None:
from vllm.models.deepseek_v4.amd.rocm import combine_topk_swa_indices

device = torch.device("cuda")
indices, lens = combine_topk_swa_indices(
torch.full((1, 1), -1, dtype=torch.int32, device=device),
torch.tensor([0, 1], dtype=torch.int32, device=device),
torch.tensor([1], dtype=torch.int32, device=device),
torch.tensor([1], dtype=torch.int32, device=device),
window_size=120,
compress_ratio=1,
topk=0,
M=256,
N=0,
max_image_tokens=16,
)

assert indices.shape == (1, 256)
assert lens.item() == 1


def test_extra_cache_nan_free_provenance_gate(monkeypatch) -> None:
from vllm.models.deepseek_v4.amd import rocm as mod

Expand Down
7 changes: 4 additions & 3 deletions tests/models/multimodal/processing/test_tensor_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ def test_model_tensor_schema(model_id: str):
"Kimi-K2.5's offline inference has issues about vision chunks. Fix later."
)

if model_id == "deepseek-ai/DeepSeek-V4-Flash-Vision-Exp" and not (
current_platform.is_cuda()
if (
model_id == "deepseek-ai/DeepSeek-V4-Flash-Vision-Exp"
and not current_platform.is_cuda_alike()
):
pytest.skip("Deepseek V4 is only supported on CUDA")
pytest.skip("Deepseek V4 vision is only supported on CUDA and ROCm")

if model_id == "zai-org/GLM-5.3-Flash" and (current_platform.is_xpu()):
pytest.skip("GLM-5.3-Flash is not supported on XPU")
Expand Down
Loading
Loading