[ROCm] Remove stale SDPA and skinny GEMM workarounds (#50907)
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>
This commit is contained in:
co-authored by
OpenAI Codex
parent
4f2f31b82e
commit
1ab2801dde
@@ -50,6 +50,20 @@ def reformat(text: str) -> str:
|
||||
return text
|
||||
|
||||
|
||||
def _enable_deterministic_lora_shrink(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
if not current_platform.is_rocm():
|
||||
return
|
||||
|
||||
# These tests assert exact greedy outputs. Force the Triton LoRA shrink
|
||||
# kernel to use SPLIT_K=1 so it stores the complete reduction directly
|
||||
# instead of accumulating split-K partial results with atomic_add.
|
||||
monkeypatch.setenv("VLLM_BATCH_INVARIANT", "1")
|
||||
# The kernel configuration reads VLLM_BATCH_INVARIANT at import time.
|
||||
# Spawn the engine process so it observes this setting even if the LoRA
|
||||
# Triton utilities were already imported during test collection.
|
||||
monkeypatch.setenv("VLLM_WORKER_MULTIPROC_METHOD", "spawn")
|
||||
|
||||
|
||||
def generate_and_test(llm: vllm.LLM, lora_path: str, lora_id: int) -> None:
|
||||
prompts = [
|
||||
PROMPT_TEMPLATE.format(
|
||||
@@ -106,7 +120,10 @@ def test_gpt_oss_lora(
|
||||
gptoss20b_lora_files,
|
||||
mxfp4_use_marlin,
|
||||
specialize_active_lora,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
):
|
||||
_enable_deterministic_lora_shrink(monkeypatch)
|
||||
|
||||
llm = vllm.LLM(
|
||||
MODEL_PATH,
|
||||
max_model_len=1024,
|
||||
@@ -146,7 +163,10 @@ def test_gpt_oss_lora_tp2(
|
||||
gptoss20b_lora_files,
|
||||
fully_sharded_loras,
|
||||
mxfp4_use_marlin,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
):
|
||||
_enable_deterministic_lora_shrink(monkeypatch)
|
||||
|
||||
llm = vllm.LLM(
|
||||
MODEL_PATH,
|
||||
max_model_len=1024,
|
||||
|
||||
@@ -40,6 +40,18 @@ def sample_data(num_experts, max_loras, num_tokens, topk_num):
|
||||
@pytest.mark.parametrize("block_size", [16])
|
||||
def test_moe_lora_align_block_size(
|
||||
num_tokens, topk_num, num_experts, max_loras, block_size
|
||||
):
|
||||
_run_moe_lora_align_block_size_case(
|
||||
num_tokens, topk_num, num_experts, max_loras, block_size
|
||||
)
|
||||
|
||||
|
||||
def test_moe_lora_align_block_size_large_path_counts():
|
||||
_run_moe_lora_align_block_size_case(100, 12, 64, 4, 16)
|
||||
|
||||
|
||||
def _run_moe_lora_align_block_size_case(
|
||||
num_tokens, topk_num, num_experts, max_loras, block_size
|
||||
):
|
||||
# sample data
|
||||
random.seed(1)
|
||||
@@ -94,8 +106,17 @@ def test_moe_lora_align_block_size(
|
||||
# verify values
|
||||
expert_ids = expert_ids.view(max_loras, -1)
|
||||
sorted_token_ids = sorted_token_ids.view(max_loras, -1, block_size)
|
||||
topk_ids_cpu = topk_ids.cpu()
|
||||
token_lora_mapping_cpu = token_lora_mapping.cpu()
|
||||
|
||||
for lora_idx in range(max_loras):
|
||||
expert_counts = torch.bincount(
|
||||
topk_ids_cpu[token_lora_mapping_cpu == lora_idx].flatten(),
|
||||
minlength=num_experts,
|
||||
)
|
||||
expected_post_pad = round_up(expert_counts, block_size).sum().item()
|
||||
assert num_tokens_post_pad[lora_idx].item() == expected_post_pad
|
||||
|
||||
for token_idx in range(sorted_token_ids.size(1)):
|
||||
block = sorted_token_ids[lora_idx][token_idx]
|
||||
indices = block[block != topk_ids.numel()]
|
||||
|
||||
Reference in New Issue
Block a user