text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import io # imports for structured outputs tests import json import httpx import numpy as np import openai import pytest import pytest_asyncio import soundfile as sf from tests.entrypoints.speech...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import openai import pytest from tests.utils import RemoteOpenAIServer MODEL = "ibm-granite/granite-4.0-h-tiny" @pytest.fixture(scope="module") def server(): model = MODEL args_for_model =...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import openai import pytest import pytest_asyncio from huggingface_hub import snapshot_download from typing_extensions import TypedDict from tests.utils import RemoteOpenAIServer from ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import json import jsonschema import openai import pytest import pytest_asyncio from rapidfuzz import fuzz from tests.utils import RemoteOpenAIServer MODEL_NAME = "openai/gpt-oss-20b" @pytest.fixture(scope="...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import multiprocessing import socket import threading import time from unittest.mock import patch import pytest import zmq from vllm.utils.network_utils import make_zmq_socket, split_zmq_path from vllm.v1.utils...
fim
vllm-project/vllm
python
<|fim_suffix|>pe": "image_embeds", "image_embeds": None, "uuid": uuid2, }, {"type": "text", "text": "Compare these images."}, ], } ], phi3v_model_config_image_embeds, content_forma...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import MagicMock, patch import pytest from openai_harmony import Author, Message, Role, StreamState, TextContent from vllm.entrypoints.openai.responses.context import ( Harm...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import AsyncMock, MagicMock, patch import pytest grpc = pytest.importorskip("grpc") health_pb2 = pytest.importorskip("grpc_health.v1.health_pb2") VllmHealthServicer = pytest.impo...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Unit tests for the `vllm launch` CLI subcommand.""" import argparse from unittest.mock import patch import pytest from vllm.entrypoints.cli.launch import ( LaunchSubcommand, RenderSubco...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyri<|fim_suffix|>ght contributors to the vLLM project <|fim_middle|>ghtText: Copyri<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>n results: assert called, "receive_weights should have been called" assert names == test_names assert dtypes == test_dtypes assert shapes == test_shapes llm.finish_weight_update() @create_new_process_for_each_test() def test_update_weights_passes_...
fim
vllm-project/vllm
python
<|fim_suffix|>0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project <|fim_prefix|># SP<|fim_middle|>DX-License-Identifier: Apache-2.<|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>as f: for line in f: line = line.strip() if line and not line.startswith("#"): config_path = config_dir / line print(f"Checking config file: {config_path}") if config_path.exists...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ GPQA evaluation using vLLM server and GPT-OSS evaluation package. Usage: pytest -s -v tests/evals/gpt_oss/test_gpqa_correctness.py \ --config-list-file=configs/models-h200.txt """ import os...
fim
vllm-project/vllm
python
<|fim_suffix|>pyrightText: Copyright contributors to the vLLM project <|fim_prefix|># <|fim_middle|>SPDX-License-Identifier: Apache-2.0 # SPDX-FileCo<|endoftext|>
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path def pytest_addoption(parser): """Add custom command line options.""" parser.addoption( "--config-list-file", default="configs/models-small.txt", help="Fi...
fim
vllm-project/vllm
python
<|fim_suffix|>okens, labels, num_shots, max_tokens, latency) def main() -> None: parser = argparse.ArgumentParser(description="GSM8K evaluation for vLLM serve") parser.add_argument( "--num-shots", type=int, default=5, help="Number of few-shot examples" ) parser.add_argument( "--num-que...
fim
vllm-project/vllm
python
<|fim_suffix|> {' '.join(server_args)}") print(f"Environment variables: {env_dict}") # Launch server and run evaluation with RemoteOpenAIServer( eval_config["model_name"], server_args, env_dict=env_dict, max_wait_seconds=eval_config.get("startup_max_wait_seconds", 600), ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project <|endoftext|>
fim
vllm-project/vllm
python
<|fim_suffix|>g_list_file = metafunc.config.getoption("--config-list-file") config_list_path = Path(config_list_file) if not config_list_path.is_absolute(): test_dir_path = Path(__file__).parent / config_list_file if test_dir_path.exists(): config_list_path = tes...
fim
vllm-project/vllm
python
<|fim_suffix|>ples: {result['num_samples']}") print(f" latency: {result['latency']:.1f}s") print(f" output tok/s: {result['tokens_per_second']:.1f}") if args.save_results: with open(args.save_results, "w") as f: json.dump(result, f, indent=2) if __name__ == "__mai...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-<|fim_suffix|> <|fim_middle|>2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ MRCR long-context accuracy test. Usage: pytest -s -v tests/evals/mrcr/test_mrcr_correctness.py \ --config-list-file=configs/models-small.txt """ import ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-<|fim_suffix|>the vLLM project <|fim_middle|>License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to <|endoftext|>
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Contract tests for the QuantizedActivation linear-kernel integration.""" import pytest import torch from vllm.model_executor.kernels.linear import ( _POSSIBLE_FP8_BLOCK_KERNELS, _POSSIBL...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Shared test utilities for vLLM IR op correctness tests. """ import torch from vllm.ir.op import IrOp NUM_TOKENS = [1, 8, 17, 32, 512, 2048] COMMON_HIDDEN_SIZES = [ 2048, # Llama 3.2 1B, Q...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from torch import Tensor from torch.fx.experimental.proxy_tensor import make_fx import vllm.ir.op from vllm.ir.op import IrOp, IrOpInplaceOverload @vllm.ir.register_op(allow_inplace=T...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib.util import logging from pathlib import Path from typing import Any import pytest import torch from torch import fx from torch.fx.experimental.proxy_tensor import make_fx import vllm.ir.op from ...
fim
vllm-project/vllm
python
<|fim_suffix|>torch.float: 1.3e-6} def get_default_atol(output) -> float: return default_atol[output.dtype] def get_default_rtol(output) -> float: return default_rtol[output.dtype] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project impor...
fim
vllm-project/vllm
python
<|fim_suffix|>st.fixture() def kv_cache_factory_flashinfer(): return create_kv_caches_with_random_flash <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.utils.torch_utils import ( create_kv_caches_with_random, ...
fim
vllm-project/vllm
python
<|fim_suffix|>).cumsum( dim=0, dtype=torch.int32 ) cu_seq_lens = torch.tensor([0] + kv_lens, dtype=torch.int32).cumsum( dim=0, dtype=torch.int32 ) # Save kv_lens as list before converting to tensor kv_lens_list = kv_lens kv_lens = torch.tensor(kv_lens, dtype=torch.int32) ma...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import torch from tests.kernels.allclose_default import get_default_atol, get_default_rtol from tests.kernels.utils import opcheck from vllm import _custom_ops as ops f...
fim
vllm-project/vllm
python
<|fim_suffix|> get_attn_backend(16, torch.float32, None) def test_flash_attn(monkeypatch: pytest.MonkeyPatch): """Test FlashAttn validation.""" pytest.skip( "Skipping as current backend selector does not " "handle fallbacks when a backend is explicitly set." ) attention_config = A...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import torch from tests.kernels.utils import DEFAULT_OPCHECK_TEST_UTILS, opcheck from vllm import _custom_ops as ops from vllm.model_executor.layers.quantization.utils....
fim
vllm-project/vllm
python
<|fim_suffix|>ens, dtype=torch.float32) suffix_lse = torch.randn(num_query_heads, num_tokens, dtype=torch.float32) # Run the kernel. output = torch.empty(num_tokens, num_query_heads, head_size, dtype=dtype) merge_attn_states(output, prefix_output, prefix_lse, suffix_output, suffix_lse) # Reference...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools import math import pytest import torch from vllm.platforms import CpuArchEnum, current_platform from vllm.utils.torch_utils import set_random_seed from vllm.v1.attention.backends....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import random import pytest import torch import vllm._custom_ops as ops from vllm.platforms import current_platform from vllm.triton_utils import triton from vllm.utils.platform_utils i...
fim
vllm-project/vllm
python
<|fim_suffix|>ke[i + chunk_size] = (cp_size * 2 - 1 - cp_id) * chunk_size + i return ks, ke def _ref_fp8_mqa_logits( q: torch.Tensor, kv: torch.Tensor, weights: torch.Tensor, cu_seqlen_ks: torch.Tensor, cu_seqlen_ke: torch.Tensor, ): seq_len_kv = kv.shape[0] k = kv q = q.float() ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from vllm.platforms import current_platform from vllm.utils.torch_utils import set_random_seed try: from vllm.vllm_flash_attn import ( fa_version_unsupporte...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest from vllm.platforms import current_platform from vllm.utils.torch_utils import set_random_seed try: import flashinfer except ImportError: if current_platform.is_rocm(): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import torch.nn.functional as F from torch import Tensor from vllm.platforms import current_platform FLASHINFER_WORKSPACE_BUFFER_SIZE = 128 * 1024 * 1024 if not current_...
fim
vllm-project/vllm
python
<|fim_suffix|>cale, o_sf_scale, dtype, query.device ) output_trtllm = output_trtllm.reshape(-1, query.shape[1], query.shape[2]) if is_nvfp4_kv: rtol, atol = 1.0, 1.0 # nvfp4 has higher quantization error elif q_quant_dtype == FP8_DTYPE and o_quant_dtype == FP4_DTYPE: rtol, atol...
fim
vllm-project/vllm
python
<|fim_prefix|># Adapted from: https://github.com/deepseek-ai/FlashMLA/blob/main/tests/test_flash_mla.py # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import random import pytest import torch from vllm.triton_utils import triton from vllm.v1.atte...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch def test_sparse_flashmla_metadata_smoke(): import vllm.v1.attent<|fim_suffix|>if not ok: pytest.skip(reason) device = torch.device("cuda") batch_size...
fim
vllm-project/vllm
python
<|fim_suffix|>_size", BATCH_SIZES) @pytest.mark.parametrize("num_heads", NUM_HEADS) @pytest.mark.parametrize("head_size", HEAD_SIZES) @pytest.mark.parametrize("seq_len", SEQ_LENGTHS) @pytest.mark.parametrize("dtype", DTYPES) @torch.inference_mode() def test_lightning_attention_reference( batch_size: int, num_he...
fim
vllm-project/vllm
python
<|fim_suffix|>e: {avg_time_cuda_kernel:.6f}ms, " f"Performance: {performance_improved:.5f}x" ) print("-" * 100) # 4. Correctness compare # Liger Kernel: Efficient Triton Kernels for LLM Training # https://arxiv.org/pdf/2410.10989, 3.3 Correctness # use rtol = 1e-2 for bfloat16. if u...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Test: * Tests for MMEncoderAttention layer """ import itertools from unittest.mock import patch import numpy as np import pytest import torch from vllm.config import get_current_vllm_config f...
fim
vllm-project/vllm
python
<|fim_suffix|> cu_seqlens_q=cu_seqlens_q, max_seqlen_q=max_seqlen_q, seqused_k=seqused_k, max_seqlen_k=max_seqlen_k, softmax_scale=scale, causal=causal_tensor, window_size=(-1, -1), block_table=block_tables, softcap=0.0, q_descale=None, k...
fim
vllm-project/vllm
python
<|fim_suffix|>ch.manual_seed(0) scale = d ** (-0.5) if varlen: seq_lens = torch.empty(bs).normal_(mean_seq_len, mean_seq_len / 2) seq_lens = seq_lens.clip(2).to(torch.int32) else: seq_lens = torch.full((bs,), mean_seq_len, dtype=torch.int32) max_seq_len = seq_lens.max().item() ...
fim
vllm-project/vllm
python
<|fim_suffix|>l=1e-1, atol=1e-2) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from torch.testing import assert_close from vllm.v1.attention.ops.common import pack_seq_triton, unpack_seq_triton def test_pack_seq_basic_fp8(): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import random import time from collections.abc import Callable import pytest import torch import torch.nn.functional as F from vllm.platforms import current_platform from vllm.utils.to...
fim
vllm-project/vllm
python
<|fim_suffix|>.supports_fp8(), reason="FP8 not supported on this hardware", ) @pytest.mark.parametrize("variant", FP8_VARIANTS) @pytest.mark.parametrize("seq_lens", FP8_SEQ_LENS) @pytest.mark.parametrize("head_size", [128]) @pytest.mark.parametrize("block_size", [16, 64]) @torch.inference_mode() def test_aiter_unif...
fim
vllm-project/vllm
python
<|fim_suffix|>ith set_current_vllm_config(vllm_config): backend = get_attn_backend( 576, torch.bfloat16, "auto", 1, False, use_mla=True ) assert backend.get_name() == "ROCM_AITER_MLA" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyri...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from vllm.platforms import current_platform pytestmark = pytest.mark.skipif( not current_platform.is_rocm(), reason="Only used by ROCm" ) def _on_gfx950() -> bool: if not cu...
fim
vllm-project/vllm
python
<|fim_suffix|>e=dtype, device=DEVICE_TYPE) v_bf16 = torch.randn(CACHE_SIZE, H_KV, D_V, dtype=dtype, device=DEVICE_TYPE) # --- BF16 reference --- o_ref = torch.zeros(B, H_Q, D_V, dtype=dtype, device=DEVICE_TYPE) lse_ref = torch.zeros(B, H_Q, dtype=dtype, device=DEVICE_TYPE) attn_logits = torch.empty...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import torch.nn.functional as F from vllm.platforms import current_platform from vllm.v1.attention.ops.triton_prefill_attention import context_attention_fwd DEVICE_TYPE = current_plat...
fim
vllm-project/vllm
python
<|fim_suffix|>shape, v_scale.item(), dtype=torch.float32) cu_query_lens = torch.tensor([0] + query_lens, dtype=torch.int32).cumsum( dim=0, dtype=torch.int32 ) kv_lens_t = torch.tensor(kv_lens, dtype=torch.int32) max_num_blocks_per_seq = (max_kv_len + block_size - 1) // block_size block_tab...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright<|fim_suffix|>v = canonicalize_singleton_dim_strides(value_cache) fa_out = torch.empty(sum(query_lens), num_query_heads, head_size_v, dtype=dtype) flash_attn_varlen_func( q=query, k=fa_k, v=fa_v, ...
fim
vllm-project/vllm
python
<|fim_suffix|> trtllm_prefill_attn_kvfp8_dequant, ) torch.set_default_device("cuda") num_kv_heads, block_size, head_size = 4, 64, 128 kv_cache, scale = make_contiguous_kv_cache( NUM_BLOCKS, num_kv_heads, block_size, head_size, ) k_scale = v_scale = scale.cl...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from unittest.mock import patch import pytest import torch from vllm.platforms import current_platform from vllm.utils.flashinfer import ( can_use_trtllm_attention, supports_trtllm_attenti...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from vllm.v1.attention.ops.xpu_mla_sparse import triton_bf16_mla_sparse_interface # https://github.com/deepseek-ai/FlashMLA/blob/main/tests/ref.py#L7 def _merge_two_lse...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import random import pytest import torch from tests.kernels.allclose_default import get_default_atol, get_default_rtol from tests.kernels.utils import opcheck from vllm.model_executor.layers.activ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for ApplyRotaryEmb CustomOp dispatch behavior. This test ensures that RotaryEmbedding classes correctly call the appropriate ApplyRotaryEmb methods based on the calling context: 1. Rotary...
fim
vllm-project/vllm
python
<|fim_suffix|>(raw_out, x, *op_args)) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from tests.kernels.allclose_default import get_default_atol, get_default_rtol from tests.kernels.utils import opcheck from vllm.plat...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-Fil<|fim_suffix|>ctness + large-token-count launch tests for fused_q_kv_rmsnorm. Before the grid-dim fix the kernel used grid ``(2, num_tokens)``, which hit CUDA's 65535 grid-y cap for ``num_tokens >= 65536`` and failed with ``Triton Error [CUDA]: invalid argu...
fim
vllm-project/vllm
python
<|fim_suffix|> positions.view(-1), ) if dtype == torch.float16: ATOL, RTOL = (2e-3, 2e-3) else: ATOL, RTOL = (1e-2, 1e-2) torch.testing.assert_close( qkv_fused, ref_result, atol=ATOL, rtol=RTOL, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 #...
fim
vllm-project/vllm
python
<|fim_suffix|>p8_quant( torch_out, scale_ub=scale_ub, use_per_token_if_dynamic=True ) else: assert quant_dtype == torch.int8 torch_out, scales, _ = ops.scaled_int8_quant(torch_out) return torch_out, scales, residual def ref_impl( rms_norm_layer: RMS...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests that FusedRMSNormGated decomposes correctly under torch.compile, matching the eager triton kernel output.""" import pytest import torch from vllm.model_executor.layers.fla.ops.kda import ...
fim
vllm-project/vllm
python
<|fim_suffix|> assert out.shape == (batch_size, hidden_size) assert out.dtype == current_platform.fp8_dtype() assert scales.dtype == torch.float32 assert not torch.isnan(out.float()).any() assert not torch.isnan(scales).any() assert not torch.isinf(scales).any() <|fim_prefix|># SPDX-License-Identifi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from tests.kernels.quant_utils import FP8_DTYPE from tests.kernels.utils import opcheck from vllm.model_executor.layers.layernorm import GemmaRMSNorm, RMSNorm from vllm.p...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for MiniMax QK RMS-norm: NCCL reference vs Lamport fused kernel.""" import pytest import torch import torch.nn as nn from torch.multiprocessing import spawn from tests.kernels.utils import opcheck from ...
fim
vllm-project/vllm
python
<|fim_suffix|>rking copies k_work = k.clone() # Your in-place function modifies q_work and k_work mrope_helper_class.forward_cuda(pos, q_work, k_work) return q_work, k_work # Return the modified tensors # Get reference results query_native, key_native = mrope_helper_class.forwa...
fim
vllm-project/vllm
python
<|fim_suffix|>bute, (0, )) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for miscellaneous utilities """ import torch from tests.kernels.utils import opcheck def test_convert_fp8_opcheck(): data = torch.randn((256, 256), dtype=...
fim
vllm-project/vllm
python
<|fim_suffix|> supported on ROCm", allow_module_level=True) @pytest.mark.parametrize("shape", [(1, 512), (544, 4096), (67, 8192)]) @pytest.mark.parametrize("dtype", [torch.bfloat16]) def test_permute_cols(shape, dtype): x = torch.randn(shape, dtype=dtype).cuda() perm = torch.randperm(x.shape[1]).to(torch.int)...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable from itertools import product import pytest import torch from tests.kernels.allclose_default import get_default_atol, get_default_rtol from vllm.model_executor...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for miscellaneous utilities """ import pytest import torch from tests.kernels.utils import opcheck from vllm.model_executor.layers.rotary_embedding import RotaryEmbedding def rotary_emb...
fim
vllm-project/vllm
python
<|fim_suffix|>-1) if kv_cache_dtype == "fp8": ref_kv_cache = torch.empty_like(ref_temp, dtype=kv_cache.dtype) ops.convert_fp8( ref_kv_cache, ref_temp, kv_cache_scale.item(), kv_dtype=kv_cache_dtype ) else: ref_kv_cache = ref_temp opcheck( torch.ops._C_ca...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch from vllm.utils.platform_utils import is_uva_available from vllm.utils.torch_utils import get_accelerator_view_from_cpu_tensor CUDA_DEVICES = [ f"cuda:{i}" for i in r...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Accuracy tests for the fused Triton bilinear position-embedding kernel. Compares ``triton_pos_embed_interpolate`` against the pure-PyTorch ``pos_embed_interpolate_native`` across a variety of gri...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tes<|fim_suffix|>ncoder_attention import ( MMEncoderAttention, ) cu_seqlens_np = np.array([0, seq_len], dtype=np.int32) sequence_lengths = MMEncoderAttention.maybe_compute_se...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM<|fim_suffix|>st_skip_scale() -> None: """Test skip_scale=True produces cast-only output (no division).""" seq_len, num_heads, head_dim = 32, 8, 80 tensor = torch.randn( seq_len, num_heads...
fim
vllm-project/vllm
python
<|fim_suffix|>, match="scales not found for layer"): attn.process_weights_after_loading(torch.bfloat16) def test_dynamic_scales_auto_save(tmp_path) -> None: """Verify scales are saved to disk after the amax buffer fills.""" import vllm.model_executor.layers.attention.mm_encoder_attention as _mod ...
fim
vllm-project/vllm
python
<|fim_suffix|>the same signature as ``register_kernel``. Before applying the real decorator it writes a config JSON for the kernel name (from ``op_name`` or ``fn.__name__``) into a temporary directory backed by a fresh ``ConfigManager``. """ if configs is None: configs = DEFAULT_CONFIGS ...
fim
vllm-project/vllm
python
<|fim_suffix|>rapper.get_inputs() assert "small" in inputs settings = helion.Settings() settings.autotuner_fn = _no_compile_autotuner_fn wrapper.helion_settings = settings config = wrapper.run_autotune(inputs["small"]) expected_default = ( create_helion_deco...
fim
vllm-project/vllm
python
<|fim_suffix|>ault_config" def test_str_is_sorted_json(self): assert str(CaseKey({"z": 1, "a": 2})) == '{"a":2,"z":1}' assert str(CaseKey.default()) == "{}" def test_immutable(self): key = CaseKey({"intermediate": 2048}) with pytest.raises(TypeError, match="immutable"): ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Unit tests for Helion ConfigManager and ConfigSet. Tests the simplified configuration management system for Helion custom kernels. """ import json import tempfile from pathlib import Path impo...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Tests for the dynamic_per_token_scaled_fp8_quant helion kernel Run `pytest tests/kernels/helion/test_dynamic_per_token_scaled_fp8_quant.py`. """ from typing import Any import pytest import torc...
fim
vllm-project/vllm
python
<|fim_suffix|> = add_kernel(x, y) # Verify correctness expected = x + y assert torch.allclose(result, expected), "Helion kernel output mismatch" <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Tests for Helion kernel availability ...
fim
vllm-project/vllm
python
<|fim_suffix|>est_pm_silu_mul", fake_impl=lambda *a, **kw: None, config_picker=lambda args, keys: "default", ) def pattern(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor: return torch.nn.functional.silu(x) * y def replacement(x: to...
fim
vllm-project/vllm
python
<|fim_suffix|> self, shape, column_major: bool, tma_aligned: bool, scale_ue8m0: bool, group_size: int, ): skip_if_platform_unsupported("per_token_group_fp8_quant") torch.manual_seed(42) num_tokens, hidden_size = shape fp8_min, fp8_max = ...
fim
vllm-project/vllm
python
<|fim_suffix|>OP_AVAILABLE, reason="CustomOp path not used when HOP available" ) def test_get_or_register_custom_op_registers_new_op( self, sample_kernel, sample_configs ): def fake_impl(*args, **kwargs): return torch.zeros_like(args[0]) def default_picker(args, config_k...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import torch.nn.functional as F from vllm.utils.import_utils import has_helion if not has_helion(): pytest.skip( "Helion is not installed. Install with: pip ...
fim
vllm-project/vllm
python
<|fim_suffix|>river_reported_name) == expected @pytest.mark.parametrize("invalid_name", ["", " ", "\t", "\n"]) def test_canonicalize_gpu_name_rejects_empty(invalid_name): """Test that empty or whitespace-only names are rejected.""" with pytest.raises(ValueError, match="cannot be empty"): canonicaliz...
fim
vllm-project/vllm
python
<|fim_suffix|>p_name} kernel") except (ImportError, RuntimeError, KeyError): pytest.skip(f"Error detecting platform support for {op_name} kernel") <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Helion Kernel test utils""" import ...
fim
vllm-project/vllm
python
<|fim_suffix|>ir op definitions (e.g. tests/kernels/ir/test_layernorm.py). """ import vllm.kernels # noqa: F401 — registers provider implementations from vllm.ir.op import IrOp def test_all_ops_have_input_generator(): missing = [name for name, op in IrOp.registry.items() if not op.has_input_generator] asser...
fim
vllm-project/vllm
python
<|fim_suffix|>s = ir.ops.fused_add_rms_norm.generate_inputs( num_tokens=n_tokens, hidden_size=hidden_size, dtype=dtype, epsilon=epsilon ) # Test default overload - should NOT modify inputs even with inplace impl x_default = x.clone() x_residual_default = x_residual.clone() ...
fim
vllm-project/vllm
python
<|fim_suffix|>ops.chunk_gated_delta_rule_cpu( query=q, key=k, value=v, g=g.unsqueeze(0), beta=beta.unsqueeze(0), initial_state=initial_state, output_final_state=True, cu_seqlens=cu_seqlens, head_first=False, use_qk_l2norm_in_kernel=True, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import pytest import torch import torch.nn.functional as F from einops import rearrange from vllm.model_executor.layers.mamba.ops.causal_conv1d import ( causal_conv1d_fn, causa<|fim_suffix...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Integration test for the non-spec decode split in ``GatedDeltaNet._forward_core``. On a pure non-spec batch that mixes prefills with 1-token decodes, the layer peels the decodes (the contiguous d...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import pytest import torch import torch.nn.functional as F from vllm.platforms import current_platform if not ( current_platform.is_cuda() and current_platform.is_device_capabilit...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import unittest import pytest import torch from tests.utils import ensure_current_vllm_config, multi_gpu_test from vllm.distributed.parallel_state import ( init_distributed_envi<|fim_suffix|>_...
fim
vllm-project/vllm
python