vllm-cpu 0.8.5.post2__cp310-cp310-manylinux_2_17_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vllm-cpu might be problematic. Click here for more details.
- vllm/_C.abi3.so +0 -0
- vllm/__init__.py +170 -0
- vllm/_custom_ops.py +1536 -0
- vllm/_ipex_ops.py +241 -0
- vllm/_version.py +34 -0
- vllm/adapter_commons/__init__.py +0 -0
- vllm/adapter_commons/layers.py +16 -0
- vllm/adapter_commons/models.py +105 -0
- vllm/adapter_commons/request.py +25 -0
- vllm/adapter_commons/utils.py +92 -0
- vllm/adapter_commons/worker_manager.py +38 -0
- vllm/assets/__init__.py +0 -0
- vllm/assets/audio.py +38 -0
- vllm/assets/base.py +40 -0
- vllm/assets/image.py +31 -0
- vllm/assets/video.py +103 -0
- vllm/attention/__init__.py +19 -0
- vllm/attention/backends/__init__.py +0 -0
- vllm/attention/backends/abstract.py +306 -0
- vllm/attention/backends/blocksparse_attn.py +457 -0
- vllm/attention/backends/cpu_mla.py +303 -0
- vllm/attention/backends/flash_attn.py +999 -0
- vllm/attention/backends/flashinfer.py +1092 -0
- vllm/attention/backends/flashmla.py +242 -0
- vllm/attention/backends/hpu_attn.py +301 -0
- vllm/attention/backends/ipex_attn.py +396 -0
- vllm/attention/backends/mla/__init__.py +0 -0
- vllm/attention/backends/mla/common.py +1444 -0
- vllm/attention/backends/pallas.py +346 -0
- vllm/attention/backends/placeholder_attn.py +399 -0
- vllm/attention/backends/rocm_aiter_mla.py +412 -0
- vllm/attention/backends/rocm_flash_attn.py +969 -0
- vllm/attention/backends/torch_sdpa.py +691 -0
- vllm/attention/backends/triton_mla.py +113 -0
- vllm/attention/backends/utils.py +609 -0
- vllm/attention/backends/xformers.py +798 -0
- vllm/attention/layer.py +443 -0
- vllm/attention/ops/__init__.py +0 -0
- vllm/attention/ops/blocksparse_attention/__init__.py +0 -0
- vllm/attention/ops/blocksparse_attention/blocksparse_attention_kernel.py +432 -0
- vllm/attention/ops/blocksparse_attention/interface.py +238 -0
- vllm/attention/ops/blocksparse_attention/utils.py +244 -0
- vllm/attention/ops/chunked_prefill_paged_decode.py +366 -0
- vllm/attention/ops/flashmla.py +115 -0
- vllm/attention/ops/hpu_paged_attn.py +105 -0
- vllm/attention/ops/ipex_attn.py +193 -0
- vllm/attention/ops/merge_attn_states.py +42 -0
- vllm/attention/ops/nki_flash_attn.py +905 -0
- vllm/attention/ops/paged_attn.py +255 -0
- vllm/attention/ops/prefix_prefill.py +902 -0
- vllm/attention/ops/rocm_aiter_mla.py +42 -0
- vllm/attention/ops/rocm_aiter_paged_attn.py +101 -0
- vllm/attention/ops/triton_decode_attention.py +675 -0
- vllm/attention/ops/triton_flash_attention.py +1375 -0
- vllm/attention/ops/triton_merge_attn_states.py +96 -0
- vllm/attention/selector.py +186 -0
- vllm/attention/utils/fa_utils.py +54 -0
- vllm/beam_search.py +82 -0
- vllm/benchmarks/__init__.py +0 -0
- vllm/benchmarks/datasets.py +831 -0
- vllm/benchmarks/endpoint_request_func.py +160 -0
- vllm/benchmarks/latency.py +181 -0
- vllm/benchmarks/serve.py +925 -0
- vllm/benchmarks/throughput.py +608 -0
- vllm/benchmarks/utils.py +69 -0
- vllm/collect_env.py +795 -0
- vllm/compilation/__init__.py +0 -0
- vllm/compilation/backends.py +715 -0
- vllm/compilation/compiler_interface.py +437 -0
- vllm/compilation/counter.py +33 -0
- vllm/compilation/decorators.py +249 -0
- vllm/compilation/fix_functionalization.py +182 -0
- vllm/compilation/fusion.py +617 -0
- vllm/compilation/fx_utils.py +60 -0
- vllm/compilation/inductor_pass.py +114 -0
- vllm/compilation/monitor.py +38 -0
- vllm/compilation/multi_output_match.py +108 -0
- vllm/compilation/noop_elimination.py +135 -0
- vllm/compilation/pass_manager.py +74 -0
- vllm/compilation/sequence_parallelism.py +266 -0
- vllm/compilation/torch25_custom_graph_pass.py +41 -0
- vllm/compilation/vllm_inductor_pass.py +68 -0
- vllm/compilation/wrapper.py +129 -0
- vllm/config.py +4179 -0
- vllm/connections.py +170 -0
- vllm/core/__init__.py +0 -0
- vllm/core/block/__init__.py +0 -0
- vllm/core/block/block_table.py +398 -0
- vllm/core/block/common.py +370 -0
- vllm/core/block/cpu_gpu_block_allocator.py +440 -0
- vllm/core/block/interfaces.py +318 -0
- vllm/core/block/naive_block.py +465 -0
- vllm/core/block/prefix_caching_block.py +1134 -0
- vllm/core/block/utils.py +27 -0
- vllm/core/block_manager.py +520 -0
- vllm/core/evictor.py +156 -0
- vllm/core/interfaces.py +134 -0
- vllm/core/placeholder_block_space_manager.py +99 -0
- vllm/core/scheduler.py +2060 -0
- vllm/device_allocator/__init__.py +0 -0
- vllm/device_allocator/cumem.py +280 -0
- vllm/distributed/__init__.py +5 -0
- vllm/distributed/communication_op.py +40 -0
- vllm/distributed/device_communicators/__init__.py +0 -0
- vllm/distributed/device_communicators/base_device_communicator.py +151 -0
- vllm/distributed/device_communicators/cpu_communicator.py +139 -0
- vllm/distributed/device_communicators/cuda_communicator.py +131 -0
- vllm/distributed/device_communicators/cuda_wrapper.py +179 -0
- vllm/distributed/device_communicators/custom_all_reduce.py +301 -0
- vllm/distributed/device_communicators/custom_all_reduce_utils.py +257 -0
- vllm/distributed/device_communicators/hpu_communicator.py +45 -0
- vllm/distributed/device_communicators/neuron_communicator.py +19 -0
- vllm/distributed/device_communicators/pynccl.py +217 -0
- vllm/distributed/device_communicators/pynccl_wrapper.py +340 -0
- vllm/distributed/device_communicators/shm_broadcast.py +557 -0
- vllm/distributed/device_communicators/tpu_communicator.py +93 -0
- vllm/distributed/device_communicators/xpu_communicator.py +54 -0
- vllm/distributed/kv_transfer/README.md +29 -0
- vllm/distributed/kv_transfer/__init__.py +11 -0
- vllm/distributed/kv_transfer/disagg_prefill_workflow.jpg +0 -0
- vllm/distributed/kv_transfer/kv_connector/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_connector/base.py +127 -0
- vllm/distributed/kv_transfer/kv_connector/factory.py +107 -0
- vllm/distributed/kv_transfer/kv_connector/lmcache_connector.py +98 -0
- vllm/distributed/kv_transfer/kv_connector/mooncake_store_connector.py +201 -0
- vllm/distributed/kv_transfer/kv_connector/simple_connector.py +328 -0
- vllm/distributed/kv_transfer/kv_connector/utils.py +90 -0
- vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +8 -0
- vllm/distributed/kv_transfer/kv_connector/v1/base.py +209 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +131 -0
- vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +383 -0
- vllm/distributed/kv_transfer/kv_connector_agent.py +76 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +174 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +160 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +236 -0
- vllm/distributed/kv_transfer/kv_pipe/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_pipe/base.py +66 -0
- vllm/distributed/kv_transfer/kv_pipe/mooncake_pipe.py +279 -0
- vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +279 -0
- vllm/distributed/kv_transfer/kv_transfer_state.py +70 -0
- vllm/distributed/parallel_state.py +1209 -0
- vllm/distributed/utils.py +366 -0
- vllm/engine/__init__.py +0 -0
- vllm/engine/arg_utils.py +1724 -0
- vllm/engine/async_llm_engine.py +1261 -0
- vllm/engine/async_timeout.py +191 -0
- vllm/engine/llm_engine.py +2150 -0
- vllm/engine/metrics.py +717 -0
- vllm/engine/metrics_types.py +96 -0
- vllm/engine/multiprocessing/__init__.py +183 -0
- vllm/engine/multiprocessing/client.py +745 -0
- vllm/engine/multiprocessing/engine.py +450 -0
- vllm/engine/output_processor/__init__.py +0 -0
- vllm/engine/output_processor/interfaces.py +74 -0
- vllm/engine/output_processor/multi_step.py +210 -0
- vllm/engine/output_processor/single_step.py +136 -0
- vllm/engine/output_processor/stop_checker.py +130 -0
- vllm/engine/output_processor/util.py +27 -0
- vllm/engine/protocol.py +302 -0
- vllm/entrypoints/__init__.py +0 -0
- vllm/entrypoints/api_server.py +177 -0
- vllm/entrypoints/chat_utils.py +1259 -0
- vllm/entrypoints/cli/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/base.py +38 -0
- vllm/entrypoints/cli/benchmark/latency.py +29 -0
- vllm/entrypoints/cli/benchmark/main.py +53 -0
- vllm/entrypoints/cli/benchmark/serve.py +29 -0
- vllm/entrypoints/cli/benchmark/throughput.py +29 -0
- vllm/entrypoints/cli/collect_env.py +35 -0
- vllm/entrypoints/cli/main.py +59 -0
- vllm/entrypoints/cli/openai.py +175 -0
- vllm/entrypoints/cli/serve.py +59 -0
- vllm/entrypoints/cli/types.py +24 -0
- vllm/entrypoints/launcher.py +146 -0
- vllm/entrypoints/llm.py +1450 -0
- vllm/entrypoints/logger.py +44 -0
- vllm/entrypoints/openai/__init__.py +0 -0
- vllm/entrypoints/openai/api_server.py +1130 -0
- vllm/entrypoints/openai/cli_args.py +296 -0
- vllm/entrypoints/openai/logits_processors.py +89 -0
- vllm/entrypoints/openai/protocol.py +1806 -0
- vllm/entrypoints/openai/run_batch.py +439 -0
- vllm/entrypoints/openai/serving_chat.py +1210 -0
- vllm/entrypoints/openai/serving_completion.py +557 -0
- vllm/entrypoints/openai/serving_embedding.py +245 -0
- vllm/entrypoints/openai/serving_engine.py +569 -0
- vllm/entrypoints/openai/serving_models.py +314 -0
- vllm/entrypoints/openai/serving_pooling.py +237 -0
- vllm/entrypoints/openai/serving_score.py +439 -0
- vllm/entrypoints/openai/serving_tokenization.py +147 -0
- vllm/entrypoints/openai/serving_transcription.py +421 -0
- vllm/entrypoints/openai/tool_parsers/__init__.py +19 -0
- vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +163 -0
- vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +254 -0
- vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +232 -0
- vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +370 -0
- vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +211 -0
- vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +303 -0
- vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +262 -0
- vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +342 -0
- vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +110 -0
- vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +292 -0
- vllm/entrypoints/openai/tool_parsers/utils.py +123 -0
- vllm/entrypoints/score_utils.py +49 -0
- vllm/entrypoints/ssl.py +74 -0
- vllm/entrypoints/utils.py +136 -0
- vllm/env_override.py +34 -0
- vllm/envs.py +800 -0
- vllm/executor/__init__.py +0 -0
- vllm/executor/executor_base.py +400 -0
- vllm/executor/mp_distributed_executor.py +243 -0
- vllm/executor/msgspec_utils.py +29 -0
- vllm/executor/multiproc_worker_utils.py +312 -0
- vllm/executor/ray_distributed_executor.py +700 -0
- vllm/executor/ray_utils.py +400 -0
- vllm/executor/uniproc_executor.py +141 -0
- vllm/forward_context.py +159 -0
- vllm/inputs/__init__.py +37 -0
- vllm/inputs/data.py +248 -0
- vllm/inputs/parse.py +121 -0
- vllm/inputs/preprocess.py +745 -0
- vllm/inputs/registry.py +212 -0
- vllm/jsontree.py +79 -0
- vllm/logger.py +210 -0
- vllm/logging_utils/__init__.py +7 -0
- vllm/logging_utils/formatter.py +17 -0
- vllm/logits_process.py +121 -0
- vllm/lora/__init__.py +0 -0
- vllm/lora/fully_sharded_layers.py +335 -0
- vllm/lora/layers.py +1263 -0
- vllm/lora/lora.py +198 -0
- vllm/lora/models.py +802 -0
- vllm/lora/ops/__init__.py +0 -0
- vllm/lora/ops/torch_ops/__init__.py +15 -0
- vllm/lora/ops/torch_ops/lora_ops.py +115 -0
- vllm/lora/ops/triton_ops/__init__.py +11 -0
- vllm/lora/ops/triton_ops/kernel_utils.py +243 -0
- vllm/lora/ops/triton_ops/lora_expand.py +293 -0
- vllm/lora/ops/triton_ops/lora_kernel_metadata.py +147 -0
- vllm/lora/ops/triton_ops/lora_shrink.py +247 -0
- vllm/lora/ops/triton_ops/utils.py +121 -0
- vllm/lora/peft_helper.py +115 -0
- vllm/lora/punica_wrapper/__init__.py +9 -0
- vllm/lora/punica_wrapper/punica_base.py +483 -0
- vllm/lora/punica_wrapper/punica_cpu.py +348 -0
- vllm/lora/punica_wrapper/punica_gpu.py +289 -0
- vllm/lora/punica_wrapper/punica_hpu.py +144 -0
- vllm/lora/punica_wrapper/punica_selector.py +20 -0
- vllm/lora/punica_wrapper/utils.py +161 -0
- vllm/lora/request.py +97 -0
- vllm/lora/resolver.py +83 -0
- vllm/lora/utils.py +237 -0
- vllm/lora/worker_manager.py +251 -0
- vllm/model_executor/__init__.py +15 -0
- vllm/model_executor/custom_op.py +153 -0
- vllm/model_executor/guided_decoding/__init__.py +180 -0
- vllm/model_executor/guided_decoding/guidance_decoding.py +63 -0
- vllm/model_executor/guided_decoding/guidance_logits_processors.py +85 -0
- vllm/model_executor/guided_decoding/guided_fields.py +42 -0
- vllm/model_executor/guided_decoding/lm_format_enforcer_decoding.py +66 -0
- vllm/model_executor/guided_decoding/outlines_decoding.py +154 -0
- vllm/model_executor/guided_decoding/outlines_logits_processors.py +271 -0
- vllm/model_executor/guided_decoding/reasoner/__init__.py +35 -0
- vllm/model_executor/guided_decoding/utils.py +241 -0
- vllm/model_executor/guided_decoding/xgrammar_decoding.py +425 -0
- vllm/model_executor/layers/__init__.py +0 -0
- vllm/model_executor/layers/activation.py +368 -0
- vllm/model_executor/layers/fused_moe/__init__.py +51 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=96,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_H100.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +218 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +130 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325X,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=1024,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=256,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=1408,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=176,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=352,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=60,N=704,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1280,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=2560,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=320,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=640,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +138 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=14336,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=16384,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=1792,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=2048,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_L40S.json +173 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=7168,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=AMD_Instinct_MI325X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/README +12 -0
- vllm/model_executor/layers/fused_moe/cutlass_moe.py +180 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +294 -0
- vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +374 -0
- vllm/model_executor/layers/fused_moe/fused_moe.py +1539 -0
- vllm/model_executor/layers/fused_moe/layer.py +949 -0
- vllm/model_executor/layers/fused_moe/moe_align_block_size.py +243 -0
- vllm/model_executor/layers/fused_moe/moe_pallas.py +64 -0
- vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +59 -0
- vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +416 -0
- vllm/model_executor/layers/fused_moe/utils.py +48 -0
- vllm/model_executor/layers/layernorm.py +277 -0
- vllm/model_executor/layers/lightning_attn.py +651 -0
- vllm/model_executor/layers/linear.py +1518 -0
- vllm/model_executor/layers/logits_processor.py +196 -0
- vllm/model_executor/layers/mamba/__init__.py +0 -0
- vllm/model_executor/layers/mamba/mamba2_metadata.py +109 -0
- vllm/model_executor/layers/mamba/mamba_mixer.py +244 -0
- vllm/model_executor/layers/mamba/mamba_mixer2.py +538 -0
- vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
- vllm/model_executor/layers/mamba/ops/causal_conv1d.py +104 -0
- vllm/model_executor/layers/mamba/ops/mamba_ssm.py +415 -0
- vllm/model_executor/layers/mamba/ops/ssd_bmm.py +261 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +588 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +750 -0
- vllm/model_executor/layers/mamba/ops/ssd_combined.py +231 -0
- vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +205 -0
- vllm/model_executor/layers/pooler.py +336 -0
- vllm/model_executor/layers/quantization/__init__.py +153 -0
- vllm/model_executor/layers/quantization/aqlm.py +374 -0
- vllm/model_executor/layers/quantization/awq.py +184 -0
- vllm/model_executor/layers/quantization/awq_marlin.py +518 -0
- vllm/model_executor/layers/quantization/awq_triton.py +319 -0
- vllm/model_executor/layers/quantization/base_config.py +145 -0
- vllm/model_executor/layers/quantization/bitblas.py +459 -0
- vllm/model_executor/layers/quantization/bitsandbytes.py +396 -0
- vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +624 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +1100 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +20 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +357 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_scheme.py +54 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_24.py +159 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +119 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +149 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +110 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +200 -0
- vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +205 -0
- vllm/model_executor/layers/quantization/compressed_tensors/utils.py +213 -0
- vllm/model_executor/layers/quantization/deepspeedfp.py +193 -0
- vllm/model_executor/layers/quantization/experts_int8.py +194 -0
- vllm/model_executor/layers/quantization/fbgemm_fp8.py +168 -0
- vllm/model_executor/layers/quantization/fp8.py +832 -0
- vllm/model_executor/layers/quantization/gguf.py +408 -0
- vllm/model_executor/layers/quantization/gptq.py +276 -0
- vllm/model_executor/layers/quantization/gptq_bitblas.py +438 -0
- vllm/model_executor/layers/quantization/gptq_marlin.py +643 -0
- vllm/model_executor/layers/quantization/gptq_marlin_24.py +295 -0
- vllm/model_executor/layers/quantization/hqq_marlin.py +328 -0
- vllm/model_executor/layers/quantization/ipex_quant.py +250 -0
- vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +89 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +82 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +115 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +299 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +142 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +119 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +132 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +66 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +86 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +119 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +136 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +40 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +104 -0
- vllm/model_executor/layers/quantization/kv_cache.py +137 -0
- vllm/model_executor/layers/quantization/marlin.py +259 -0
- vllm/model_executor/layers/quantization/modelopt.py +410 -0
- vllm/model_executor/layers/quantization/moe_wna16.py +447 -0
- vllm/model_executor/layers/quantization/neuron_quant.py +67 -0
- vllm/model_executor/layers/quantization/ptpc_fp8.py +125 -0
- vllm/model_executor/layers/quantization/qqq.py +273 -0
- vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
- vllm/model_executor/layers/quantization/quark/quark.py +385 -0
- vllm/model_executor/layers/quantization/quark/quark_moe.py +236 -0
- vllm/model_executor/layers/quantization/quark/schemes/__init__.py +7 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +54 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +142 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +121 -0
- vllm/model_executor/layers/quantization/quark/utils.py +102 -0
- vllm/model_executor/layers/quantization/schema.py +85 -0
- vllm/model_executor/layers/quantization/torchao.py +127 -0
- vllm/model_executor/layers/quantization/tpu_int8.py +119 -0
- vllm/model_executor/layers/quantization/utils/__init__.py +5 -0
- vllm/model_executor/layers/quantization/utils/allspark_utils.py +51 -0
- vllm/model_executor/layers/quantization/utils/bitblas_utils.py +198 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=1536,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=1536,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2048,K=512,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=2304,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=24576,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=256,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=1536,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=3072,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=32768,K=512,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=36864,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4096,K=512,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=4608,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=512,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +18 -0
- vllm/model_executor/layers/quantization/utils/configs/N=576,K=7168,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1024,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=1152,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=16384,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=18432,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2048,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=2304,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=256,device_name=NVIDIA_L20,dtype=fp8_w8a8,block_shape=[128,128].json +26 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=7168,K=8192,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/configs/N=8192,K=1536,device_name=AMD_Instinct_MI325_OAM,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/quantization/utils/fp8_utils.py +523 -0
- vllm/model_executor/layers/quantization/utils/gptq_utils.py +94 -0
- vllm/model_executor/layers/quantization/utils/int8_utils.py +459 -0
- vllm/model_executor/layers/quantization/utils/layer_utils.py +39 -0
- vllm/model_executor/layers/quantization/utils/machete_utils.py +32 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils.py +413 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +110 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +164 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +464 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_qqq.py +127 -0
- vllm/model_executor/layers/quantization/utils/quant_utils.py +571 -0
- vllm/model_executor/layers/quantization/utils/w8a8_utils.py +404 -0
- vllm/model_executor/layers/rejection_sampler.py +400 -0
- vllm/model_executor/layers/resampler.py +269 -0
- vllm/model_executor/layers/rotary_embedding.py +1598 -0
- vllm/model_executor/layers/sampler.py +1221 -0
- vllm/model_executor/layers/spec_decode_base_sampler.py +258 -0
- vllm/model_executor/layers/typical_acceptance_sampler.py +172 -0
- vllm/model_executor/layers/utils.py +99 -0
- vllm/model_executor/layers/vocab_parallel_embedding.py +485 -0
- vllm/model_executor/model_loader/__init__.py +20 -0
- vllm/model_executor/model_loader/loader.py +1542 -0
- vllm/model_executor/model_loader/neuron.py +243 -0
- vllm/model_executor/model_loader/tensorizer.py +468 -0
- vllm/model_executor/model_loader/utils.py +171 -0
- vllm/model_executor/model_loader/weight_utils.py +749 -0
- vllm/model_executor/models/__init__.py +27 -0
- vllm/model_executor/models/adapters.py +247 -0
- vllm/model_executor/models/arctic.py +559 -0
- vllm/model_executor/models/aria.py +656 -0
- vllm/model_executor/models/aya_vision.py +461 -0
- vllm/model_executor/models/baichuan.py +469 -0
- vllm/model_executor/models/bamba.py +542 -0
- vllm/model_executor/models/bart.py +936 -0
- vllm/model_executor/models/bert.py +725 -0
- vllm/model_executor/models/blip.py +337 -0
- vllm/model_executor/models/blip2.py +717 -0
- vllm/model_executor/models/bloom.py +358 -0
- vllm/model_executor/models/chameleon.py +1135 -0
- vllm/model_executor/models/chatglm.py +476 -0
- vllm/model_executor/models/clip.py +410 -0
- vllm/model_executor/models/commandr.py +466 -0
- vllm/model_executor/models/constant_size_cache.py +136 -0
- vllm/model_executor/models/dbrx.py +469 -0
- vllm/model_executor/models/deepseek.py +484 -0
- vllm/model_executor/models/deepseek_mtp.py +266 -0
- vllm/model_executor/models/deepseek_v2.py +830 -0
- vllm/model_executor/models/deepseek_vl2.py +647 -0
- vllm/model_executor/models/eagle.py +247 -0
- vllm/model_executor/models/exaone.py +548 -0
- vllm/model_executor/models/fairseq2_llama.py +153 -0
- vllm/model_executor/models/falcon.py +508 -0
- vllm/model_executor/models/florence2.py +1102 -0
- vllm/model_executor/models/fuyu.py +388 -0
- vllm/model_executor/models/gemma.py +423 -0
- vllm/model_executor/models/gemma2.py +423 -0
- vllm/model_executor/models/gemma3.py +531 -0
- vllm/model_executor/models/gemma3_mm.py +716 -0
- vllm/model_executor/models/glm.py +22 -0
- vllm/model_executor/models/glm4.py +303 -0
- vllm/model_executor/models/glm4v.py +647 -0
- vllm/model_executor/models/gpt2.py +313 -0
- vllm/model_executor/models/gpt_bigcode.py +336 -0
- vllm/model_executor/models/gpt_j.py +337 -0
- vllm/model_executor/models/gpt_neox.py +330 -0
- vllm/model_executor/models/granite.py +494 -0
- vllm/model_executor/models/granite_speech.py +777 -0
- vllm/model_executor/models/granitemoe.py +435 -0
- vllm/model_executor/models/granitemoeshared.py +339 -0
- vllm/model_executor/models/gritlm.py +245 -0
- vllm/model_executor/models/grok1.py +560 -0
- vllm/model_executor/models/h2ovl.py +542 -0
- vllm/model_executor/models/idefics2_vision_model.py +387 -0
- vllm/model_executor/models/idefics3.py +767 -0
- vllm/model_executor/models/interfaces.py +569 -0
- vllm/model_executor/models/interfaces_base.py +163 -0
- vllm/model_executor/models/intern_vit.py +476 -0
- vllm/model_executor/models/internlm2.py +453 -0
- vllm/model_executor/models/internlm2_ve.py +146 -0
- vllm/model_executor/models/internvl.py +945 -0
- vllm/model_executor/models/jais.py +371 -0
- vllm/model_executor/models/jamba.py +590 -0
- vllm/model_executor/models/kimi_vl.py +577 -0
- vllm/model_executor/models/llama.py +619 -0
- vllm/model_executor/models/llama4.py +530 -0
- vllm/model_executor/models/llama_eagle.py +152 -0
- vllm/model_executor/models/llama_eagle3.py +232 -0
- vllm/model_executor/models/llava.py +869 -0
- vllm/model_executor/models/llava_next.py +582 -0
- vllm/model_executor/models/llava_next_video.py +470 -0
- vllm/model_executor/models/llava_onevision.py +954 -0
- vllm/model_executor/models/mamba.py +271 -0
- vllm/model_executor/models/mamba2.py +302 -0
- vllm/model_executor/models/mamba_cache.py +76 -0
- vllm/model_executor/models/medusa.py +210 -0
- vllm/model_executor/models/minicpm.py +592 -0
- vllm/model_executor/models/minicpm3.py +229 -0
- vllm/model_executor/models/minicpmo.py +725 -0
- vllm/model_executor/models/minicpmv.py +1287 -0
- vllm/model_executor/models/minimax_cache.py +35 -0
- vllm/model_executor/models/minimax_text_01.py +1261 -0
- vllm/model_executor/models/mistral3.py +598 -0
- vllm/model_executor/models/mixtral.py +485 -0
- vllm/model_executor/models/mixtral_quant.py +447 -0
- vllm/model_executor/models/mllama.py +1623 -0
- vllm/model_executor/models/mllama4.py +838 -0
- vllm/model_executor/models/mlp_speculator.py +205 -0
- vllm/model_executor/models/modernbert.py +325 -0
- vllm/model_executor/models/module_mapping.py +71 -0
- vllm/model_executor/models/molmo.py +1567 -0
- vllm/model_executor/models/moonvit.py +628 -0
- vllm/model_executor/models/mpt.py +329 -0
- vllm/model_executor/models/nemotron.py +506 -0
- vllm/model_executor/models/nemotron_nas.py +446 -0
- vllm/model_executor/models/nvlm_d.py +212 -0
- vllm/model_executor/models/olmo.py +390 -0
- vllm/model_executor/models/olmo2.py +412 -0
- vllm/model_executor/models/olmoe.py +449 -0
- vllm/model_executor/models/opt.py +410 -0
- vllm/model_executor/models/orion.py +356 -0
- vllm/model_executor/models/paligemma.py +397 -0
- vllm/model_executor/models/persimmon.py +342 -0
- vllm/model_executor/models/phi.py +354 -0
- vllm/model_executor/models/phi3.py +18 -0
- vllm/model_executor/models/phi3_small.py +463 -0
- vllm/model_executor/models/phi3v.py +722 -0
- vllm/model_executor/models/phi4mm.py +1263 -0
- vllm/model_executor/models/phi4mm_audio.py +1232 -0
- vllm/model_executor/models/phi4mm_utils.py +1883 -0
- vllm/model_executor/models/phimoe.py +666 -0
- vllm/model_executor/models/pixtral.py +1281 -0
- vllm/model_executor/models/plamo2.py +736 -0
- vllm/model_executor/models/prithvi_geospatial_mae.py +231 -0
- vllm/model_executor/models/qwen.py +360 -0
- vllm/model_executor/models/qwen2.py +552 -0
- vllm/model_executor/models/qwen2_5_omni_thinker.py +901 -0
- vllm/model_executor/models/qwen2_5_vl.py +1136 -0
- vllm/model_executor/models/qwen2_audio.py +402 -0
- vllm/model_executor/models/qwen2_moe.py +531 -0
- vllm/model_executor/models/qwen2_rm.py +130 -0
- vllm/model_executor/models/qwen2_vl.py +1409 -0
- vllm/model_executor/models/qwen3.py +319 -0
- vllm/model_executor/models/qwen3_moe.py +528 -0
- vllm/model_executor/models/qwen_vl.py +784 -0
- vllm/model_executor/models/registry.py +611 -0
- vllm/model_executor/models/roberta.py +332 -0
- vllm/model_executor/models/siglip.py +522 -0
- vllm/model_executor/models/skyworkr1v.py +949 -0
- vllm/model_executor/models/smolvlm.py +51 -0
- vllm/model_executor/models/solar.py +504 -0
- vllm/model_executor/models/stablelm.py +349 -0
- vllm/model_executor/models/starcoder2.py +355 -0
- vllm/model_executor/models/telechat2.py +139 -0
- vllm/model_executor/models/teleflm.py +78 -0
- vllm/model_executor/models/transformers.py +442 -0
- vllm/model_executor/models/ultravox.py +655 -0
- vllm/model_executor/models/utils.py +714 -0
- vllm/model_executor/models/vision.py +149 -0
- vllm/model_executor/models/whisper.py +746 -0
- vllm/model_executor/models/zamba2.py +1008 -0
- vllm/model_executor/parameter.py +458 -0
- vllm/model_executor/pooling_metadata.py +71 -0
- vllm/model_executor/sampling_metadata.py +596 -0
- vllm/model_executor/utils.py +53 -0
- vllm/multimodal/__init__.py +31 -0
- vllm/multimodal/audio.py +105 -0
- vllm/multimodal/base.py +218 -0
- vllm/multimodal/hasher.py +103 -0
- vllm/multimodal/image.py +77 -0
- vllm/multimodal/inputs.py +843 -0
- vllm/multimodal/parse.py +454 -0
- vllm/multimodal/processing.py +1760 -0
- vllm/multimodal/profiling.py +274 -0
- vllm/multimodal/registry.py +321 -0
- vllm/multimodal/utils.py +386 -0
- vllm/multimodal/video.py +166 -0
- vllm/outputs.py +521 -0
- vllm/platforms/__init__.py +286 -0
- vllm/platforms/cpu.py +182 -0
- vllm/platforms/cuda.py +463 -0
- vllm/platforms/hpu.py +94 -0
- vllm/platforms/interface.py +427 -0
- vllm/platforms/neuron.py +69 -0
- vllm/platforms/rocm.py +346 -0
- vllm/platforms/tpu.py +174 -0
- vllm/platforms/xpu.py +142 -0
- vllm/plugins/__init__.py +82 -0
- vllm/pooling_params.py +53 -0
- vllm/profiler/__init__.py +7 -0
- vllm/profiler/layerwise_profile.py +374 -0
- vllm/profiler/utils.py +147 -0
- vllm/prompt_adapter/__init__.py +0 -0
- vllm/prompt_adapter/layers.py +82 -0
- vllm/prompt_adapter/models.py +357 -0
- vllm/prompt_adapter/request.py +36 -0
- vllm/prompt_adapter/utils.py +97 -0
- vllm/prompt_adapter/worker_manager.py +178 -0
- vllm/py.typed +2 -0
- vllm/reasoning/__init__.py +12 -0
- vllm/reasoning/abs_reasoning_parsers.py +189 -0
- vllm/reasoning/deepseek_r1_reasoning_parser.py +172 -0
- vllm/reasoning/granite_reasoning_parser.py +362 -0
- vllm/sampling_params.py +598 -0
- vllm/scalar_type.py +335 -0
- vllm/scripts.py +14 -0
- vllm/sequence.py +1486 -0
- vllm/spec_decode/__init__.py +0 -0
- vllm/spec_decode/batch_expansion.py +505 -0
- vllm/spec_decode/draft_model_runner.py +335 -0
- vllm/spec_decode/interfaces.py +98 -0
- vllm/spec_decode/medusa_worker.py +137 -0
- vllm/spec_decode/metrics.py +212 -0
- vllm/spec_decode/mlp_speculator_worker.py +93 -0
- vllm/spec_decode/mqa_scorer.py +159 -0
- vllm/spec_decode/multi_step_worker.py +416 -0
- vllm/spec_decode/ngram_worker.py +195 -0
- vllm/spec_decode/proposer_worker_base.py +58 -0
- vllm/spec_decode/smaller_tp_proposer_worker.py +194 -0
- vllm/spec_decode/spec_decode_worker.py +1324 -0
- vllm/spec_decode/target_model_runner.py +44 -0
- vllm/spec_decode/top1_proposer.py +274 -0
- vllm/spec_decode/util.py +276 -0
- vllm/test_utils.py +129 -0
- vllm/third_party/__init__.py +0 -0
- vllm/third_party/pynvml.py +6139 -0
- vllm/tracing.py +130 -0
- vllm/transformers_utils/__init__.py +19 -0
- vllm/transformers_utils/config.py +813 -0
- vllm/transformers_utils/configs/__init__.py +52 -0
- vllm/transformers_utils/configs/arctic.py +206 -0
- vllm/transformers_utils/configs/chatglm.py +71 -0
- vllm/transformers_utils/configs/cohere2.py +194 -0
- vllm/transformers_utils/configs/dbrx.py +280 -0
- vllm/transformers_utils/configs/deepseek_vl2.py +216 -0
- vllm/transformers_utils/configs/eagle.py +65 -0
- vllm/transformers_utils/configs/exaone.py +191 -0
- vllm/transformers_utils/configs/falcon.py +89 -0
- vllm/transformers_utils/configs/h2ovl.py +15 -0
- vllm/transformers_utils/configs/internvl.py +53 -0
- vllm/transformers_utils/configs/jais.py +237 -0
- vllm/transformers_utils/configs/kimi_vl.py +36 -0
- vllm/transformers_utils/configs/medusa.py +62 -0
- vllm/transformers_utils/configs/mllama.py +30 -0
- vllm/transformers_utils/configs/mlp_speculator.py +67 -0
- vllm/transformers_utils/configs/moonvit.py +32 -0
- vllm/transformers_utils/configs/mpt.py +179 -0
- vllm/transformers_utils/configs/nemotron.py +204 -0
- vllm/transformers_utils/configs/nvlm_d.py +14 -0
- vllm/transformers_utils/configs/skyworkr1v.py +53 -0
- vllm/transformers_utils/configs/solar.py +246 -0
- vllm/transformers_utils/configs/telechat2.py +63 -0
- vllm/transformers_utils/configs/ultravox.py +107 -0
- vllm/transformers_utils/detokenizer.py +167 -0
- vllm/transformers_utils/detokenizer_utils.py +188 -0
- vllm/transformers_utils/processor.py +210 -0
- vllm/transformers_utils/processors/__init__.py +6 -0
- vllm/transformers_utils/processors/deepseek_vl2.py +363 -0
- vllm/transformers_utils/s3_utils.py +161 -0
- vllm/transformers_utils/tokenizer.py +291 -0
- vllm/transformers_utils/tokenizer_base.py +146 -0
- vllm/transformers_utils/tokenizer_group.py +110 -0
- vllm/transformers_utils/tokenizers/__init__.py +9 -0
- vllm/transformers_utils/tokenizers/mistral.py +483 -0
- vllm/transformers_utils/utils.py +98 -0
- vllm/triton_utils/__init__.py +5 -0
- vllm/triton_utils/importing.py +53 -0
- vllm/usage/__init__.py +0 -0
- vllm/usage/usage_lib.py +255 -0
- vllm/utils.py +2692 -0
- vllm/v1/__init__.py +0 -0
- vllm/v1/attention/__init__.py +0 -0
- vllm/v1/attention/backends/__init__.py +0 -0
- vllm/v1/attention/backends/flash_attn.py +783 -0
- vllm/v1/attention/backends/flashinfer.py +638 -0
- vllm/v1/attention/backends/mla/__init__.py +0 -0
- vllm/v1/attention/backends/mla/common.py +974 -0
- vllm/v1/attention/backends/mla/flashmla.py +149 -0
- vllm/v1/attention/backends/mla/triton_mla.py +118 -0
- vllm/v1/attention/backends/pallas.py +221 -0
- vllm/v1/attention/backends/triton_attn.py +198 -0
- vllm/v1/core/__init__.py +0 -0
- vllm/v1/core/block_pool.py +281 -0
- vllm/v1/core/encoder_cache_manager.py +149 -0
- vllm/v1/core/kv_cache_manager.py +385 -0
- vllm/v1/core/kv_cache_utils.py +744 -0
- vllm/v1/core/sched/__init__.py +0 -0
- vllm/v1/core/sched/interface.py +134 -0
- vllm/v1/core/sched/output.py +126 -0
- vllm/v1/core/sched/scheduler.py +838 -0
- vllm/v1/core/sched/utils.py +22 -0
- vllm/v1/core/specialized_manager.py +161 -0
- vllm/v1/engine/__init__.py +166 -0
- vllm/v1/engine/async_llm.py +532 -0
- vllm/v1/engine/core.py +701 -0
- vllm/v1/engine/core_client.py +942 -0
- vllm/v1/engine/detokenizer.py +260 -0
- vllm/v1/engine/exceptions.py +16 -0
- vllm/v1/engine/llm_engine.py +285 -0
- vllm/v1/engine/logprobs.py +198 -0
- vllm/v1/engine/mm_input_cache.py +82 -0
- vllm/v1/engine/output_processor.py +420 -0
- vllm/v1/engine/parallel_sampling.py +132 -0
- vllm/v1/engine/processor.py +387 -0
- vllm/v1/executor/__init__.py +0 -0
- vllm/v1/executor/abstract.py +112 -0
- vllm/v1/executor/multiproc_executor.py +480 -0
- vllm/v1/executor/ray_distributed_executor.py +61 -0
- vllm/v1/kv_cache_interface.py +166 -0
- vllm/v1/metrics/__init__.py +0 -0
- vllm/v1/metrics/loggers.py +498 -0
- vllm/v1/metrics/stats.py +238 -0
- vllm/v1/outputs.py +111 -0
- vllm/v1/request.py +178 -0
- vllm/v1/sample/__init__.py +0 -0
- vllm/v1/sample/metadata.py +43 -0
- vllm/v1/sample/ops/__init__.py +0 -0
- vllm/v1/sample/ops/bad_words.py +38 -0
- vllm/v1/sample/ops/penalties.py +58 -0
- vllm/v1/sample/ops/topk_topp_sampler.py +315 -0
- vllm/v1/sample/rejection_sampler.py +631 -0
- vllm/v1/sample/sampler.py +270 -0
- vllm/v1/sample/tpu/__init__.py +0 -0
- vllm/v1/sample/tpu/metadata.py +118 -0
- vllm/v1/sample/tpu/sampler.py +154 -0
- vllm/v1/serial_utils.py +274 -0
- vllm/v1/spec_decode/__init__.py +0 -0
- vllm/v1/spec_decode/eagle.py +318 -0
- vllm/v1/spec_decode/metadata.py +61 -0
- vllm/v1/spec_decode/metrics.py +164 -0
- vllm/v1/spec_decode/ngram_proposer.py +131 -0
- vllm/v1/spec_decode/utils.py +18 -0
- vllm/v1/stats/__init__.py +0 -0
- vllm/v1/stats/common.py +453 -0
- vllm/v1/structured_output/__init__.py +113 -0
- vllm/v1/structured_output/backend_guidance.py +215 -0
- vllm/v1/structured_output/backend_types.py +96 -0
- vllm/v1/structured_output/backend_xgrammar.py +299 -0
- vllm/v1/structured_output/request.py +84 -0
- vllm/v1/structured_output/utils.py +174 -0
- vllm/v1/utils.py +249 -0
- vllm/v1/worker/__init__.py +0 -0
- vllm/v1/worker/block_table.py +87 -0
- vllm/v1/worker/gpu_input_batch.py +677 -0
- vllm/v1/worker/gpu_model_runner.py +1776 -0
- vllm/v1/worker/gpu_worker.py +349 -0
- vllm/v1/worker/lora_model_runner_mixin.py +145 -0
- vllm/v1/worker/tpu_model_runner.py +1419 -0
- vllm/v1/worker/tpu_worker.py +260 -0
- vllm/v1/worker/utils.py +74 -0
- vllm/v1/worker/worker_base.py +64 -0
- vllm/version.py +40 -0
- vllm/vllm_flash_attn/.gitkeep +0 -0
- vllm/worker/__init__.py +0 -0
- vllm/worker/cache_engine.py +144 -0
- vllm/worker/cpu_enc_dec_model_runner.py +323 -0
- vllm/worker/cpu_model_runner.py +668 -0
- vllm/worker/cpu_pooling_model_runner.py +122 -0
- vllm/worker/cpu_worker.py +400 -0
- vllm/worker/enc_dec_model_runner.py +542 -0
- vllm/worker/hpu_model_runner.py +2221 -0
- vllm/worker/hpu_worker.py +483 -0
- vllm/worker/model_runner.py +2056 -0
- vllm/worker/model_runner_base.py +281 -0
- vllm/worker/multi_step_hpu_worker.py +122 -0
- vllm/worker/multi_step_model_runner.py +908 -0
- vllm/worker/multi_step_tpu_worker.py +107 -0
- vllm/worker/multi_step_worker.py +196 -0
- vllm/worker/neuron_model_runner.py +336 -0
- vllm/worker/neuron_worker.py +138 -0
- vllm/worker/pooling_model_runner.py +200 -0
- vllm/worker/tpu_model_runner.py +908 -0
- vllm/worker/tpu_worker.py +332 -0
- vllm/worker/utils.py +52 -0
- vllm/worker/worker.py +570 -0
- vllm/worker/worker_base.py +644 -0
- vllm/worker/xpu_model_runner.py +603 -0
- vllm/worker/xpu_worker.py +185 -0
- vllm_cpu-0.8.5.post2.dist-info/METADATA +309 -0
- vllm_cpu-0.8.5.post2.dist-info/RECORD +1103 -0
- vllm_cpu-0.8.5.post2.dist-info/WHEEL +5 -0
- vllm_cpu-0.8.5.post2.dist-info/entry_points.txt +2 -0
- vllm_cpu-0.8.5.post2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1539 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
"""Fused MoE kernel."""
|
|
3
|
+
import functools
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
7
|
+
|
|
8
|
+
import torch
|
|
9
|
+
import triton
|
|
10
|
+
import triton.language as tl
|
|
11
|
+
|
|
12
|
+
import vllm.envs as envs
|
|
13
|
+
from vllm import _custom_ops as ops
|
|
14
|
+
from vllm.logger import init_logger
|
|
15
|
+
from vllm.model_executor.layers.fused_moe.deep_gemm_moe import (
|
|
16
|
+
_valid_deep_gemm, deep_gemm_moe_fp8)
|
|
17
|
+
from vllm.model_executor.layers.fused_moe.moe_align_block_size import (
|
|
18
|
+
moe_align_block_size)
|
|
19
|
+
from vllm.model_executor.layers.quantization.utils.fp8_utils import (
|
|
20
|
+
per_token_group_quant_fp8)
|
|
21
|
+
from vllm.model_executor.layers.quantization.utils.int8_utils import (
|
|
22
|
+
per_token_group_quant_int8, per_token_quant_int8)
|
|
23
|
+
from vllm.platforms import current_platform
|
|
24
|
+
from vllm.utils import direct_register_custom_op
|
|
25
|
+
|
|
26
|
+
from .rocm_aiter_fused_moe import is_rocm_aiter_moe_enabled
|
|
27
|
+
|
|
28
|
+
logger = init_logger(__name__)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@triton.jit
|
|
32
|
+
def write_zeros_to_output(c_ptr, stride_cm, stride_cn, pid_n, N, offs_token,
|
|
33
|
+
token_mask, BLOCK_SIZE_M, BLOCK_SIZE_N,
|
|
34
|
+
compute_type):
|
|
35
|
+
accumulator = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=compute_type)
|
|
36
|
+
offs_cn = pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N)
|
|
37
|
+
c_ptrs = c_ptr + stride_cm * offs_token[:, None] + stride_cn * offs_cn[
|
|
38
|
+
None, :]
|
|
39
|
+
c_mask = token_mask[:, None] & (offs_cn[None, :] < N)
|
|
40
|
+
tl.store(c_ptrs, accumulator, mask=c_mask)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@triton.jit
|
|
44
|
+
def fused_moe_kernel_gptq_awq(
|
|
45
|
+
# Pointers to matrices
|
|
46
|
+
a_ptr,
|
|
47
|
+
b_ptr,
|
|
48
|
+
c_ptr,
|
|
49
|
+
b_scale_ptr,
|
|
50
|
+
b_zp_ptr,
|
|
51
|
+
topk_weights_ptr,
|
|
52
|
+
sorted_token_ids_ptr,
|
|
53
|
+
expert_ids_ptr,
|
|
54
|
+
num_tokens_post_padded_ptr,
|
|
55
|
+
# Matrix dimensions
|
|
56
|
+
N: tl.constexpr,
|
|
57
|
+
K: tl.constexpr,
|
|
58
|
+
EM,
|
|
59
|
+
num_valid_tokens,
|
|
60
|
+
# The stride variables represent how much to increase the ptr by when
|
|
61
|
+
# moving by 1 element in a particular dimension. E.g. `stride_am` is
|
|
62
|
+
# how much to increase `a_ptr` by to get the element one row down
|
|
63
|
+
# (A has M rows).
|
|
64
|
+
stride_am,
|
|
65
|
+
stride_ak,
|
|
66
|
+
stride_be,
|
|
67
|
+
stride_bk,
|
|
68
|
+
stride_bn,
|
|
69
|
+
stride_cm,
|
|
70
|
+
stride_cn,
|
|
71
|
+
stride_bse,
|
|
72
|
+
stride_bsk,
|
|
73
|
+
stride_bsn,
|
|
74
|
+
stride_bze,
|
|
75
|
+
stride_bzk,
|
|
76
|
+
stride_bzn,
|
|
77
|
+
block_k_diviable: tl.constexpr,
|
|
78
|
+
group_size: tl.constexpr,
|
|
79
|
+
# Meta-parameters
|
|
80
|
+
BLOCK_SIZE_M: tl.constexpr,
|
|
81
|
+
BLOCK_SIZE_N: tl.constexpr,
|
|
82
|
+
BLOCK_SIZE_K: tl.constexpr,
|
|
83
|
+
GROUP_SIZE_M: tl.constexpr,
|
|
84
|
+
MUL_ROUTED_WEIGHT: tl.constexpr,
|
|
85
|
+
top_k: tl.constexpr,
|
|
86
|
+
compute_type: tl.constexpr,
|
|
87
|
+
has_zp: tl.constexpr,
|
|
88
|
+
use_int4_w4a16: tl.constexpr,
|
|
89
|
+
use_int8_w8a16: tl.constexpr):
|
|
90
|
+
"""
|
|
91
|
+
Implements the fused computation for a Mixture of Experts (MOE) using
|
|
92
|
+
token and expert matrices.
|
|
93
|
+
|
|
94
|
+
Key Parameters:
|
|
95
|
+
- A: The input tensor representing tokens with shape (*, K), where '*' can
|
|
96
|
+
be any shape representing batches and K is the feature dimension of
|
|
97
|
+
each token.
|
|
98
|
+
- B: The stacked MOE weight tensor with shape (E, N, K), where E is
|
|
99
|
+
the number of experts, K is the input feature dimension, and N is
|
|
100
|
+
the output feature dimension.
|
|
101
|
+
- C: The output cache tensor with shape (M, topk, N), where M is the
|
|
102
|
+
total number of tokens post padding, topk is the number of times
|
|
103
|
+
each token is repeated, and N is the output feature dimension.
|
|
104
|
+
- sorted_token_ids: A tensor containing the sorted indices of tokens,
|
|
105
|
+
repeated topk times and arranged by the expert index they are
|
|
106
|
+
assigned to.
|
|
107
|
+
- expert_ids: A tensor containing the indices of the expert for each
|
|
108
|
+
block. It determines which expert matrix from B should be used for
|
|
109
|
+
each block in A.
|
|
110
|
+
This kernel performs the multiplication of a token by its corresponding
|
|
111
|
+
expert matrix as determined by `expert_ids`. The sorting of
|
|
112
|
+
`sorted_token_ids` by expert index and padding ensures divisibility by
|
|
113
|
+
BLOCK_SIZE_M, which is necessary to maintain consistency in block matrix
|
|
114
|
+
multiplication across different blocks processed by the same expert.
|
|
115
|
+
"""
|
|
116
|
+
# -----------------------------------------------------------
|
|
117
|
+
# Map program ids `pid` to the block of C it should compute.
|
|
118
|
+
# This is done in a grouped ordering to promote L2 data reuse.
|
|
119
|
+
pid = tl.program_id(axis=0)
|
|
120
|
+
num_pid_m = tl.cdiv(EM, BLOCK_SIZE_M)
|
|
121
|
+
num_pid_n = tl.cdiv(N, BLOCK_SIZE_N)
|
|
122
|
+
num_pid_in_group = GROUP_SIZE_M * num_pid_n
|
|
123
|
+
group_id = pid // num_pid_in_group
|
|
124
|
+
first_pid_m = group_id * GROUP_SIZE_M
|
|
125
|
+
group_size_m = min(num_pid_m - first_pid_m, GROUP_SIZE_M)
|
|
126
|
+
pid_m = first_pid_m + ((pid % num_pid_in_group) % group_size_m)
|
|
127
|
+
pid_n = (pid % num_pid_in_group) // group_size_m
|
|
128
|
+
|
|
129
|
+
# ----------------------------------------------------------
|
|
130
|
+
# Create pointers for the first blocks of A and B.
|
|
131
|
+
# We will advance this pointer as we move in the K direction
|
|
132
|
+
# and accumulate
|
|
133
|
+
# `a_ptrs` is a block of [BLOCK_SIZE_M, BLOCK_SIZE_K] pointers
|
|
134
|
+
# `b_ptrs` is a block of [BLOCK_SIZE_K, BLOCK_SIZE_N] pointers
|
|
135
|
+
num_tokens_post_padded = tl.load(num_tokens_post_padded_ptr)
|
|
136
|
+
if pid_m * BLOCK_SIZE_M >= num_tokens_post_padded:
|
|
137
|
+
return
|
|
138
|
+
offs_token_id = pid_m * BLOCK_SIZE_M + tl.arange(0, BLOCK_SIZE_M).to(
|
|
139
|
+
tl.int64)
|
|
140
|
+
offs_token = tl.load(sorted_token_ids_ptr + offs_token_id)
|
|
141
|
+
token_mask = offs_token < num_valid_tokens
|
|
142
|
+
|
|
143
|
+
off_experts = tl.load(expert_ids_ptr + pid_m).to(tl.int64)
|
|
144
|
+
if off_experts == -1:
|
|
145
|
+
# -----------------------------------------------------------
|
|
146
|
+
# Write back zeros to the output when the expert is not
|
|
147
|
+
# in the current expert parallel rank.
|
|
148
|
+
write_zeros_to_output(c_ptr, stride_cm, stride_cn, pid_n, N,
|
|
149
|
+
offs_token, token_mask, BLOCK_SIZE_M,
|
|
150
|
+
BLOCK_SIZE_N, compute_type)
|
|
151
|
+
return
|
|
152
|
+
|
|
153
|
+
offs_bn = (pid_n * BLOCK_SIZE_N +
|
|
154
|
+
tl.arange(0, BLOCK_SIZE_N).to(tl.int64)) % N
|
|
155
|
+
offs_k = tl.arange(0, BLOCK_SIZE_K)
|
|
156
|
+
a_ptrs = a_ptr + (offs_token[:, None] // top_k * stride_am +
|
|
157
|
+
offs_k[None, :] * stride_ak)
|
|
158
|
+
|
|
159
|
+
if use_int4_w4a16:
|
|
160
|
+
b_ptrs = b_ptr + off_experts * stride_be + \
|
|
161
|
+
(offs_k[:, None] // 2) * stride_bk + offs_bn[None, :] * \
|
|
162
|
+
stride_bn
|
|
163
|
+
b_shifter = (offs_k[:, None] % 2) * 4
|
|
164
|
+
elif use_int8_w8a16:
|
|
165
|
+
b_ptrs = b_ptr + off_experts * stride_be + \
|
|
166
|
+
offs_k[:, None] * stride_bk + offs_bn[None, :] * stride_bn
|
|
167
|
+
|
|
168
|
+
if not has_zp and use_int4_w4a16:
|
|
169
|
+
b_zp_num = 8
|
|
170
|
+
if not has_zp and use_int8_w8a16:
|
|
171
|
+
b_zp_num = 128
|
|
172
|
+
elif has_zp and use_int4_w4a16:
|
|
173
|
+
b_zp_shifter = (offs_bn[None, :] % 2) * 4
|
|
174
|
+
|
|
175
|
+
# -----------------------------------------------------------
|
|
176
|
+
# Iterate to compute a block of the C matrix.
|
|
177
|
+
# We accumulate into a `[BLOCK_SIZE_M, BLOCK_SIZE_N]` block
|
|
178
|
+
# of fp32 values for higher accuracy.
|
|
179
|
+
# `accumulator` will be converted back to fp16 after the loop.
|
|
180
|
+
accumulator = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=tl.float32)
|
|
181
|
+
for k in range(0, tl.cdiv(K, BLOCK_SIZE_K)):
|
|
182
|
+
# Load the next block of A and B, generate a mask by checking the
|
|
183
|
+
# K dimension.
|
|
184
|
+
|
|
185
|
+
if not block_k_diviable:
|
|
186
|
+
k_mask = offs_k[:, None] < K - k * BLOCK_SIZE_K
|
|
187
|
+
k_other = 0.0
|
|
188
|
+
else:
|
|
189
|
+
k_mask = None
|
|
190
|
+
k_other = None
|
|
191
|
+
|
|
192
|
+
a = tl.load(a_ptrs,
|
|
193
|
+
mask=token_mask[:, None] &
|
|
194
|
+
(offs_k[None, :] < K - k * BLOCK_SIZE_K),
|
|
195
|
+
other=0.0)
|
|
196
|
+
b = tl.load(b_ptrs)
|
|
197
|
+
if use_int4_w4a16:
|
|
198
|
+
b = (b >> b_shifter) & 0xF
|
|
199
|
+
|
|
200
|
+
b_scale_ptrs = b_scale_ptr + off_experts * stride_bse + \
|
|
201
|
+
offs_bn[None, :] * stride_bsn + \
|
|
202
|
+
((offs_k[:, None] + BLOCK_SIZE_K * k) // group_size) * \
|
|
203
|
+
stride_bsk
|
|
204
|
+
b_scale = tl.load(b_scale_ptrs, mask=k_mask, other=k_other)
|
|
205
|
+
b_scale = b_scale.to(tl.float32)
|
|
206
|
+
|
|
207
|
+
if has_zp and use_int4_w4a16:
|
|
208
|
+
offs_k_true = (offs_k[:, None] + BLOCK_SIZE_K * k) // group_size
|
|
209
|
+
b_zp_ptrs = b_zp_ptr + off_experts * stride_bze + \
|
|
210
|
+
(offs_bn[None, :] // 2) * stride_bzn + \
|
|
211
|
+
offs_k_true * stride_bzk
|
|
212
|
+
b_zp = tl.load(b_zp_ptrs, mask=k_mask, other=k_other)
|
|
213
|
+
b_zp = ((b_zp >> b_zp_shifter) & 0xF)
|
|
214
|
+
b_zp = b_zp.to(tl.float32)
|
|
215
|
+
elif has_zp and use_int8_w8a16:
|
|
216
|
+
offs_k_true = (offs_k[:, None] + BLOCK_SIZE_K * k) // group_size
|
|
217
|
+
b_zp_ptrs = b_zp_ptr + off_experts * stride_bze + \
|
|
218
|
+
offs_bn[None, :] * stride_bzn + \
|
|
219
|
+
offs_k_true * stride_bzk
|
|
220
|
+
b_zp = tl.load(b_zp_ptrs, mask=k_mask, other=k_other)
|
|
221
|
+
b_zp = b_zp.to(tl.float32)
|
|
222
|
+
|
|
223
|
+
# We accumulate along the K dimension.
|
|
224
|
+
if has_zp:
|
|
225
|
+
b = ((b.to(tl.float32) - b_zp) * b_scale).to(compute_type)
|
|
226
|
+
else:
|
|
227
|
+
b = ((b.to(tl.float32) - b_zp_num) * b_scale).to(compute_type)
|
|
228
|
+
accumulator = tl.dot(a, b, acc=accumulator)
|
|
229
|
+
|
|
230
|
+
# Advance the ptrs to the next K block.
|
|
231
|
+
a_ptrs += BLOCK_SIZE_K * stride_ak
|
|
232
|
+
if use_int4_w4a16:
|
|
233
|
+
b_ptrs += (BLOCK_SIZE_K // 2) * stride_bk
|
|
234
|
+
else:
|
|
235
|
+
b_ptrs += BLOCK_SIZE_K * stride_bk
|
|
236
|
+
|
|
237
|
+
if MUL_ROUTED_WEIGHT:
|
|
238
|
+
moe_weight = tl.load(topk_weights_ptr + offs_token,
|
|
239
|
+
mask=token_mask,
|
|
240
|
+
other=0)
|
|
241
|
+
accumulator = accumulator * moe_weight[:, None]
|
|
242
|
+
|
|
243
|
+
accumulator = accumulator.to(compute_type)
|
|
244
|
+
# -----------------------------------------------------------
|
|
245
|
+
# Write back the block of the output
|
|
246
|
+
offs_cn = pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N)
|
|
247
|
+
c_ptrs = c_ptr + stride_cm * offs_token[:, None] + stride_cn * offs_cn[
|
|
248
|
+
None, :]
|
|
249
|
+
c_mask = token_mask[:, None] & (offs_cn[None, :] < N)
|
|
250
|
+
tl.store(c_ptrs, accumulator, mask=c_mask)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@triton.jit
|
|
254
|
+
def fused_moe_kernel(
|
|
255
|
+
# Pointers to matrices
|
|
256
|
+
a_ptr,
|
|
257
|
+
b_ptr,
|
|
258
|
+
c_ptr,
|
|
259
|
+
a_scale_ptr,
|
|
260
|
+
b_scale_ptr,
|
|
261
|
+
topk_weights_ptr,
|
|
262
|
+
sorted_token_ids_ptr,
|
|
263
|
+
expert_ids_ptr,
|
|
264
|
+
num_tokens_post_padded_ptr,
|
|
265
|
+
# Matrix dimensions
|
|
266
|
+
N,
|
|
267
|
+
K,
|
|
268
|
+
EM,
|
|
269
|
+
num_valid_tokens,
|
|
270
|
+
# The stride variables represent how much to increase the ptr by when
|
|
271
|
+
# moving by 1 element in a particular dimension. E.g. `stride_am` is
|
|
272
|
+
# how much to increase `a_ptr` by to get the element one row down
|
|
273
|
+
# (A has M rows).
|
|
274
|
+
stride_am,
|
|
275
|
+
stride_ak,
|
|
276
|
+
stride_be,
|
|
277
|
+
stride_bk,
|
|
278
|
+
stride_bn,
|
|
279
|
+
stride_cm,
|
|
280
|
+
stride_cn,
|
|
281
|
+
stride_asm,
|
|
282
|
+
stride_ask,
|
|
283
|
+
stride_bse,
|
|
284
|
+
stride_bsk,
|
|
285
|
+
stride_bsn,
|
|
286
|
+
# Block size for block-wise quantization
|
|
287
|
+
group_n: tl.constexpr,
|
|
288
|
+
group_k: tl.constexpr,
|
|
289
|
+
# Meta-parameters
|
|
290
|
+
BLOCK_SIZE_M: tl.constexpr,
|
|
291
|
+
BLOCK_SIZE_N: tl.constexpr,
|
|
292
|
+
BLOCK_SIZE_K: tl.constexpr,
|
|
293
|
+
GROUP_SIZE_M: tl.constexpr,
|
|
294
|
+
MUL_ROUTED_WEIGHT: tl.constexpr,
|
|
295
|
+
top_k: tl.constexpr,
|
|
296
|
+
compute_type: tl.constexpr,
|
|
297
|
+
use_fp8_w8a8: tl.constexpr,
|
|
298
|
+
use_int8_w8a8: tl.constexpr,
|
|
299
|
+
use_int8_w8a16: tl.constexpr,
|
|
300
|
+
per_channel_quant: tl.constexpr,
|
|
301
|
+
):
|
|
302
|
+
"""
|
|
303
|
+
Implements the fused computation for a Mixture of Experts (MOE) using
|
|
304
|
+
token and expert matrices.
|
|
305
|
+
|
|
306
|
+
Key Parameters:
|
|
307
|
+
- A: The input tensor representing tokens with shape (*, K), where '*' can
|
|
308
|
+
be any shape representing batches and K is the feature dimension of
|
|
309
|
+
each token.
|
|
310
|
+
- B: The stacked MOE weight tensor with shape (E, N, K), where E is
|
|
311
|
+
the number of experts, K is the input feature dimension, and N is
|
|
312
|
+
the output feature dimension.
|
|
313
|
+
- C: The output cache tensor with shape (M, topk, N), where M is the
|
|
314
|
+
total number of tokens post padding, topk is the number of times
|
|
315
|
+
each token is repeated, and N is the output feature dimension.
|
|
316
|
+
- sorted_token_ids: A tensor containing the sorted indices of tokens,
|
|
317
|
+
repeated topk times and arranged by the expert index they are
|
|
318
|
+
assigned to.
|
|
319
|
+
- expert_ids: A tensor containing the indices of the expert for each
|
|
320
|
+
block. It determines which expert matrix from B should be used for
|
|
321
|
+
each block in A.
|
|
322
|
+
This kernel performs the multiplication of a token by its corresponding
|
|
323
|
+
expert matrix as determined by `expert_ids`. The sorting of
|
|
324
|
+
`sorted_token_ids` by expert index and padding ensures divisibility by
|
|
325
|
+
BLOCK_SIZE_M, which is necessary to maintain consistency in block matrix
|
|
326
|
+
multiplication across different blocks processed by the same expert.
|
|
327
|
+
"""
|
|
328
|
+
# -----------------------------------------------------------
|
|
329
|
+
# Map program ids `pid` to the block of C it should compute.
|
|
330
|
+
# This is done in a grouped ordering to promote L2 data reuse.
|
|
331
|
+
pid = tl.program_id(axis=0)
|
|
332
|
+
num_pid_m = tl.cdiv(EM, BLOCK_SIZE_M)
|
|
333
|
+
num_pid_n = tl.cdiv(N, BLOCK_SIZE_N)
|
|
334
|
+
num_pid_in_group = GROUP_SIZE_M * num_pid_n
|
|
335
|
+
group_id = pid // num_pid_in_group
|
|
336
|
+
first_pid_m = group_id * GROUP_SIZE_M
|
|
337
|
+
group_size_m = min(num_pid_m - first_pid_m, GROUP_SIZE_M)
|
|
338
|
+
pid_m = first_pid_m + ((pid % num_pid_in_group) % group_size_m)
|
|
339
|
+
pid_n = (pid % num_pid_in_group) // group_size_m
|
|
340
|
+
|
|
341
|
+
# ----------------------------------------------------------
|
|
342
|
+
# Create pointers for the first blocks of A and B.
|
|
343
|
+
# We will advance this pointer as we move in the K direction
|
|
344
|
+
# and accumulate
|
|
345
|
+
# `a_ptrs` is a block of [BLOCK_SIZE_M, BLOCK_SIZE_K] pointers
|
|
346
|
+
# `b_ptrs` is a block of [BLOCK_SIZE_K, BLOCK_SIZE_N] pointers
|
|
347
|
+
num_tokens_post_padded = tl.load(num_tokens_post_padded_ptr)
|
|
348
|
+
if pid_m * BLOCK_SIZE_M >= num_tokens_post_padded:
|
|
349
|
+
return
|
|
350
|
+
offs_token_id = pid_m * BLOCK_SIZE_M + tl.arange(0, BLOCK_SIZE_M).to(
|
|
351
|
+
tl.int64)
|
|
352
|
+
offs_token = tl.load(sorted_token_ids_ptr + offs_token_id)
|
|
353
|
+
token_mask = offs_token < num_valid_tokens
|
|
354
|
+
|
|
355
|
+
off_experts = tl.load(expert_ids_ptr + pid_m).to(tl.int64)
|
|
356
|
+
if off_experts == -1:
|
|
357
|
+
# -----------------------------------------------------------
|
|
358
|
+
# Write back zeros to the output when the expert is not
|
|
359
|
+
# in the current expert parallel rank.
|
|
360
|
+
write_zeros_to_output(c_ptr, stride_cm, stride_cn, pid_n, N,
|
|
361
|
+
offs_token, token_mask, BLOCK_SIZE_M,
|
|
362
|
+
BLOCK_SIZE_N, compute_type)
|
|
363
|
+
return
|
|
364
|
+
|
|
365
|
+
offs_bn = (pid_n * BLOCK_SIZE_N +
|
|
366
|
+
tl.arange(0, BLOCK_SIZE_N).to(tl.int64)) % N
|
|
367
|
+
offs_k = tl.arange(0, BLOCK_SIZE_K)
|
|
368
|
+
a_ptrs = a_ptr + (offs_token[:, None] // top_k * stride_am +
|
|
369
|
+
offs_k[None, :] * stride_ak)
|
|
370
|
+
|
|
371
|
+
b_ptrs = b_ptr + off_experts * stride_be + (offs_k[:, None] * stride_bk +
|
|
372
|
+
offs_bn[None, :] * stride_bn)
|
|
373
|
+
if use_int8_w8a16:
|
|
374
|
+
b_scale_ptrs = b_scale_ptr + off_experts * stride_bse + offs_bn[
|
|
375
|
+
None, :] * stride_bsn
|
|
376
|
+
b_scale = tl.load(b_scale_ptrs)
|
|
377
|
+
|
|
378
|
+
if use_fp8_w8a8 or use_int8_w8a8:
|
|
379
|
+
# block-wise
|
|
380
|
+
if group_k > 0 and group_n > 0:
|
|
381
|
+
a_scale_ptrs = a_scale_ptr + (offs_token // top_k) * stride_asm
|
|
382
|
+
offs_bsn = offs_bn // group_n
|
|
383
|
+
b_scale_ptrs = (b_scale_ptr + off_experts * stride_bse +
|
|
384
|
+
offs_bsn * stride_bsn)
|
|
385
|
+
# channel-wise
|
|
386
|
+
elif per_channel_quant:
|
|
387
|
+
b_scale_ptrs = b_scale_ptr + off_experts * stride_bse + offs_bn[
|
|
388
|
+
None, :] * stride_bsn
|
|
389
|
+
b_scale = tl.load(b_scale_ptrs)
|
|
390
|
+
# Load per-token scale for activations
|
|
391
|
+
a_scale_ptrs = a_scale_ptr + (offs_token // top_k) * stride_asm
|
|
392
|
+
a_scale = tl.load(a_scale_ptrs, mask=token_mask, other=0.0)[:,
|
|
393
|
+
None]
|
|
394
|
+
# tensor-wise
|
|
395
|
+
else:
|
|
396
|
+
a_scale = tl.load(a_scale_ptr)
|
|
397
|
+
b_scale = tl.load(b_scale_ptr + off_experts)
|
|
398
|
+
|
|
399
|
+
# -----------------------------------------------------------
|
|
400
|
+
# Iterate to compute a block of the C matrix.
|
|
401
|
+
# We accumulate into a `[BLOCK_SIZE_M, BLOCK_SIZE_N]` block
|
|
402
|
+
# of fp32 values for higher accuracy.
|
|
403
|
+
# `accumulator` will be converted back to fp16 after the loop.
|
|
404
|
+
accumulator = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=tl.float32)
|
|
405
|
+
for k in range(0, tl.cdiv(K, BLOCK_SIZE_K)):
|
|
406
|
+
# Load the next block of A and B, generate a mask by checking the
|
|
407
|
+
# K dimension.
|
|
408
|
+
a = tl.load(a_ptrs,
|
|
409
|
+
mask=token_mask[:, None] &
|
|
410
|
+
(offs_k[None, :] < K - k * BLOCK_SIZE_K),
|
|
411
|
+
other=0.0)
|
|
412
|
+
b = tl.load(b_ptrs,
|
|
413
|
+
mask=offs_k[:, None] < K - k * BLOCK_SIZE_K,
|
|
414
|
+
other=0.0)
|
|
415
|
+
# We accumulate along the K dimension.
|
|
416
|
+
if use_int8_w8a16:
|
|
417
|
+
accumulator = tl.dot(a, b.to(compute_type), acc=accumulator)
|
|
418
|
+
elif use_fp8_w8a8 or use_int8_w8a8:
|
|
419
|
+
if group_k > 0 and group_n > 0:
|
|
420
|
+
k_start = k * BLOCK_SIZE_K
|
|
421
|
+
offs_ks = k_start // group_k
|
|
422
|
+
a_scale = tl.load(a_scale_ptrs + offs_ks * stride_ask,
|
|
423
|
+
mask=token_mask,
|
|
424
|
+
other=0.0)
|
|
425
|
+
b_scale = tl.load(b_scale_ptrs + offs_ks * stride_bsk)
|
|
426
|
+
|
|
427
|
+
accumulator += tl.dot(a, b) * a_scale[:,
|
|
428
|
+
None] * b_scale[None, :]
|
|
429
|
+
else:
|
|
430
|
+
if use_fp8_w8a8:
|
|
431
|
+
# acc used to enable fp8_fast_accum
|
|
432
|
+
accumulator = tl.dot(a, b, acc=accumulator)
|
|
433
|
+
else:
|
|
434
|
+
accumulator += tl.dot(a, b)
|
|
435
|
+
else:
|
|
436
|
+
accumulator += tl.dot(a, b)
|
|
437
|
+
# Advance the ptrs to the next K block.
|
|
438
|
+
a_ptrs += BLOCK_SIZE_K * stride_ak
|
|
439
|
+
b_ptrs += BLOCK_SIZE_K * stride_bk
|
|
440
|
+
|
|
441
|
+
if MUL_ROUTED_WEIGHT:
|
|
442
|
+
moe_weight = tl.load(topk_weights_ptr + offs_token,
|
|
443
|
+
mask=token_mask,
|
|
444
|
+
other=0)
|
|
445
|
+
accumulator = accumulator * moe_weight[:, None]
|
|
446
|
+
if use_int8_w8a16:
|
|
447
|
+
accumulator = (accumulator * b_scale).to(compute_type)
|
|
448
|
+
elif use_fp8_w8a8 or use_int8_w8a8:
|
|
449
|
+
if group_k > 0 and group_n > 0:
|
|
450
|
+
accumulator = accumulator.to(compute_type)
|
|
451
|
+
else:
|
|
452
|
+
accumulator = (accumulator * a_scale * b_scale).to(compute_type)
|
|
453
|
+
else:
|
|
454
|
+
accumulator = accumulator.to(compute_type)
|
|
455
|
+
# -----------------------------------------------------------
|
|
456
|
+
# Write back the block of the output
|
|
457
|
+
offs_cn = pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N)
|
|
458
|
+
c_ptrs = c_ptr + stride_cm * offs_token[:, None] + stride_cn * offs_cn[
|
|
459
|
+
None, :]
|
|
460
|
+
c_mask = token_mask[:, None] & (offs_cn[None, :] < N)
|
|
461
|
+
tl.store(c_ptrs, accumulator, mask=c_mask)
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def invoke_fused_moe_kernel(A: torch.Tensor,
|
|
465
|
+
B: torch.Tensor,
|
|
466
|
+
C: torch.Tensor,
|
|
467
|
+
A_scale: Optional[torch.Tensor],
|
|
468
|
+
B_scale: Optional[torch.Tensor],
|
|
469
|
+
B_zp: Optional[torch.Tensor],
|
|
470
|
+
topk_weights: Optional[torch.Tensor],
|
|
471
|
+
sorted_token_ids: torch.Tensor,
|
|
472
|
+
expert_ids: torch.Tensor,
|
|
473
|
+
num_tokens_post_padded: torch.Tensor,
|
|
474
|
+
mul_routed_weight: bool,
|
|
475
|
+
top_k: int,
|
|
476
|
+
config: Dict[str, Any],
|
|
477
|
+
compute_type: tl.dtype,
|
|
478
|
+
use_fp8_w8a8: bool,
|
|
479
|
+
use_int8_w8a8: bool,
|
|
480
|
+
use_int8_w8a16: bool,
|
|
481
|
+
use_int4_w4a16: bool,
|
|
482
|
+
per_channel_quant: bool,
|
|
483
|
+
block_shape: Optional[List[int]] = None) -> None:
|
|
484
|
+
assert topk_weights is not None or not mul_routed_weight
|
|
485
|
+
assert topk_weights is None or topk_weights.stride(1) == 1
|
|
486
|
+
assert sorted_token_ids.stride(0) == 1
|
|
487
|
+
|
|
488
|
+
M = A.shape[0]
|
|
489
|
+
num_tokens = M * top_k
|
|
490
|
+
|
|
491
|
+
EM = sorted_token_ids.shape[0]
|
|
492
|
+
if A.shape[0] < config["BLOCK_SIZE_M"]:
|
|
493
|
+
# optimize for small batch_size.
|
|
494
|
+
# We assume that top_ids of each token is unique, so
|
|
495
|
+
# so num_valid_experts <= batch_size <= BLOCK_SIZE_M,
|
|
496
|
+
# and we can skip some invalid blocks.
|
|
497
|
+
EM = min(sorted_token_ids.shape[0],
|
|
498
|
+
A.shape[0] * top_k * config['BLOCK_SIZE_M'])
|
|
499
|
+
grid = lambda META: (triton.cdiv(EM, META['BLOCK_SIZE_M']) * triton.cdiv(
|
|
500
|
+
B.shape[1], META['BLOCK_SIZE_N']), )
|
|
501
|
+
|
|
502
|
+
if (use_int8_w8a16 or use_int4_w4a16) and \
|
|
503
|
+
block_shape is not None and block_shape[1] > 0:
|
|
504
|
+
assert B_scale is not None and B_scale.ndim == 3
|
|
505
|
+
assert B_zp is None or B_zp.ndim == 3
|
|
506
|
+
|
|
507
|
+
use_moe_wna16_cuda = should_moe_wna16_use_cuda(
|
|
508
|
+
num_valid_tokens=num_tokens,
|
|
509
|
+
group_size=block_shape[1],
|
|
510
|
+
num_experts=B.shape[0],
|
|
511
|
+
bit=4 if use_int4_w4a16 else 8)
|
|
512
|
+
config = config.copy()
|
|
513
|
+
config.update(
|
|
514
|
+
get_moe_wna16_block_config(config=config,
|
|
515
|
+
use_moe_wna16_cuda=use_moe_wna16_cuda,
|
|
516
|
+
num_valid_tokens=num_tokens,
|
|
517
|
+
size_k=A.shape[1],
|
|
518
|
+
size_n=B.shape[1],
|
|
519
|
+
num_experts=B.shape[1],
|
|
520
|
+
group_size=block_shape[1],
|
|
521
|
+
real_top_k=top_k,
|
|
522
|
+
block_size_m=config["BLOCK_SIZE_M"]))
|
|
523
|
+
|
|
524
|
+
if use_moe_wna16_cuda:
|
|
525
|
+
bit = 4 if use_int4_w4a16 else 8
|
|
526
|
+
ops.moe_wna16_gemm(A, C, B, B_scale, B_zp,
|
|
527
|
+
topk_weights if mul_routed_weight else None,
|
|
528
|
+
sorted_token_ids, expert_ids,
|
|
529
|
+
num_tokens_post_padded, top_k,
|
|
530
|
+
config["BLOCK_SIZE_M"], config["BLOCK_SIZE_N"],
|
|
531
|
+
config["BLOCK_SIZE_K"], bit)
|
|
532
|
+
return
|
|
533
|
+
|
|
534
|
+
fused_moe_kernel_gptq_awq[grid](
|
|
535
|
+
A,
|
|
536
|
+
B,
|
|
537
|
+
C,
|
|
538
|
+
B_scale,
|
|
539
|
+
B_zp,
|
|
540
|
+
topk_weights,
|
|
541
|
+
sorted_token_ids,
|
|
542
|
+
expert_ids,
|
|
543
|
+
num_tokens_post_padded,
|
|
544
|
+
B.shape[1],
|
|
545
|
+
A.shape[1],
|
|
546
|
+
EM,
|
|
547
|
+
num_tokens,
|
|
548
|
+
A.stride(0),
|
|
549
|
+
A.stride(1),
|
|
550
|
+
B.stride(0),
|
|
551
|
+
B.stride(2),
|
|
552
|
+
B.stride(1),
|
|
553
|
+
C.stride(1),
|
|
554
|
+
C.stride(2),
|
|
555
|
+
B_scale.stride(0),
|
|
556
|
+
B_scale.stride(2),
|
|
557
|
+
B_scale.stride(1),
|
|
558
|
+
B_zp.stride(0) if B_zp is not None else 0,
|
|
559
|
+
B_zp.stride(2) if B_zp is not None else 0,
|
|
560
|
+
B_zp.stride(1) if B_zp is not None else 0,
|
|
561
|
+
block_k_diviable=A.shape[1] % config["BLOCK_SIZE_K"] == 0,
|
|
562
|
+
group_size=block_shape[1],
|
|
563
|
+
MUL_ROUTED_WEIGHT=mul_routed_weight,
|
|
564
|
+
top_k=top_k,
|
|
565
|
+
compute_type=compute_type,
|
|
566
|
+
has_zp=B_zp is not None,
|
|
567
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
568
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
569
|
+
**config,
|
|
570
|
+
)
|
|
571
|
+
else:
|
|
572
|
+
config = config.copy()
|
|
573
|
+
BLOCK_SIZE_K = config.pop("BLOCK_SIZE_K")
|
|
574
|
+
if block_shape is not None:
|
|
575
|
+
BLOCK_SIZE_K = min(BLOCK_SIZE_K, min(block_shape[0],
|
|
576
|
+
block_shape[1]))
|
|
577
|
+
fused_moe_kernel[grid](
|
|
578
|
+
A,
|
|
579
|
+
B,
|
|
580
|
+
C,
|
|
581
|
+
A_scale,
|
|
582
|
+
B_scale,
|
|
583
|
+
topk_weights,
|
|
584
|
+
sorted_token_ids,
|
|
585
|
+
expert_ids,
|
|
586
|
+
num_tokens_post_padded,
|
|
587
|
+
B.shape[1],
|
|
588
|
+
B.shape[2],
|
|
589
|
+
EM,
|
|
590
|
+
num_tokens,
|
|
591
|
+
A.stride(0),
|
|
592
|
+
A.stride(1),
|
|
593
|
+
B.stride(0),
|
|
594
|
+
B.stride(2),
|
|
595
|
+
B.stride(1),
|
|
596
|
+
C.stride(1),
|
|
597
|
+
C.stride(2),
|
|
598
|
+
A_scale.stride(0)
|
|
599
|
+
if A_scale is not None and A_scale.ndim == 2 else 0,
|
|
600
|
+
A_scale.stride(1)
|
|
601
|
+
if A_scale is not None and A_scale.ndim == 2 else 0,
|
|
602
|
+
B_scale.stride(0)
|
|
603
|
+
if B_scale is not None and B_scale.ndim >= 2 else 0,
|
|
604
|
+
B_scale.stride(2)
|
|
605
|
+
if B_scale is not None and B_scale.ndim == 3 else 0,
|
|
606
|
+
B_scale.stride(1)
|
|
607
|
+
if B_scale is not None and B_scale.ndim >= 2 else 0,
|
|
608
|
+
0 if block_shape is None else block_shape[0],
|
|
609
|
+
0 if block_shape is None else block_shape[1],
|
|
610
|
+
MUL_ROUTED_WEIGHT=mul_routed_weight,
|
|
611
|
+
top_k=top_k,
|
|
612
|
+
compute_type=compute_type,
|
|
613
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
614
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
615
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
616
|
+
per_channel_quant=per_channel_quant,
|
|
617
|
+
BLOCK_SIZE_K=BLOCK_SIZE_K,
|
|
618
|
+
**config,
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
# Adapted from: https://github.com/sgl-project/sglang/pull/2628
|
|
623
|
+
def get_config_file_name(E: int,
|
|
624
|
+
N: int,
|
|
625
|
+
dtype: Optional[str],
|
|
626
|
+
block_shape: Optional[List[int]] = None) -> str:
|
|
627
|
+
device_name = current_platform.get_device_name().replace(" ", "_")
|
|
628
|
+
dtype_selector = "" if not dtype else f",dtype={dtype}"
|
|
629
|
+
block_shape_selector = ("" if not block_shape or not all(block_shape) else
|
|
630
|
+
f",block_shape={block_shape}").replace(" ", "")
|
|
631
|
+
return f"E={E},N={N},device_name={device_name}{dtype_selector}{block_shape_selector}.json" # noqa: E501
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
# Adapted from: https://github.com/sgl-project/sglang/pull/2628
|
|
635
|
+
@functools.lru_cache
|
|
636
|
+
def get_moe_configs(
|
|
637
|
+
E: int,
|
|
638
|
+
N: int,
|
|
639
|
+
dtype: Optional[str],
|
|
640
|
+
block_n: Optional[int] = None,
|
|
641
|
+
block_k: Optional[int] = None,
|
|
642
|
+
) -> Optional[Dict[int, Any]]:
|
|
643
|
+
"""
|
|
644
|
+
Return optimized configurations for the fused MoE kernel.
|
|
645
|
+
|
|
646
|
+
The return value will be a dictionary that maps an irregular grid of
|
|
647
|
+
batch sizes to configurations of the fused_moe kernel. To evaluate the
|
|
648
|
+
kernel on a given batch size bs, the closest batch size in the grid should
|
|
649
|
+
be picked and the associated configuration chosen to invoke the kernel.
|
|
650
|
+
"""
|
|
651
|
+
|
|
652
|
+
# First look up if an optimized configuration is available in the configs
|
|
653
|
+
# directory
|
|
654
|
+
block_shape = [block_n, block_k] if block_n and block_k else None
|
|
655
|
+
json_file_name = get_config_file_name(E, N, dtype, block_shape)
|
|
656
|
+
|
|
657
|
+
config_file_path = os.path.join(
|
|
658
|
+
os.path.dirname(os.path.realpath(__file__)), "configs", json_file_name)
|
|
659
|
+
if os.path.exists(config_file_path):
|
|
660
|
+
with open(config_file_path) as f:
|
|
661
|
+
logger.info("Using configuration from %s for MoE layer.",
|
|
662
|
+
config_file_path)
|
|
663
|
+
# If a configuration has been found, return it
|
|
664
|
+
return {int(key): val for key, val in json.load(f).items()}
|
|
665
|
+
|
|
666
|
+
# If no optimized configuration is available, we will use the default
|
|
667
|
+
# configuration
|
|
668
|
+
logger.warning(
|
|
669
|
+
("Using default MoE config. Performance might be sub-optimal! "
|
|
670
|
+
"Config file not found at %s"), config_file_path)
|
|
671
|
+
return None
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
def get_moe_wna16_block_config(config: Dict[str,
|
|
675
|
+
int], use_moe_wna16_cuda: bool,
|
|
676
|
+
num_valid_tokens: int, size_k: int, size_n: int,
|
|
677
|
+
num_experts: int, group_size: int,
|
|
678
|
+
real_top_k: int, block_size_m: int):
|
|
679
|
+
if "BLOCK_SIZE_N" in config and "BLOCK_SIZE_K" in config:
|
|
680
|
+
# optimal block config is set
|
|
681
|
+
return {}
|
|
682
|
+
if not use_moe_wna16_cuda:
|
|
683
|
+
# triton moe wna16 kernel
|
|
684
|
+
if num_valid_tokens // real_top_k == 1:
|
|
685
|
+
# if bs=1, use a smaller BLOCK_SIZE_N
|
|
686
|
+
return {"BLOCK_SIZE_N": 32, "BLOCK_SIZE_K": 64}
|
|
687
|
+
else:
|
|
688
|
+
return {"BLOCK_SIZE_N": 64, "BLOCK_SIZE_K": 32}
|
|
689
|
+
else:
|
|
690
|
+
# cuda moe wna16 kernel
|
|
691
|
+
# set default block_size 128, and increase them when num_blocks
|
|
692
|
+
# is too large.
|
|
693
|
+
block_size_n = 128
|
|
694
|
+
block_size_k = 128
|
|
695
|
+
if block_size_k <= group_size:
|
|
696
|
+
block_size_k = group_size
|
|
697
|
+
|
|
698
|
+
num_n_blocks = size_k // block_size_k
|
|
699
|
+
num_k_blocks = size_n // block_size_k
|
|
700
|
+
num_m_blocks = (num_valid_tokens + block_size_m - 1) / block_size_m + \
|
|
701
|
+
num_experts
|
|
702
|
+
if num_valid_tokens // real_top_k <= block_size_m:
|
|
703
|
+
num_m_blocks = min(num_m_blocks, num_valid_tokens)
|
|
704
|
+
num_blocks = num_m_blocks * num_n_blocks * num_k_blocks
|
|
705
|
+
|
|
706
|
+
if size_k % 256 == 0 and num_blocks >= 256 and \
|
|
707
|
+
block_size_k < 256:
|
|
708
|
+
block_size_k = 256
|
|
709
|
+
num_blocks = num_blocks // (256 // block_size_k)
|
|
710
|
+
|
|
711
|
+
if num_m_blocks <= 16 and size_k % (block_size_k * 2) == 0 and \
|
|
712
|
+
size_k % (block_size_k * 2) == 0 and block_size_k <= 512 and \
|
|
713
|
+
num_blocks >= 512:
|
|
714
|
+
block_size_k = block_size_k * 2
|
|
715
|
+
num_blocks = num_blocks // 2
|
|
716
|
+
|
|
717
|
+
if num_blocks > 1024:
|
|
718
|
+
block_size_n = 256
|
|
719
|
+
num_n_blocks = num_n_blocks // 2
|
|
720
|
+
num_blocks = num_blocks // 2
|
|
721
|
+
|
|
722
|
+
if size_n <= 1024 and num_blocks >= 1024:
|
|
723
|
+
# The kernel performance got much better with BLOCK_SIZE_N=1024
|
|
724
|
+
# when num_blocks is large, event when N is small.
|
|
725
|
+
# Not sure why, maybe it force the CUDA SM process only one block
|
|
726
|
+
# at the same time.
|
|
727
|
+
block_size_n = 1024
|
|
728
|
+
|
|
729
|
+
return {"BLOCK_SIZE_N": block_size_n, "BLOCK_SIZE_K": block_size_k}
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def should_moe_wna16_use_cuda(num_valid_tokens: int, group_size: int,
|
|
733
|
+
num_experts: int, bit: int):
|
|
734
|
+
return bit == 4 and group_size in [32, 64, 128] and \
|
|
735
|
+
num_valid_tokens / num_experts <= 6
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
def get_default_config(
|
|
739
|
+
M: int,
|
|
740
|
+
E: int,
|
|
741
|
+
N: int,
|
|
742
|
+
K: int,
|
|
743
|
+
topk: int,
|
|
744
|
+
dtype: Optional[str],
|
|
745
|
+
is_marlin: bool,
|
|
746
|
+
block_shape: Optional[List[int]] = None,
|
|
747
|
+
) -> Dict[str, int]:
|
|
748
|
+
if dtype == "fp8_w8a8" and block_shape is not None:
|
|
749
|
+
# Block-wise quant: BLOCK_SIZE_N must be divisible by block_shape[0]
|
|
750
|
+
# BLOCK_SIZE_K must be divisible by block_shape[1]
|
|
751
|
+
config = {
|
|
752
|
+
"BLOCK_SIZE_M": 64,
|
|
753
|
+
"BLOCK_SIZE_N": block_shape[0],
|
|
754
|
+
"BLOCK_SIZE_K": block_shape[1],
|
|
755
|
+
"GROUP_SIZE_M": 32,
|
|
756
|
+
"num_warps": 4,
|
|
757
|
+
"num_stages": 3,
|
|
758
|
+
}
|
|
759
|
+
elif dtype in ["int4_w4a16", "int8_w8a16"] and block_shape is not None:
|
|
760
|
+
# moe wna16 kernels
|
|
761
|
+
# only set BLOCK_SIZE_M
|
|
762
|
+
# BLOCK_SIZE_N and BLOCK_SIZE_K would be set later
|
|
763
|
+
bit = 4 if dtype == "int4_w4a16" else 8
|
|
764
|
+
use_moe_wna16_cuda = should_moe_wna16_use_cuda(M * topk,
|
|
765
|
+
block_shape[1], E, bit)
|
|
766
|
+
if use_moe_wna16_cuda:
|
|
767
|
+
config = {"BLOCK_SIZE_M": min(16, M)}
|
|
768
|
+
elif M <= 20:
|
|
769
|
+
config = {"BLOCK_SIZE_M": 16, "GROUP_SIZE_M": 1}
|
|
770
|
+
elif M <= 40:
|
|
771
|
+
config = {"BLOCK_SIZE_M": 32, "GROUP_SIZE_M": 1}
|
|
772
|
+
else:
|
|
773
|
+
config = {"BLOCK_SIZE_M": 64, "GROUP_SIZE_M": 1}
|
|
774
|
+
elif is_marlin:
|
|
775
|
+
for block_size_m in [8, 16, 32, 48, 64]:
|
|
776
|
+
if M * topk / E / block_size_m < 0.9:
|
|
777
|
+
break
|
|
778
|
+
return {"BLOCK_SIZE_M": block_size_m}
|
|
779
|
+
elif M <= E:
|
|
780
|
+
config = {
|
|
781
|
+
"BLOCK_SIZE_M": 16,
|
|
782
|
+
"BLOCK_SIZE_N": 32,
|
|
783
|
+
"BLOCK_SIZE_K": 64,
|
|
784
|
+
"GROUP_SIZE_M": 1,
|
|
785
|
+
}
|
|
786
|
+
else:
|
|
787
|
+
config = {
|
|
788
|
+
"BLOCK_SIZE_M": 64,
|
|
789
|
+
"BLOCK_SIZE_N": 64,
|
|
790
|
+
"BLOCK_SIZE_K": 32,
|
|
791
|
+
"GROUP_SIZE_M": 8,
|
|
792
|
+
}
|
|
793
|
+
return config
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
def try_get_optimal_moe_config(
|
|
797
|
+
w1_shape: Tuple[int, ...],
|
|
798
|
+
w2_shape: Tuple[int, ...],
|
|
799
|
+
top_k: int,
|
|
800
|
+
dtype: Optional[str],
|
|
801
|
+
M: int,
|
|
802
|
+
is_marlin: bool = False,
|
|
803
|
+
block_shape: Optional[List[int]] = None,
|
|
804
|
+
):
|
|
805
|
+
from vllm.model_executor.layers.fused_moe import get_config
|
|
806
|
+
override_config = get_config()
|
|
807
|
+
if override_config:
|
|
808
|
+
config = override_config
|
|
809
|
+
else:
|
|
810
|
+
# First try to load optimal config from the file
|
|
811
|
+
E, _, N = w2_shape
|
|
812
|
+
if dtype == "int4_w4a16":
|
|
813
|
+
N = N * 2
|
|
814
|
+
block_n = block_shape[0] if block_shape else 0
|
|
815
|
+
block_k = block_shape[1] if block_shape else 0
|
|
816
|
+
configs = get_moe_configs(E, N, dtype, block_n, block_k)
|
|
817
|
+
|
|
818
|
+
if configs:
|
|
819
|
+
# If an optimal configuration map has been found, look up the
|
|
820
|
+
# optimal config
|
|
821
|
+
config = configs[min(configs.keys(), key=lambda x: abs(x - M))]
|
|
822
|
+
else:
|
|
823
|
+
# Else use the default config
|
|
824
|
+
config = get_default_config(M, E, N, w1_shape[2], top_k, dtype,
|
|
825
|
+
is_marlin, block_shape)
|
|
826
|
+
return config
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
def vllm_topk_softmax(topk_weights: torch.Tensor, topk_indices: torch.Tensor,
|
|
830
|
+
token_expert_indices: torch.Tensor,
|
|
831
|
+
gating_output: torch.Tensor,
|
|
832
|
+
renormalize: bool) -> tuple[torch.Tensor, ...]:
|
|
833
|
+
ops.topk_softmax(
|
|
834
|
+
topk_weights,
|
|
835
|
+
topk_indices,
|
|
836
|
+
token_expert_indices,
|
|
837
|
+
gating_output,
|
|
838
|
+
)
|
|
839
|
+
if renormalize:
|
|
840
|
+
topk_weights = topk_weights / topk_weights.sum(dim=-1, keepdim=True)
|
|
841
|
+
|
|
842
|
+
return topk_weights, topk_indices
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
def dispatch_topk_func() -> Callable[..., tuple[torch.Tensor, ...]]:
|
|
846
|
+
if is_rocm_aiter_moe_enabled():
|
|
847
|
+
from .rocm_aiter_fused_moe import rocm_aiter_topk_softmax
|
|
848
|
+
return rocm_aiter_topk_softmax
|
|
849
|
+
return vllm_topk_softmax
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
def fused_topk(
|
|
853
|
+
hidden_states: torch.Tensor,
|
|
854
|
+
gating_output: torch.Tensor,
|
|
855
|
+
topk: int,
|
|
856
|
+
renormalize: bool,
|
|
857
|
+
) -> Tuple[torch.Tensor, torch.Tensor]:
|
|
858
|
+
assert hidden_states.shape[0] == gating_output.shape[0], (
|
|
859
|
+
"Number of tokens mismatch")
|
|
860
|
+
|
|
861
|
+
M, _ = hidden_states.shape
|
|
862
|
+
|
|
863
|
+
topk_weights = torch.empty(M,
|
|
864
|
+
topk,
|
|
865
|
+
dtype=torch.float32,
|
|
866
|
+
device=hidden_states.device)
|
|
867
|
+
topk_ids = torch.empty(M,
|
|
868
|
+
topk,
|
|
869
|
+
dtype=torch.int32,
|
|
870
|
+
device=hidden_states.device)
|
|
871
|
+
token_expert_indicies = torch.empty(M,
|
|
872
|
+
topk,
|
|
873
|
+
dtype=torch.int32,
|
|
874
|
+
device=hidden_states.device)
|
|
875
|
+
|
|
876
|
+
gating_output_float = gating_output.float() # TODO(woosuk): Optimize this.
|
|
877
|
+
|
|
878
|
+
topk_func = dispatch_topk_func()
|
|
879
|
+
topk_weights, topk_ids = topk_func(topk_weights, topk_ids,
|
|
880
|
+
token_expert_indicies,
|
|
881
|
+
gating_output_float, renormalize)
|
|
882
|
+
|
|
883
|
+
del token_expert_indicies # Not used. Will be used in the future.
|
|
884
|
+
return topk_weights, topk_ids
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
# This is used by the Deepseek-V2 and Deepseek-V3 model
|
|
888
|
+
@torch.compile(dynamic=True, backend=current_platform.simple_compile_backend)
|
|
889
|
+
def grouped_topk(
|
|
890
|
+
hidden_states: torch.Tensor,
|
|
891
|
+
gating_output: torch.Tensor,
|
|
892
|
+
topk: int,
|
|
893
|
+
renormalize: bool,
|
|
894
|
+
num_expert_group: int = 0,
|
|
895
|
+
topk_group: int = 0,
|
|
896
|
+
scoring_func: str = "softmax",
|
|
897
|
+
e_score_correction_bias: Optional[torch.Tensor] = None
|
|
898
|
+
) -> Tuple[torch.Tensor, torch.Tensor]:
|
|
899
|
+
|
|
900
|
+
assert hidden_states.shape[0] == gating_output.shape[0], (
|
|
901
|
+
"Number of tokens mismatch")
|
|
902
|
+
|
|
903
|
+
if scoring_func == "softmax":
|
|
904
|
+
scores = torch.softmax(gating_output, dim=-1)
|
|
905
|
+
elif scoring_func == "sigmoid":
|
|
906
|
+
scores = gating_output.sigmoid()
|
|
907
|
+
else:
|
|
908
|
+
raise ValueError(f"Unsupported scoring function: {scoring_func}")
|
|
909
|
+
|
|
910
|
+
num_token = scores.shape[0]
|
|
911
|
+
if e_score_correction_bias is not None:
|
|
912
|
+
# Store original scores before applying correction bias. We use biased
|
|
913
|
+
# scores for expert selection but original scores for routing weights
|
|
914
|
+
original_scores = scores
|
|
915
|
+
scores = scores + e_score_correction_bias.unsqueeze(0)
|
|
916
|
+
group_scores = (scores.view(num_token, num_expert_group,
|
|
917
|
+
-1).topk(2, dim=-1)[0].sum(dim=-1))
|
|
918
|
+
else:
|
|
919
|
+
group_scores = scores.view(num_token, num_expert_group,
|
|
920
|
+
-1).max(dim=-1).values # [n, n_group]
|
|
921
|
+
group_idx = torch.topk(group_scores, k=topk_group, dim=-1,
|
|
922
|
+
sorted=False)[1] # [n, top_k_group]
|
|
923
|
+
group_mask = torch.zeros_like(group_scores) # [n, n_group]
|
|
924
|
+
group_mask.scatter_(1, group_idx, 1) # [n, n_group]
|
|
925
|
+
score_mask = group_mask.unsqueeze(-1).expand(
|
|
926
|
+
num_token, num_expert_group,
|
|
927
|
+
scores.shape[-1] // num_expert_group).reshape(num_token, -1) # [n, e]
|
|
928
|
+
tmp_scores = scores.masked_fill(~score_mask.bool(),
|
|
929
|
+
float("-inf")) # [n, e]
|
|
930
|
+
|
|
931
|
+
if e_score_correction_bias is not None:
|
|
932
|
+
topk_ids = torch.topk(tmp_scores, k=topk, dim=-1, sorted=False)[1]
|
|
933
|
+
# Use original unbiased scores for the routing weights
|
|
934
|
+
topk_weights = original_scores.gather(1, topk_ids)
|
|
935
|
+
else:
|
|
936
|
+
topk_weights, topk_ids = torch.topk(tmp_scores,
|
|
937
|
+
k=topk,
|
|
938
|
+
dim=-1,
|
|
939
|
+
sorted=False)
|
|
940
|
+
|
|
941
|
+
if renormalize:
|
|
942
|
+
topk_weights = topk_weights / topk_weights.sum(dim=-1, keepdim=True)
|
|
943
|
+
|
|
944
|
+
return topk_weights.to(torch.float32), topk_ids.to(torch.int32)
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
def get_config_dtype_str(
|
|
948
|
+
dtype: torch.dtype,
|
|
949
|
+
use_int4_w4a16: Optional[bool] = False,
|
|
950
|
+
use_int8_w8a16: Optional[bool] = False,
|
|
951
|
+
use_fp8_w8a8: Optional[bool] = False) -> Optional[str]:
|
|
952
|
+
if use_fp8_w8a8:
|
|
953
|
+
return "fp8_w8a8"
|
|
954
|
+
elif use_int8_w8a16:
|
|
955
|
+
return "int8_w8a16"
|
|
956
|
+
elif use_int4_w4a16:
|
|
957
|
+
return "int4_w4a16"
|
|
958
|
+
elif dtype == torch.float:
|
|
959
|
+
# avoiding cases where kernel fails when float32 MoE
|
|
960
|
+
# use fp16/bfloat16 configs
|
|
961
|
+
return "float32"
|
|
962
|
+
return None
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
def inplace_fused_experts(hidden_states: torch.Tensor,
|
|
966
|
+
w1: torch.Tensor,
|
|
967
|
+
w2: torch.Tensor,
|
|
968
|
+
topk_weights: torch.Tensor,
|
|
969
|
+
topk_ids: torch.Tensor,
|
|
970
|
+
activation: str = "silu",
|
|
971
|
+
apply_router_weight_on_input: bool = False,
|
|
972
|
+
use_fp8_w8a8: bool = False,
|
|
973
|
+
use_int8_w8a8: bool = False,
|
|
974
|
+
use_int8_w8a16: bool = False,
|
|
975
|
+
use_int4_w4a16: bool = False,
|
|
976
|
+
per_channel_quant: bool = False,
|
|
977
|
+
global_num_experts: int = -1,
|
|
978
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
979
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
980
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
981
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
982
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
983
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
984
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
985
|
+
block_shape: Optional[List[int]] = None) -> None:
|
|
986
|
+
fused_experts_impl(hidden_states, w1, w2, topk_weights, topk_ids, True,
|
|
987
|
+
activation, apply_router_weight_on_input, use_fp8_w8a8,
|
|
988
|
+
use_int8_w8a8, use_int8_w8a16, use_int4_w4a16,
|
|
989
|
+
per_channel_quant, global_num_experts, expert_map,
|
|
990
|
+
w1_scale, w2_scale, w1_zp, w2_zp, a1_scale, a2_scale,
|
|
991
|
+
block_shape)
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
def inplace_fused_experts_fake(
|
|
995
|
+
hidden_states: torch.Tensor,
|
|
996
|
+
w1: torch.Tensor,
|
|
997
|
+
w2: torch.Tensor,
|
|
998
|
+
topk_weights: torch.Tensor,
|
|
999
|
+
topk_ids: torch.Tensor,
|
|
1000
|
+
activation: str = "silu",
|
|
1001
|
+
apply_router_weight_on_input: bool = False,
|
|
1002
|
+
use_fp8_w8a8: bool = False,
|
|
1003
|
+
use_int8_w8a8: bool = False,
|
|
1004
|
+
use_int8_w8a16: bool = False,
|
|
1005
|
+
use_int4_w4a16: bool = False,
|
|
1006
|
+
per_channel_quant: bool = False,
|
|
1007
|
+
global_num_experts: int = -1,
|
|
1008
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
1009
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
1010
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
1011
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
1012
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
1013
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
1014
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
1015
|
+
block_shape: Optional[List[int]] = None) -> None:
|
|
1016
|
+
pass
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
direct_register_custom_op(
|
|
1020
|
+
op_name="inplace_fused_experts",
|
|
1021
|
+
op_func=inplace_fused_experts,
|
|
1022
|
+
mutates_args=["hidden_states"],
|
|
1023
|
+
fake_impl=inplace_fused_experts_fake,
|
|
1024
|
+
tags=(torch.Tag.needs_fixed_stride_order, ),
|
|
1025
|
+
)
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
def outplace_fused_experts(
|
|
1029
|
+
hidden_states: torch.Tensor,
|
|
1030
|
+
w1: torch.Tensor,
|
|
1031
|
+
w2: torch.Tensor,
|
|
1032
|
+
topk_weights: torch.Tensor,
|
|
1033
|
+
topk_ids: torch.Tensor,
|
|
1034
|
+
activation: str = "silu",
|
|
1035
|
+
apply_router_weight_on_input: bool = False,
|
|
1036
|
+
use_fp8_w8a8: bool = False,
|
|
1037
|
+
use_int8_w8a8: bool = False,
|
|
1038
|
+
use_int8_w8a16: bool = False,
|
|
1039
|
+
use_int4_w4a16: bool = False,
|
|
1040
|
+
per_channel_quant: bool = False,
|
|
1041
|
+
global_num_experts: int = -1,
|
|
1042
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
1043
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
1044
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
1045
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
1046
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
1047
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
1048
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
1049
|
+
block_shape: Optional[List[int]] = None) -> torch.Tensor:
|
|
1050
|
+
return fused_experts_impl(hidden_states, w1, w2, topk_weights, topk_ids,
|
|
1051
|
+
False, activation, apply_router_weight_on_input,
|
|
1052
|
+
use_fp8_w8a8, use_int8_w8a8, use_int8_w8a16,
|
|
1053
|
+
use_int4_w4a16, per_channel_quant,
|
|
1054
|
+
global_num_experts, expert_map, w1_scale,
|
|
1055
|
+
w2_scale, w1_zp, w2_zp, a1_scale, a2_scale,
|
|
1056
|
+
block_shape)
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
def outplace_fused_experts_fake(
|
|
1060
|
+
hidden_states: torch.Tensor,
|
|
1061
|
+
w1: torch.Tensor,
|
|
1062
|
+
w2: torch.Tensor,
|
|
1063
|
+
topk_weights: torch.Tensor,
|
|
1064
|
+
topk_ids: torch.Tensor,
|
|
1065
|
+
activation: str = "silu",
|
|
1066
|
+
use_fp8_w8a8: bool = False,
|
|
1067
|
+
use_int8_w8a8: bool = False,
|
|
1068
|
+
use_int8_w8a16: bool = False,
|
|
1069
|
+
use_int4_w4a16: bool = False,
|
|
1070
|
+
per_channel_quant: bool = False,
|
|
1071
|
+
global_num_experts: int = -1,
|
|
1072
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
1073
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
1074
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
1075
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
1076
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
1077
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
1078
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
1079
|
+
block_shape: Optional[List[int]] = None) -> torch.Tensor:
|
|
1080
|
+
return torch.empty_like(hidden_states)
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
direct_register_custom_op(
|
|
1084
|
+
op_name="outplace_fused_experts",
|
|
1085
|
+
op_func=outplace_fused_experts,
|
|
1086
|
+
mutates_args=[],
|
|
1087
|
+
fake_impl=outplace_fused_experts_fake,
|
|
1088
|
+
tags=(torch.Tag.needs_fixed_stride_order, ),
|
|
1089
|
+
)
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
def torch_vllm_inplace_fused_experts(**kwargs) -> torch.Tensor:
|
|
1093
|
+
torch.ops.vllm.inplace_fused_experts(**kwargs)
|
|
1094
|
+
hidden_states = kwargs['hidden_states']
|
|
1095
|
+
return hidden_states
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
def torch_vllm_outplace_fused_experts(**kwargs) -> torch.Tensor:
|
|
1099
|
+
return torch.ops.vllm.outplace_fused_experts(**kwargs)
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
def dispatch_fused_experts_func(inplace: bool) -> Callable[..., torch.Tensor]:
|
|
1103
|
+
if is_rocm_aiter_moe_enabled():
|
|
1104
|
+
from .rocm_aiter_fused_moe import rocm_aiter_fused_experts
|
|
1105
|
+
return rocm_aiter_fused_experts
|
|
1106
|
+
if inplace:
|
|
1107
|
+
return torch_vllm_inplace_fused_experts
|
|
1108
|
+
return torch_vllm_outplace_fused_experts
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
def fused_experts(hidden_states: torch.Tensor,
|
|
1112
|
+
w1: torch.Tensor,
|
|
1113
|
+
w2: torch.Tensor,
|
|
1114
|
+
topk_weights: torch.Tensor,
|
|
1115
|
+
topk_ids: torch.Tensor,
|
|
1116
|
+
inplace: bool = False,
|
|
1117
|
+
activation: str = "silu",
|
|
1118
|
+
apply_router_weight_on_input: bool = False,
|
|
1119
|
+
use_fp8_w8a8: bool = False,
|
|
1120
|
+
use_int8_w8a8: bool = False,
|
|
1121
|
+
use_int8_w8a16: bool = False,
|
|
1122
|
+
use_int4_w4a16: bool = False,
|
|
1123
|
+
per_channel_quant: bool = False,
|
|
1124
|
+
global_num_experts: int = -1,
|
|
1125
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
1126
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
1127
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
1128
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
1129
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
1130
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
1131
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
1132
|
+
block_shape: Optional[List[int]] = None,
|
|
1133
|
+
allow_deep_gemm: bool = False) -> torch.Tensor:
|
|
1134
|
+
if (allow_deep_gemm and use_fp8_w8a8
|
|
1135
|
+
and _valid_deep_gemm(hidden_states, w1, w2, expert_map)):
|
|
1136
|
+
assert apply_router_weight_on_input is False
|
|
1137
|
+
return deep_gemm_moe_fp8(
|
|
1138
|
+
hidden_states=hidden_states,
|
|
1139
|
+
w1=w1,
|
|
1140
|
+
w2=w2,
|
|
1141
|
+
topk_weights=topk_weights,
|
|
1142
|
+
topk_ids=topk_ids,
|
|
1143
|
+
inplace=inplace,
|
|
1144
|
+
activation=activation,
|
|
1145
|
+
global_num_experts=global_num_experts,
|
|
1146
|
+
expert_map=expert_map,
|
|
1147
|
+
w1_scale=w1_scale,
|
|
1148
|
+
w2_scale=w2_scale,
|
|
1149
|
+
a1_scale=a1_scale,
|
|
1150
|
+
a2_scale=a2_scale,
|
|
1151
|
+
)
|
|
1152
|
+
else:
|
|
1153
|
+
return dispatch_fused_experts_func(inplace)(
|
|
1154
|
+
hidden_states=hidden_states,
|
|
1155
|
+
w1=w1,
|
|
1156
|
+
w2=w2,
|
|
1157
|
+
topk_weights=topk_weights,
|
|
1158
|
+
topk_ids=topk_ids,
|
|
1159
|
+
activation=activation,
|
|
1160
|
+
apply_router_weight_on_input=apply_router_weight_on_input,
|
|
1161
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1162
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1163
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1164
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1165
|
+
per_channel_quant=per_channel_quant,
|
|
1166
|
+
global_num_experts=global_num_experts,
|
|
1167
|
+
expert_map=expert_map,
|
|
1168
|
+
w1_scale=w1_scale,
|
|
1169
|
+
w2_scale=w2_scale,
|
|
1170
|
+
w1_zp=w1_zp,
|
|
1171
|
+
w2_zp=w2_zp,
|
|
1172
|
+
a1_scale=a1_scale,
|
|
1173
|
+
a2_scale=a2_scale,
|
|
1174
|
+
block_shape=block_shape)
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
def moe_kernel_prepare_input(
|
|
1178
|
+
A: torch.Tensor,
|
|
1179
|
+
B: torch.Tensor,
|
|
1180
|
+
A_scale: Optional[torch.Tensor],
|
|
1181
|
+
B_scale: Optional[torch.Tensor],
|
|
1182
|
+
use_fp8_w8a8: bool,
|
|
1183
|
+
use_int8_w8a8: bool,
|
|
1184
|
+
use_int8_w8a16: bool,
|
|
1185
|
+
use_int4_w4a16: bool,
|
|
1186
|
+
per_channel_quant: bool,
|
|
1187
|
+
block_shape: Optional[List[int]] = None,
|
|
1188
|
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
|
|
1189
|
+
if use_fp8_w8a8:
|
|
1190
|
+
assert B_scale is not None
|
|
1191
|
+
if block_shape is None:
|
|
1192
|
+
# If weights are per-channel (per_channel_quant=True), then
|
|
1193
|
+
# activations apply per-token quantization. Otherwise, assume
|
|
1194
|
+
# activation tensor-wise fp8 quantization, dynamic or static
|
|
1195
|
+
A, A_scale = ops.scaled_fp8_quant(
|
|
1196
|
+
A, A_scale, use_per_token_if_dynamic=per_channel_quant)
|
|
1197
|
+
else:
|
|
1198
|
+
# activation block-wise fp8 quantization
|
|
1199
|
+
assert len(block_shape) == 2
|
|
1200
|
+
_, block_k = block_shape[0], block_shape[1]
|
|
1201
|
+
A, A_scale = per_token_group_quant_fp8(A, block_k)
|
|
1202
|
+
assert triton.cdiv(A.shape[-1], block_k) == A_scale.shape[-1]
|
|
1203
|
+
# assert triton.cdiv(B.shape[-2], block_n) == B_scale.shape[-2]
|
|
1204
|
+
# assert triton.cdiv(B.shape[-1], block_k) == B_scale.shape[-1]
|
|
1205
|
+
elif use_int8_w8a8:
|
|
1206
|
+
assert B_scale is not None
|
|
1207
|
+
if block_shape is None:
|
|
1208
|
+
# activation channel-wise int8 quantization
|
|
1209
|
+
assert (per_channel_quant
|
|
1210
|
+
), "int8 quantization only supports block or channel-wise"
|
|
1211
|
+
A, A_scale = per_token_quant_int8(A)
|
|
1212
|
+
else:
|
|
1213
|
+
# activation block-wise int8 quantization
|
|
1214
|
+
assert len(block_shape) == 2
|
|
1215
|
+
_, block_k = block_shape[0], block_shape[1]
|
|
1216
|
+
A, A_scale = per_token_group_quant_int8(A, block_k)
|
|
1217
|
+
assert triton.cdiv(A.shape[-1], block_k) == A_scale.shape[-1]
|
|
1218
|
+
# assert triton.cdiv(B.shape[-2], block_n) == B_scale.shape[-2]
|
|
1219
|
+
# assert triton.cdiv(B.shape[-1], block_k) == B_scale.shape[-1]
|
|
1220
|
+
elif use_int8_w8a16 or use_int4_w4a16:
|
|
1221
|
+
assert B_scale is not None
|
|
1222
|
+
assert block_shape is None or block_shape[0] == 0
|
|
1223
|
+
else:
|
|
1224
|
+
assert A_scale is None
|
|
1225
|
+
assert B_scale is None
|
|
1226
|
+
|
|
1227
|
+
return A, A_scale
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
def fused_experts_impl(hidden_states: torch.Tensor,
|
|
1231
|
+
w1: torch.Tensor,
|
|
1232
|
+
w2: torch.Tensor,
|
|
1233
|
+
topk_weights: torch.Tensor,
|
|
1234
|
+
topk_ids: torch.Tensor,
|
|
1235
|
+
inplace: bool = False,
|
|
1236
|
+
activation: str = "silu",
|
|
1237
|
+
apply_router_weight_on_input: bool = False,
|
|
1238
|
+
use_fp8_w8a8: bool = False,
|
|
1239
|
+
use_int8_w8a8: bool = False,
|
|
1240
|
+
use_int8_w8a16: bool = False,
|
|
1241
|
+
use_int4_w4a16: bool = False,
|
|
1242
|
+
per_channel_quant: bool = False,
|
|
1243
|
+
global_num_experts: int = -1,
|
|
1244
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
1245
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
1246
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
1247
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
1248
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
1249
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
1250
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
1251
|
+
block_shape: Optional[List[int]] = None):
|
|
1252
|
+
# Check constraints.
|
|
1253
|
+
if use_int4_w4a16:
|
|
1254
|
+
assert hidden_states.shape[1] // 2 == w1.shape[
|
|
1255
|
+
2], "Hidden size mismatch"
|
|
1256
|
+
else:
|
|
1257
|
+
assert hidden_states.shape[1] == w1.shape[2], "Hidden size mismatch"
|
|
1258
|
+
|
|
1259
|
+
assert topk_weights.shape == topk_ids.shape, "topk shape mismatch"
|
|
1260
|
+
assert hidden_states.is_contiguous(), "Hidden_states must be contiguous"
|
|
1261
|
+
assert w1.stride(-1) == 1, "Stride of last dimension must be 1"
|
|
1262
|
+
assert w2.stride(-1) == 1, "Stride of last dimension must be 1"
|
|
1263
|
+
assert hidden_states.dtype in [
|
|
1264
|
+
torch.float32, torch.float16, torch.bfloat16
|
|
1265
|
+
]
|
|
1266
|
+
|
|
1267
|
+
num_tokens, _ = hidden_states.shape
|
|
1268
|
+
E, N, _ = w1.shape
|
|
1269
|
+
K = w2.shape[1]
|
|
1270
|
+
if global_num_experts == -1:
|
|
1271
|
+
global_num_experts = E
|
|
1272
|
+
top_k_num = topk_ids.shape[1]
|
|
1273
|
+
# We execute the fused_moe kernel in chunks to circumvent this issue:
|
|
1274
|
+
# https://github.com/vllm-project/vllm/issues/5938
|
|
1275
|
+
CHUNK_SIZE = envs.VLLM_FUSED_MOE_CHUNK_SIZE
|
|
1276
|
+
M = min(num_tokens, CHUNK_SIZE)
|
|
1277
|
+
config_dtype = get_config_dtype_str(use_fp8_w8a8=use_fp8_w8a8,
|
|
1278
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1279
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1280
|
+
dtype=hidden_states.dtype)
|
|
1281
|
+
|
|
1282
|
+
get_config_func = functools.partial(
|
|
1283
|
+
try_get_optimal_moe_config,
|
|
1284
|
+
w1.shape,
|
|
1285
|
+
w2.shape,
|
|
1286
|
+
top_k_num,
|
|
1287
|
+
config_dtype,
|
|
1288
|
+
block_shape=block_shape,
|
|
1289
|
+
)
|
|
1290
|
+
|
|
1291
|
+
config = get_config_func(M)
|
|
1292
|
+
|
|
1293
|
+
# We can reuse the memory between these because by the time we need
|
|
1294
|
+
# cache3, we're done with cache1
|
|
1295
|
+
cache13 = torch.empty(M * top_k_num * max(N, K),
|
|
1296
|
+
device=hidden_states.device,
|
|
1297
|
+
dtype=hidden_states.dtype)
|
|
1298
|
+
intermediate_cache1 = cache13[:M * top_k_num * N].view(M, top_k_num, N)
|
|
1299
|
+
intermediate_cache3 = cache13[:M * top_k_num * K].view(M, top_k_num, K)
|
|
1300
|
+
|
|
1301
|
+
# This needs separate memory since it's used concurrently with cache1
|
|
1302
|
+
intermediate_cache2 = torch.empty((M * top_k_num, N // 2),
|
|
1303
|
+
device=hidden_states.device,
|
|
1304
|
+
dtype=hidden_states.dtype)
|
|
1305
|
+
|
|
1306
|
+
if hidden_states.dtype == torch.bfloat16:
|
|
1307
|
+
compute_type = tl.bfloat16
|
|
1308
|
+
elif hidden_states.dtype == torch.float16:
|
|
1309
|
+
compute_type = tl.float16
|
|
1310
|
+
elif hidden_states.dtype == torch.float32:
|
|
1311
|
+
compute_type = tl.float32
|
|
1312
|
+
else:
|
|
1313
|
+
raise ValueError(f"Unsupported compute_type: {hidden_states.dtype}")
|
|
1314
|
+
|
|
1315
|
+
if inplace:
|
|
1316
|
+
out_hidden_states = hidden_states
|
|
1317
|
+
else:
|
|
1318
|
+
out_hidden_states = torch.empty_like(hidden_states)
|
|
1319
|
+
|
|
1320
|
+
for chunk in range((num_tokens // CHUNK_SIZE) + 1):
|
|
1321
|
+
begin_chunk_idx, end_chunk_idx = (chunk * CHUNK_SIZE,
|
|
1322
|
+
min((chunk + 1) * CHUNK_SIZE,
|
|
1323
|
+
num_tokens))
|
|
1324
|
+
curr_hidden_states = hidden_states[begin_chunk_idx:end_chunk_idx]
|
|
1325
|
+
tokens_in_chunk, _ = curr_hidden_states.shape
|
|
1326
|
+
|
|
1327
|
+
if tokens_in_chunk == 0:
|
|
1328
|
+
break
|
|
1329
|
+
|
|
1330
|
+
if tokens_in_chunk < CHUNK_SIZE and chunk > 0:
|
|
1331
|
+
# Adjust the intermediate cache size and config for the last
|
|
1332
|
+
# chunk. Note that in most cases we only have one chunk
|
|
1333
|
+
# so the cache size and config are already set correctly and
|
|
1334
|
+
# do not need to be adjusted.
|
|
1335
|
+
intermediate_cache1 = intermediate_cache1[:tokens_in_chunk]
|
|
1336
|
+
intermediate_cache2 = intermediate_cache2[:tokens_in_chunk *
|
|
1337
|
+
topk_ids.shape[1]]
|
|
1338
|
+
intermediate_cache3 = intermediate_cache3[:tokens_in_chunk]
|
|
1339
|
+
config = get_config_func(tokens_in_chunk)
|
|
1340
|
+
|
|
1341
|
+
curr_topk_ids = topk_ids[begin_chunk_idx:end_chunk_idx]
|
|
1342
|
+
curr_topk_weights = topk_weights[begin_chunk_idx:end_chunk_idx]
|
|
1343
|
+
|
|
1344
|
+
qcurr_hidden_states, qa1_scale = moe_kernel_prepare_input(
|
|
1345
|
+
A=curr_hidden_states,
|
|
1346
|
+
B=w1,
|
|
1347
|
+
A_scale=a1_scale,
|
|
1348
|
+
B_scale=w1_scale,
|
|
1349
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1350
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1351
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1352
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1353
|
+
per_channel_quant=per_channel_quant,
|
|
1354
|
+
block_shape=block_shape)
|
|
1355
|
+
|
|
1356
|
+
sorted_token_ids, expert_ids, num_tokens_post_padded = (
|
|
1357
|
+
moe_align_block_size(curr_topk_ids, config['BLOCK_SIZE_M'],
|
|
1358
|
+
global_num_experts, expert_map))
|
|
1359
|
+
|
|
1360
|
+
invoke_fused_moe_kernel(qcurr_hidden_states,
|
|
1361
|
+
w1,
|
|
1362
|
+
intermediate_cache1,
|
|
1363
|
+
qa1_scale,
|
|
1364
|
+
w1_scale,
|
|
1365
|
+
w1_zp,
|
|
1366
|
+
curr_topk_weights,
|
|
1367
|
+
sorted_token_ids,
|
|
1368
|
+
expert_ids,
|
|
1369
|
+
num_tokens_post_padded,
|
|
1370
|
+
apply_router_weight_on_input,
|
|
1371
|
+
top_k_num,
|
|
1372
|
+
config,
|
|
1373
|
+
compute_type=compute_type,
|
|
1374
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1375
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1376
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1377
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1378
|
+
per_channel_quant=per_channel_quant,
|
|
1379
|
+
block_shape=block_shape)
|
|
1380
|
+
|
|
1381
|
+
if activation == "silu":
|
|
1382
|
+
torch.ops._C.silu_and_mul(intermediate_cache2,
|
|
1383
|
+
intermediate_cache1.view(-1, N))
|
|
1384
|
+
elif activation == "gelu":
|
|
1385
|
+
torch.ops._C.gelu_and_mul(intermediate_cache2,
|
|
1386
|
+
intermediate_cache1.view(-1, N))
|
|
1387
|
+
else:
|
|
1388
|
+
raise ValueError(f"Unsupported FusedMoe activation: {activation}")
|
|
1389
|
+
|
|
1390
|
+
qintermediate_cache2, qa2_scale = moe_kernel_prepare_input(
|
|
1391
|
+
A=intermediate_cache2,
|
|
1392
|
+
B=w2,
|
|
1393
|
+
A_scale=a2_scale,
|
|
1394
|
+
B_scale=w2_scale,
|
|
1395
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1396
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1397
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1398
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1399
|
+
per_channel_quant=per_channel_quant,
|
|
1400
|
+
block_shape=block_shape)
|
|
1401
|
+
|
|
1402
|
+
invoke_fused_moe_kernel(qintermediate_cache2,
|
|
1403
|
+
w2,
|
|
1404
|
+
intermediate_cache3,
|
|
1405
|
+
qa2_scale,
|
|
1406
|
+
w2_scale,
|
|
1407
|
+
w2_zp,
|
|
1408
|
+
curr_topk_weights,
|
|
1409
|
+
sorted_token_ids,
|
|
1410
|
+
expert_ids,
|
|
1411
|
+
num_tokens_post_padded,
|
|
1412
|
+
not apply_router_weight_on_input,
|
|
1413
|
+
1,
|
|
1414
|
+
config,
|
|
1415
|
+
compute_type=compute_type,
|
|
1416
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1417
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1418
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1419
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1420
|
+
per_channel_quant=per_channel_quant,
|
|
1421
|
+
block_shape=block_shape)
|
|
1422
|
+
|
|
1423
|
+
ops.moe_sum(intermediate_cache3.view(*intermediate_cache3.shape),
|
|
1424
|
+
out_hidden_states[begin_chunk_idx:end_chunk_idx])
|
|
1425
|
+
|
|
1426
|
+
return out_hidden_states
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
def fused_moe(
|
|
1430
|
+
hidden_states: torch.Tensor,
|
|
1431
|
+
w1: torch.Tensor,
|
|
1432
|
+
w2: torch.Tensor,
|
|
1433
|
+
gating_output: torch.Tensor,
|
|
1434
|
+
topk: int,
|
|
1435
|
+
renormalize: bool,
|
|
1436
|
+
inplace: bool = False,
|
|
1437
|
+
activation: str = "silu",
|
|
1438
|
+
use_grouped_topk: bool = False,
|
|
1439
|
+
num_expert_group: Optional[int] = None,
|
|
1440
|
+
topk_group: Optional[int] = None,
|
|
1441
|
+
custom_routing_function: Optional[Callable] = None,
|
|
1442
|
+
use_fp8_w8a8: bool = False,
|
|
1443
|
+
use_int8_w8a8: bool = False,
|
|
1444
|
+
use_int8_w8a16: bool = False,
|
|
1445
|
+
use_int4_w4a16: bool = False,
|
|
1446
|
+
per_channel_quant: bool = False,
|
|
1447
|
+
global_num_experts: int = -1,
|
|
1448
|
+
expert_map: Optional[torch.Tensor] = None,
|
|
1449
|
+
w1_scale: Optional[torch.Tensor] = None,
|
|
1450
|
+
w2_scale: Optional[torch.Tensor] = None,
|
|
1451
|
+
w1_zp: Optional[torch.Tensor] = None,
|
|
1452
|
+
w2_zp: Optional[torch.Tensor] = None,
|
|
1453
|
+
a1_scale: Optional[torch.Tensor] = None,
|
|
1454
|
+
a2_scale: Optional[torch.Tensor] = None,
|
|
1455
|
+
block_shape: Optional[List[int]] = None,
|
|
1456
|
+
) -> torch.Tensor:
|
|
1457
|
+
"""
|
|
1458
|
+
This function computes a Mixture of Experts (MoE) layer using two sets of
|
|
1459
|
+
weights, w1 and w2, and top-k gating mechanism.
|
|
1460
|
+
|
|
1461
|
+
Parameters:
|
|
1462
|
+
- hidden_states (torch.Tensor): The input tensor to the MoE layer.
|
|
1463
|
+
- w1 (torch.Tensor): The first set of expert weights.
|
|
1464
|
+
- w2 (torch.Tensor): The second set of expert weights.
|
|
1465
|
+
- gating_output (torch.Tensor): The output of the gating operation
|
|
1466
|
+
(before softmax).
|
|
1467
|
+
- topk (int): The number of top-k experts to select.
|
|
1468
|
+
- renormalize (bool): If True, renormalize the top-k weights to sum to 1.
|
|
1469
|
+
- inplace (bool): If True, perform the operation in-place.
|
|
1470
|
+
Defaults to False.
|
|
1471
|
+
- activation (str): The activation function to apply after the first
|
|
1472
|
+
MoE layer.
|
|
1473
|
+
- num_expert_group: Optional[int]: additional parameter for grouped_topk
|
|
1474
|
+
- topk_group: Optional[int]: additional parameter for grouped_topk
|
|
1475
|
+
- use_grouped_topk: If True, use grouped_topk instead of fused_topk
|
|
1476
|
+
note: Deepseekv2 model uses grouped_topk
|
|
1477
|
+
- use_fp8_w8a8 (bool): If True, use fp8 arithmetic to compute the inner
|
|
1478
|
+
products for w1 and w2. Defaults to False.
|
|
1479
|
+
- use_int8_w8a8 (bool): If True, use int8 arithmetic to compute the inner
|
|
1480
|
+
products for w1 and w2. Defaults to False.
|
|
1481
|
+
- use_int8_w8a16 (bool): If True, use matmul of int8 weight and bf16/fp16
|
|
1482
|
+
activation to compute the inner products for w1 and w2.
|
|
1483
|
+
Defaults to False.
|
|
1484
|
+
- use_int4_w4a16 (bool): If True, use matmul of int4 weight and bf16/fp16
|
|
1485
|
+
activation to compute the inner products for w1 and w2.
|
|
1486
|
+
Defaults to False.
|
|
1487
|
+
- global_num_experts (int): The total number of experts in the global
|
|
1488
|
+
expert space.
|
|
1489
|
+
- expert_map (Optional[torch.Tensor]): A tensor mapping expert indices
|
|
1490
|
+
from the global expert space to the local expert space of the expert
|
|
1491
|
+
parallel shard.
|
|
1492
|
+
- w1_scale (Optional[torch.Tensor]): Optional scale to be used for
|
|
1493
|
+
w1.
|
|
1494
|
+
- w2_scale (Optional[torch.Tensor]): Optional scale to be used for
|
|
1495
|
+
w2.
|
|
1496
|
+
- a1_scale (Optional[torch.Tensor]): Optional scale to be used for
|
|
1497
|
+
a1.
|
|
1498
|
+
- a2_scale (Optional[torch.Tensor]): Optional scale to be used for
|
|
1499
|
+
a2.
|
|
1500
|
+
- block_shape: (Optional[List[int]]): Optional block size for block-wise
|
|
1501
|
+
quantization.
|
|
1502
|
+
|
|
1503
|
+
Returns:
|
|
1504
|
+
- torch.Tensor: The output tensor after applying the MoE layer.
|
|
1505
|
+
"""
|
|
1506
|
+
|
|
1507
|
+
if use_grouped_topk:
|
|
1508
|
+
assert num_expert_group is not None and topk_group is not None
|
|
1509
|
+
topk_weights, topk_ids = grouped_topk(hidden_states, gating_output,
|
|
1510
|
+
topk, renormalize,
|
|
1511
|
+
num_expert_group, topk_group)
|
|
1512
|
+
elif custom_routing_function is None:
|
|
1513
|
+
topk_weights, topk_ids = fused_topk(hidden_states, gating_output, topk,
|
|
1514
|
+
renormalize)
|
|
1515
|
+
else:
|
|
1516
|
+
topk_weights, topk_ids = custom_routing_function(
|
|
1517
|
+
hidden_states, gating_output, topk, renormalize)
|
|
1518
|
+
|
|
1519
|
+
return fused_experts(hidden_states,
|
|
1520
|
+
w1,
|
|
1521
|
+
w2,
|
|
1522
|
+
topk_weights,
|
|
1523
|
+
topk_ids,
|
|
1524
|
+
inplace=inplace,
|
|
1525
|
+
activation=activation,
|
|
1526
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1527
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1528
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1529
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1530
|
+
per_channel_quant=per_channel_quant,
|
|
1531
|
+
global_num_experts=global_num_experts,
|
|
1532
|
+
expert_map=expert_map,
|
|
1533
|
+
w1_scale=w1_scale,
|
|
1534
|
+
w2_scale=w2_scale,
|
|
1535
|
+
w1_zp=w1_zp,
|
|
1536
|
+
w2_zp=w2_zp,
|
|
1537
|
+
a1_scale=a1_scale,
|
|
1538
|
+
a2_scale=a2_scale,
|
|
1539
|
+
block_shape=block_shape)
|