[Mini-VLLM] Remove the ROCm device path, debug routes and arch-gated tests
- Delete csrc/rocm, hipify, the _rocm_C extension and the setup.py rocm target path; drop the rocm requirement files - Delete the aiter, rdna3, skinny-gemm and ROCm fused-MoE kernel modules and retarget the linear kernel registries away from them - Reduce platforms/rocm.py to the GCN architecture predicates that live code still imports, and delete the RocmPlatform class and plugin - Drop the VLLM_SERVER_DEV_MODE debug surface: reset, collective_rpc, server_info and sleep routes plus the log_error_stack flag - Delete lm-format-enforcer, lark and otel-semantic-conventions-ai pins; the live server process maps none of them - Delete tests that only build architectures this fork no longer registers, and test directories left without any test file - Restore the tests/v1/kv_connector mock helpers that scheduler tests import at module level Co-authored-by: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -250,46 +250,6 @@ def use_aiter_triton_gemm(n, m, k, dtype):
|
||||
)
|
||||
|
||||
|
||||
def wvsplitkrc_dispatch(n: int, k: int, m: int, cu_count: int) -> tuple[int, bool]:
|
||||
"""Pick the K-shard split for wvSplitKrc and say whether the shape fits.
|
||||
|
||||
Mirrors wvSplitKrc() in csrc/rocm/skinny_gemms.cu, which is also where the
|
||||
shard cap is explained. Both must pick the same chunkk or the workspace
|
||||
check here bounds the wrong k_rnd.
|
||||
|
||||
Returns:
|
||||
The CHUNKK the kernel will dispatch with, and whether the CU budget and
|
||||
split-K workspace admit the shape at all.
|
||||
|
||||
"""
|
||||
# Next ^2 of n
|
||||
N_p2 = 1 << (n - 1).bit_length()
|
||||
# How many of 4 waves in a group can work on same 16 Ms at same time?
|
||||
# This reduces the Ms each group works on, i.e. increasing the CUs needed.
|
||||
GrpsShrB = min(N_p2 // 16, 4)
|
||||
# With 64 Ms per CU (each of 4 SIMDs working on a 16x16 tile), and each
|
||||
# working on a 512-shard of K, how many CUs would we need?
|
||||
CuNeeded = ((m + 64 - 1) // 64) * ((k + 512 - 1) // 512) * GrpsShrB
|
||||
|
||||
CHUNKK2_MAX_SHARDS = 11
|
||||
shards_chunkk2 = (k + 256 - 1) // 256 # 256-wide shards
|
||||
chunkk = (
|
||||
2
|
||||
if (
|
||||
N_p2 != 16
|
||||
and CuNeeded * 2 <= cu_count
|
||||
and shards_chunkk2 <= CHUNKK2_MAX_SHARDS
|
||||
)
|
||||
else 1
|
||||
)
|
||||
|
||||
# Deterministic reduction stores one fp32 partial per (M, N, k-shard); all
|
||||
# of them must fit the split-K workspace.
|
||||
k_rnd = (k + 512 // chunkk - 1) // (512 // chunkk)
|
||||
fits = N_p2 * m * k_rnd <= 128 * 1024 * 12 and CuNeeded <= cu_count
|
||||
return chunkk, fits
|
||||
|
||||
|
||||
# On gfx11 a weight row stride that is a multiple of 2048 B makes the multi-row global
|
||||
# loads of a GEMM collide on the L2/MALL channel hash. Offsetting the stride by one
|
||||
# 128 B cache line dodges the collision and keeps each row cache-line aligned.
|
||||
@@ -338,88 +298,13 @@ def rocm_unquantized_gemm_impl(
|
||||
|
||||
return linear_batch_invariant(x, weight, bias)
|
||||
|
||||
from vllm.platforms.rocm import on_gfx1x, on_gfx9, on_gfx11, on_gfx950
|
||||
|
||||
n = x.numel() // x.size(-1)
|
||||
m = weight.shape[0]
|
||||
k = weight.shape[1]
|
||||
|
||||
cu_count = num_compute_units()
|
||||
|
||||
_, fits_wvsplitkrc = wvsplitkrc_dispatch(n, k, m, cu_count)
|
||||
|
||||
skinny_operands_compatible = weight.is_contiguous() and (
|
||||
bias is None or bias.is_contiguous()
|
||||
)
|
||||
|
||||
use_skinny_reduce_counting = (
|
||||
envs.VLLM_ROCM_USE_SKINNY_GEMM
|
||||
and on_gfx950()
|
||||
and x.dtype in [torch.float16, torch.bfloat16]
|
||||
and x.dim() == 2
|
||||
and (
|
||||
10 <= n <= 128
|
||||
and k % 8 == 0
|
||||
and k > 512
|
||||
and m % 16 == 0
|
||||
and fits_wvsplitkrc
|
||||
and skinny_operands_compatible
|
||||
)
|
||||
)
|
||||
|
||||
if use_skinny_reduce_counting:
|
||||
x_view = x.reshape(-1, x.size(-1)).contiguous()
|
||||
return ops.wvSplitKrc(x_view, weight, cu_count, bias)
|
||||
|
||||
if use_aiter_triton_gemm(n, m, k, x.dtype):
|
||||
from aiter.ops.triton.gemm_a16w16 import gemm_a16w16
|
||||
|
||||
return gemm_a16w16(x, weight, bias)
|
||||
|
||||
skinny_gemm_enabled = (
|
||||
envs.VLLM_ROCM_USE_SKINNY_GEMM
|
||||
and (on_gfx9() or on_gfx1x())
|
||||
# build (gfx9/gfx11 ISA); fall back to torch GEMM there.
|
||||
# TODO GFX1250: Include once skinny GEMM is supported on gfx1250
|
||||
and x.dtype in [torch.float16, torch.bfloat16]
|
||||
and k % 8 == 0
|
||||
)
|
||||
|
||||
# wvSplitK allows row strides. Perf impact is only validated on gfx11.
|
||||
weight_ok_for_wvsplitk = weight.is_contiguous() or (
|
||||
on_gfx11() and weight.stride(1) == 1
|
||||
)
|
||||
|
||||
use_wvsplitk = (
|
||||
skinny_gemm_enabled
|
||||
and weight_ok_for_wvsplitk
|
||||
and (bias is None or bias.is_contiguous())
|
||||
and (m == 1 or m > 8)
|
||||
and 0 < n <= 5
|
||||
)
|
||||
|
||||
use_llmm1 = (
|
||||
skinny_gemm_enabled
|
||||
and weight.is_contiguous()
|
||||
and bias is None
|
||||
and m % 4 == 0
|
||||
and n == 1
|
||||
and k <= 8192
|
||||
)
|
||||
|
||||
if use_wvsplitk:
|
||||
# The skinny kernels assume contiguous K elements. A shape-preserving
|
||||
# reshape can retain a transposed activation's non-contiguous strides.
|
||||
# Note: Only build that view inside the branches that consume it.
|
||||
x_view = x.reshape(-1, x.size(-1)).contiguous()
|
||||
out = ops.wvSplitK(weight, x_view, cu_count, bias)
|
||||
return out.reshape(*x.shape[:-1], weight.shape[0])
|
||||
|
||||
if use_llmm1:
|
||||
x_view = x.reshape(-1, x.size(-1)).contiguous()
|
||||
out = ops.LLMM1(weight, x_view, 4)
|
||||
return out.reshape(*x.shape[:-1], weight.shape[0])
|
||||
|
||||
if rocm_aiter_ops.is_tgemm_enabled():
|
||||
from aiter.tuned_gemm import tgemm
|
||||
|
||||
@@ -462,11 +347,11 @@ def warmup_rocm_skinny_gemm_workspaces(device: torch.device) -> None:
|
||||
"""Eagerly allocate wvSplitKrc's per-device split-K workspace pool.
|
||||
|
||||
wvSplitKrc partitions one per-device allocation into ``kWvSlots`` slots
|
||||
(csrc/rocm/skinny_gemms.cu) and hands each stream one on first use, so that
|
||||
and hands each stream one on first use, so that
|
||||
two streams never share the split-K partials and counters.
|
||||
|
||||
The pool is otherwise created lazily on the first qualifying GEMM
|
||||
(csrc/rocm/skinny_gemms.cu), which can be the first real request — after
|
||||
The pool is otherwise created lazily on the first qualifying GEMM,
|
||||
which can be the first real request — after
|
||||
the KV cache backing buffer exists. If it landed in that segment's rounding
|
||||
tail, it would pin the entire segment at engine shutdown; it could also land
|
||||
inside a cudagraph capture, where it would be taken from the graph's private
|
||||
|
||||
Reference in New Issue
Block a user