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 torch from vllm.model_executor.layers.quantization.utils.mxfp8_utils import ( xpu_mxfp8_quantize as quant_mxfp8, ) from vllm.model_executor.utils import replace_parameter from vllm.platf...
fim
vllm-project/vllm
python
<|fim_suffix|>ecutor.kernels.linear.nvfp4.base import ( NvFp4LinearKernel, NvFp4LinearLayerConfig, ) __all__ = [ "NvFp4LinearKernel", "NvFp4LinearLayerConfig", ] <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopy<|fim_middle|>rightText: Copyright contributors to the vLLM project from ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from dataclasses import dataclass import torch from vllm.model_executor.layers.quantization.utils.quant_utils import QuantKey @dataclass class NvFp4LinearLaye...
fim
vllm-project/vllm
python
<|fim_suffix|>er: torch.nn.Module) -> None: layer.weight_scale = torch.nn.Parameter( swizzle_blockscale(layer.weight_scale.data), requires_grad=False ) padded_weight, weights_padding_cols = pad_nvfp4_weight_for_cutlass( layer.weight.data ) layer.weight = t...
fim
vllm-project/vllm
python
<|fim_suffix|>val.to(layer.weight.device) def apply_weights( self, layer: torch.nn.Module, x: torch.Tensor, bias: torch.Tensor | None = None, ) -> torch.Tensor: out = run_nvfp4_emulations( x=x, input_global_scale=layer.input_global_scale_inv, ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm._custom_ops import scaled_fp4_quant from vllm.model_executor.layers.quantization.utils.nvfp4_utils import ( slice_nvfp4_output, swizzle_blockscale, ) from vllm.utils....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm._custom_ops import scaled_fp4_quant from vllm.model_executor.layers.fusion.quant_activation import ( QuantizedActivation, as_quantized_activation, ) from vllm.model_e...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.logger import init_logger from vllm.model_executor.layers.quantization.utils.marlin_utils_fp4 import ( apply_fp4_marlin_linear, is_fp4_marlin_supported, prepare_fp4_layer_for_m...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from dataclasses import dataclass from typing import ClassVar import torch from typing_extensions import Self from vllm.model_executor.layers.quantization.input...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from collections.abc import Sequence from dataclasses import dataclass from typing import Generic, TypeVar import torch from vllm.model_executor.layers.fusion.quant_activatio...
fim
vllm-project/vllm
python
<|fim_suffix|>executor.kernels.linear.scaled_mm.rocm import ( ROCmFP8ScaledMMLinearKernel, ) from vllm.model_executor.kernels.linear.scaled_mm.ScaledMMLinearKernel import ( FP8ScaledMMLinearKernel, FP8ScaledMMLinearLayerConfig, Int8ScaledMMLinearKernel, Int8ScaledMMLinearLayerConfig, ScaledMMLin...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm import _custom_ops as ops from vllm._aiter_ops import ( rocm_aiter_ops, ) from vllm.logger import init_logger from vllm.model_executor.layers.quantization.utils.quant_ut...
fim
vllm-project/vllm
python
<|fim_suffix|> raise NotImplementedError( "CPUFp8BlockScaledMMKernel overrides apply_weights directly." ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm import _custom_ops as ops from vllm import ...
fim
vllm-project/vllm
python
<|fim_suffix|>_name) # keep the logical output width so runtime can slice away static padding. self.logical_output_size = weight.shape[1] pad_k = (16 - weight.shape[0] % 16) % 16 pad_n = (16 - weight.shape[1] % 16) % 16 if pad_k == 0 and pad_n == 0: return ...
fim
vllm-project/vllm
python
<|fim_suffix|>m0) return output def _fp8_gemm_nt_op( q_input: torch.Tensor, input_scale: torch.Tensor, weight: torch.Tensor, weight_scale: torch.Tensor, output: torch.Tensor, use_deep_gemm_e8m0: bool, ) -> None: fp8_gemm_nt( (q_input, input_scale), (weight, weight_s...
fim
vllm-project/vllm
python
<|fim_suffix|>_use_flashinfer_for_blockscale_fp8_gemm( is_flashinfer_fp8_blockscale_gemm_supported(), config.out_dtype, config.input_dtype, config.weight_quant_key.dtype, config.weight_shape, ): return ( False, ...
fim
vllm-project/vllm
python
<|fim_suffix|>layer.weight_scale_inv ) # Update layer with new values replace_parameter(layer, "weight", weight.data) replace_parameter(layer, "weight_scale_inv", weight_scale_inv.data) # Non-block: callers must pass weight in (K, N) layout. layer.input_s...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import torch from vllm.config import CompilationMode, get_current_vllm_config from vllm.platforms import current_platform from .ScaledMMLinearKernel import ( FP8ScaledMMLinearKern...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.envs as envs from vllm import _custom_ops as ops from vllm.platforms import current_platform from vllm.utils.platform_utils import num_compute_units from vllm.utils.torch_...
fim
vllm-project/vllm
python
<|fim_suffix|> layer, i_s_name, torch.nn.Parameter(scale, requires_grad=False), ) # AZP loaded as int8 but used as int32 azp = (int8_traits.min - range_min / scale).to(dtype=torch.int32) replace_parame...
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 Sequence import torch from vllm.model_executor.layers.quantization.utils.quant_utils import ( kFp8StaticChannelSym, kFp8StaticTensorSym, ) from vllm.model_execu...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Zentorch dynamic-symmetric W8A8 int8 linear kernel for AMD Zen CPUs. Selected by ``choose_scaled_mm_linear_kernel`` ahead of the generic oneDNN-backed ``CPUInt8ScaledMMLinearKernel``. When ``is_supported`` or ...
fim
vllm-project/vllm
python
<|fim_suffix|> return False ns = getattr(torch.ops, "zentorch", None) if ns is None: return False return all(hasattr(ns, op_name) for op_name in op_names) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Gates zentorch CP...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from .aiter import * from .tilelang import * from .torch import * from .triton import * __all__ = [ "mhc_pre_cuda", "mhc_post_cuda", "mhc_fused_post_pre_cuda", "hc_head_fused_kernel_cuda", "mh...
fim
vllm-project/vllm
python
<|fim_suffix|>mhc_pre_aiter_fake, ) direct_register_custom_op( op_name="mhc_post_aiter", op_func=mhc_post_aiter, mutates_args=[], fake_impl=_mhc_post_aiter_fake, ) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from ...
fim
vllm-project/vllm
python
<|fim_suffix|>um, hc_scale, hc_base, residual_cur, post_mix_cur, comb_mix_cur, layer_input_cur, norm_weight, hidden_size, rms_eps, hc_pre_eps, hc_sinkhorn_eps, hc_post_mult_val...
fim
vllm-project/vllm
python
<|fim_suffix|>rsum: T.Tensor((1, num_tokens), T.float32) # type: ignore[no-redef, valid-type] with T.Kernel(m_tiles, n_tiles, threads=n_thr) as (i_mt, i_t): tid = T.get_thread_binding() acc = T.alloc_local((block_m, tile_n), T.float32) sqr = T.alloc_local((block_m,), T.float32) T.c...
fim
vllm-project/vllm
python
<|fim_suffix|>32 assert hc_scale.dtype == torch.float32 assert hc_base.dtype == torch.float32 hc_mult = residual.shape[-2] hidden_size = residual.shape[-1] hc_mult2 = hc_mult * hc_mult hc_mult3 = hc_mult * 2 + hc_mult2 hc_hidden_size = hc_mult * hidden_size assert fn.shape[0] == hc_mul...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn.functional as F from torch import Tensor from vllm.triton_utils import tl, triton from vllm.utils.torch_utils import direct_register_custom_op @triton.jit def _rmsnorm...
fim
vllm-project/vllm
python
<|fim_suffix|>calar, self.with_vector_loads, ) return result.view(original_shape) def forward_native(self, input: torch.Tensor) -> torch.Tensor: if self._xielu_cuda_obj is not None and input.is_cuda: if not torch._dynamo.is_compiling(): return self._x...
fim
vllm-project/vllm
python
<|fim_suffix|>ntion.mm_encoder_attention import MMEncoderAttention from vllm.model_executor.layers.attention.static_sink_attention import ( StaticSinkAttention, ) __all__ = [ "Attention", "ChunkedLocalAttention", "CrossAttention", "EncoderOnlyAttention", "MLAAttention", "MMEncoderAttention"...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING, Any import torch import torch.nn as nn import vllm.envs as envs from vllm.config import CacheConfig, get_current_vllm_config from vllm.config.vllm import VllmConf...
fim
vllm-project/vllm
python
<|fim_suffix|>self, common_prefix_len: int, common_attn_metadata: CommonAttentionMetadata, fast_build: bool = False, ): cm, make_virtual_batches_block_table = make_local_attention_virtual_batches( attention_chunk_size, common_attn_m...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools from copy import copy import numpy as np import torch from vllm.config import CacheConfig, VllmConfig from vllm.logger import init_logger from vllm.model_executor.layers.attention ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools from copy import copy import torch from vllm.config import CacheConfig from vllm.config.vllm import VllmConfig from vllm.model_executor.layers.attention import Attention from vllm....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import inspect from collections.abc import Callable from functools import wraps from vllm.distributed.kv_transfer import ( get_kv_transfer_group, has_kv_transfer_group, is_v1_kv_transfer...
fim
vllm-project/vllm
python
<|fim_suffix|>= vllm_config.cache_config model_config = vllm_config.model_config chunked_prefill_workspace_size = min( # Try for 8 full length request or at least 4 pages per-request max( 8 * model_config.max_model_len, 4 * scheduler_config.max_nu...
fim
vllm-project/vllm
python
<|fim_suffix|>e[-1] != self.head_size: output = output[..., : self.head_size].contiguous() return output def forward_native( self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor, cu_seqlens: torch.Tensor | None = None, max_seqlen: to...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools import torch from vllm.config import CacheConfig, VllmConfig from vllm.forward_context import ForwardContext, get_forward_context from vllm.logger import init_logger from vllm.model_executor.cus...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Base class for attention-like layers.""" from abc import ABC, abstractmethod from vllm.config import VllmConfig from vllm.v1.attention.backend import AttentionBackend, AttentionImpl from vllm.v1...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math import os from collections.abc import Callable from typing import Any import torch import vllm.envs as envs from vllm.platforms import current_platform from vllm.triton_utils import tl,...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Conv Layer Class.""" import math from typing import Literal import torch import torch.nn as nn import torch.nn.functional as F from vllm.model_executor.custom_op import CustomOp from vllm.utils.torch_utils i...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightTe<|fim_suffix|>ttention project. # The original source code was licensed under the MIT license and included # the following copyright notice: # Copyright (c) 2023-2025, Songlin Y...
fim
vllm-project/vllm
python
<|fim_suffix|>ang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included # the following copyright notice: # Copyright (c) 2023-2025, Songlin Yang, Yu Zhang from .chunk import chunk_gated_delta_rule from .fused_gdn_prefill_p...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included...
fim
vllm-project/vllm
python
<|fim_suffix|> ) if USE_EXP2: b_h3 *= exp2(b_gk_last3)[None, :] else: b_h3 *= exp(b_gk_last3)[None, :] if K > 192: o_k4 = 192 + o_k1 b_gk_last4 = tl.load( gk + (bos + last_idx) * ...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included # the followi...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included # the followi...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Fused post-conv1d preparation for GDN prefill. Replaces the chain: split → rearrange → contiguous * 3 → l2norm * 2 → gating with a **single Triton kernel** that reads the conv'd mixed_qkv out...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included...
fim
vllm-project/vllm
python
<|fim_suffix|>ssm_state_indices: torch.Tensor | None = None, num_accepted_tokens: torch.Tensor | None = None, use_qk_l2norm_in_kernel: bool = False, is_kda: bool = False, ): """ Fused triton implementation of sigmoid gating delta rule update. This function uses a single fused kernel that combine...
fim
vllm-project/vllm
python
<|fim_suffix|>nsor: return torch.cat( [cu_seqlens.new_tensor([0]), triton.cdiv(prepare_lens(cu_seqlens), chunk_size)] ).cumsum(-1) <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # #...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included # the followi...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied from the flash-linear-attention project. # The original source code was licensed under the MIT license and included # the followi...
fim
vllm-project/vllm
python
<|fim_suffix|>e, we do GroupNorm with each group having group_size elements. group_size=None is equivalent to group_size=hidden_size (i.e. there's only 1 group). """ factory_kwargs = {"device": device, "dtype": dtype} super().__init__() self.eps = eps self.activation = ac...
fim
vllm-project/vllm
python
<|fim_suffix|> shape, strides, block_shape, _builder=None, ): return None <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # SPDX-FileCopyrightText: Songlin Yang, Yu Zhang # # This file contains code copied fr...
fim
vllm-project/vllm
python
<|fim_suffix|> = prepare_chunk_indices(cu_seqlens, BT) NT = len(chunk_indices) if cu_seqlens is not None else triton.cdiv(T, BT) Ai = torch.zeros_like(A, dtype=output_dtype) if BT == 16: merge_fn = solve_tril_16x16_kernel elif BT == 32: merge_fn = merge_16x16_to_32x32_inverse_kernel ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache<|fim_suffix|>()) for k, v in kwargs.items() } tensor = None for arg in args: if isinstance(arg, torch.Tensor): tensor = arg break if tensor is None: for value in kwargs.va...
fim
vllm-project/vllm
python
<|fim_suffix|> b_k = tl.load(p_k, boundary_check=(0, 1)) b_kb = (b_k * b_beta[:, None] * b_g[:, None]).to(b_k.dtype) b_w = tl.dot(b_A, b_kb) tl.store(p_w, b_w.to(p_w.dtype.element_ty), boundary_check=(0, 1)) def recompute_w_u_fwd( k: torch.Tensor, v: torch.Tensor, beta: torch.Ten...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from contextlib import contextmanager from typing import Any from vllm.model_executor.layers.fused_moe.activation import ( MoEActivation, activation_without_mul, apply_moe_activation, )...
fim
vllm-project/vllm
python
<|fim_suffix|>(output, input) elif activation == MoEActivation.GELU_TANH: torch.ops._C.gelu_tanh_and_mul(output, input) elif activation == MoEActivation.SWIGLUOAI: torch.ops._C.swigluoai_and_mul(output, input) elif activation == MoEActivation.SWIGLUSTEP: from vllm.model_executor.laye...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import Any import torch from vllm.config import get_current_vllm_config from vllm.distributed import ( get_ep_group, ) from vllm.logger import init_logger from vllm.model_executor.layers.fused_m...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from enum import IntEnum from typing import Union import torch from vllm.config import ParallelConfig, SchedulerConfig from vllm.config.kernel import MoEBackend from vllm.distri...
fim
vllm-project/vllm
python
<|fim_suffix|>re_correction_bias, ) return self.forward_method( layer, x, topk_weights, topk_ids, activation, global_num_experts, apply_router_weight_on_input, ) def check_grouped_gemm( self, ...
fim
vllm-project/vllm
python
<|fim_suffix|> # DeepGEMM uses negative values in m_indices (here expert_ids) to mark # completely invalid / padded blocks that should be skipped. We always # initialize expert_ids to -1 so any row that is not explicitly written # by the scatter kernel will be treated as invalid and skipped by # DeepG...
fim
vllm-project/vllm
python
<|fim_suffix|>rts: max_num_tokens = prepare_finalize.max_num_tokens_per_rank() assert max_num_tokens is not None experts_kwargs.update( max_num_tokens=max_num_tokens, num_dispatchers=prepare_finalize.num_dispatchers(), ) # Expert kernels with extra init param...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Expert Map Manager for MoE layers. This module contains the ExpertMapManager class which manages expert ID mappings and placement strategies for Expert Parallelism in MoE models. """ import tor...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm._aiter_ops import rocm_aiter_ops from vllm.model_executor.layers.fused_moe.activation import MoEActivation fr...
fim
vllm-project/vllm
python
<|fim_suffix|> num_dispatchers: int, ): """ max_num_tokens: Maximum number of tokens from a DP Rank num_dispatchers: The number of DP dispatchers. quant_config: Quantization configuration """ super().__init__( moe_config=moe_config, quant_c...
fim
vllm-project/vllm
python
<|fim_suffix|>packed_data...] # These dimensions should be available from the layer # For now, we'll extract from moe_config K = self.moe_config.hidden_dim N = self.moe_config.intermediate_size_per_partition assert self.quant_config.block_shape is not None if self.quant_c...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """CPU FP8 W8A16 and MXFP4 W4A16 fused MoE experts.""" import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm._custom_ops import ( CPUQuantAlgo, CPUQuantMet...
fim
vllm-project/vllm
python
<|fim_suffix|>_config.num_local_experts n = moe_config.intermediate_size_per_partition k = moe_config.hidden_dim device = moe_config.device self.out_dtype = moe_config.in_dtype a_strides1_c_strides2 = torch.full((e,), k, device=device, dtype=torch.int64) self.a_strides1...
fim
vllm-project/vllm
python
<|fim_suffix|>scale is not None a1q = hidden_states _, N, _ = w1.size() # K comes from activations (full hidden dim), not from w1 which is # packed FP4 (E, N, K//2). K = a1q.size(1) local_num_experts = w1.size(0) if global_num_experts == -1: global_n...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vll...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vllm.model_executor.layers.fused_moe.con...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm import envs from vllm.logger import init_logger from vllm.model_executor.layers.fused_moe.activation import M...
fim
vllm-project/vllm
python
<|fim_suffix|>rch.Tensor | None, workspace2: torch.Tensor | None, expert_tokens_meta: mk.ExpertTokensMetadata | None, apply_router_weight_on_input: bool | None, ): assert self.quant_dtype == "nvfp4" assert a1q_scale is not None assert self.w1_scale is not None ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.logger import init_logger from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vllm...
fim
vllm-project/vllm
python
<|fim_suffix|>f.num_dispatchers num_experts = local_num_experts max_num_tokens = self.max_num_tokens activation_out_dim = self.adjust_N_for_activation(N, activation) workspace13 = (num_experts, max_num_tokens * num_dp, max(K, N)) workspace2 = (num_experts, max_num_tokens * num_dp...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Fused MoE utilities for Humming.""" import json import math from typing import TYPE_CHECKING, Any import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm import ...
fim
vllm-project/vllm
python
<|fim_suffix|>d to import Triton kernels. Please make sure your triton " "version is compatible. Error: %s", e, ) @triton.jit def pack_bitmatrix( bitmatrix, topk_ids, n_rows, # n_rows in bitmatrix / topk_ids bm_cols: tl.constexpr, # n int32_t bitpacks in bitmatrix ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass import torch from vllm.lora.punica_wrapper.punica_base import PunicaWrapperBase @dataclass class MoELoRAContext: """ Carries all LoRA state for one MoE ...
fim
vllm-project/vllm
python
<|fim_suffix|>ply_w13_lora( self, lora_context: MoELoRAContext, *, y: torch.Tensor, x: torch.Tensor, topk_ids: torch.Tensor, topk_weights: torch.Tensor, expert_map: torch.Tensor | None, w1: torch.Tensor, w2: torch.Tensor, num_tokens...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Fused MoE utilities for GPTQ.""" from collections.abc import Callable import torch import vllm._custom_ops as ops import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.mode...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ NVFP4 quantization emulation for MoE. This file implements NVFP4 emulation for NVFP4 MOE in case the hardware used does not natively support NVFP4 MOE. Weights are dequantized on the fly during each forward,...
fim
vllm-project/vllm
python
<|fim_suffix|>omputation. This dequantizes the weights on the fly and calls TritonExperts.apply with activation quantization support. """ assert w1.dtype == torch.uint8 assert w2.dtype == torch.uint8 # Dequantize w1 and w2 from packed OCP MX format to bf16/fp16 ...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from enum import IntEnum from functools import lru_cache import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm._aiter_ops import rocm_aiter_ops from vllm.model_exe...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vllm.model_executor.layers.fused_moe.co...
fim
vllm-project/vllm
python
<|fim_suffix|>perts <|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vllm.model_executor....
fim
vllm-project/vllm
python
<|fim_suffix|>_states, w1, w2, topk_ids ) if global_num_experts == -1: global_num_experts = E config = try_get_optimal_moe_config( w1.size(), w2.size(), top_k_num, self.quant_config.config_name(hidden_states.dtype), num_to...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vllm.model_executor.layers.fused_moe.con...
fim
vllm-project/vllm
python
<|fim_suffix|>w1: torch.Tensor, w2: torch.Tensor, router_logits: torch.Tensor, activation: MoEActivation, global_num_experts: int, expert_map: torch.Tensor | None, a1q_scale: torch.Tensor | None, apply_router_weight_on_input: bool, # grouped topk + fused t...
fim
vllm-project/vllm
python
<|fim_suffix|>ation in (MoEActivation.SWIGLUOAI, MoEActivation.SILU) @staticmethod def activation_format() -> mk.FusedMoEActivationFormat: return mk.FusedMoEActivationFormat.Standard @property def expects_unquantized_inputs(self) -> bool: return False class TrtLlmMxfp4ExpertsMonolith...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.model_executor.layers.fused_moe.activation import MoEActivation from vllm.model_executor.layers.fused_moe.con...
fim
vllm-project/vllm
python
<|fim_suffix|> self, output: torch.Tensor, hidden_states: torch.Tensor, w1: torch.Tensor, w2: torch.Tensor, topk_weights: torch.Tensor, topk_ids: torch.Tensor, activation: MoEActivation, global_num_experts: int, expert_map: torch.Tensor | No...
fim
vllm-project/vllm
python
<|fim_suffix|>None, a1q_scale: torch.Tensor | None, a2_scale: torch.Tensor | None, workspace13: torch.Tensor, workspace2: torch.Tensor, expert_tokens_meta: mk.ExpertTokensMetadata | None, apply_router_weight_on_input: bool, ): # The kernel takes is_fp8/is_int4...
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """Fused MoE Triton kernels.""" import functools import json import os from typing import Any import torch import vllm.envs as envs import vllm.model_executor.layers.fused_moe.modular_kernel as mk...
fim
vllm-project/vllm
python
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import abstractmethod from typing import TYPE_CHECKING import torch import vllm.model_executor.layers.fused_moe.modular_kernel as mk from vllm.logger import init_logger from vllm.model_executor.layers....
fim
vllm-project/vllm
python
<|fim_prefix|># SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING import torch from vll<|fim_suffix|> @staticmethod def make( routed_experts: "RoutedExperts", old_quant_method: FusedMoEMethodBase, pr...
fim
vllm-project/vllm
python