vllm-cpu-amxbf16 0.11.2.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.
- vllm/_C.abi3.so +0 -0
- vllm/__init__.py +225 -0
- vllm/_aiter_ops.py +983 -0
- vllm/_bc_linter.py +54 -0
- vllm/_custom_ops.py +2863 -0
- vllm/_ipex_ops.py +457 -0
- vllm/_version.py +34 -0
- vllm/assets/__init__.py +0 -0
- vllm/assets/audio.py +43 -0
- vllm/assets/base.py +40 -0
- vllm/assets/image.py +59 -0
- vllm/assets/video.py +149 -0
- vllm/attention/__init__.py +18 -0
- vllm/attention/backends/__init__.py +0 -0
- vllm/attention/backends/abstract.py +391 -0
- vllm/attention/backends/registry.py +195 -0
- vllm/attention/backends/utils.py +33 -0
- vllm/attention/layer.py +1052 -0
- vllm/attention/layers/__init__.py +0 -0
- vllm/attention/layers/chunked_local_attention.py +121 -0
- vllm/attention/layers/cross_attention.py +178 -0
- vllm/attention/layers/encoder_only_attention.py +103 -0
- vllm/attention/ops/__init__.py +0 -0
- vllm/attention/ops/chunked_prefill_paged_decode.py +401 -0
- vllm/attention/ops/common.py +414 -0
- vllm/attention/ops/flashmla.py +251 -0
- vllm/attention/ops/merge_attn_states.py +47 -0
- vllm/attention/ops/paged_attn.py +262 -0
- vllm/attention/ops/pallas_kv_cache_update.py +130 -0
- vllm/attention/ops/prefix_prefill.py +814 -0
- vllm/attention/ops/rocm_aiter_paged_attn.py +123 -0
- vllm/attention/ops/triton_decode_attention.py +712 -0
- vllm/attention/ops/triton_merge_attn_states.py +105 -0
- vllm/attention/ops/triton_reshape_and_cache_flash.py +184 -0
- vllm/attention/ops/triton_unified_attention.py +941 -0
- vllm/attention/ops/vit_attn_wrappers.py +178 -0
- vllm/attention/selector.py +231 -0
- vllm/attention/utils/__init__.py +0 -0
- vllm/attention/utils/fa_utils.py +109 -0
- vllm/attention/utils/kv_sharing_utils.py +33 -0
- vllm/attention/utils/kv_transfer_utils.py +60 -0
- vllm/beam_search.py +88 -0
- vllm/benchmarks/__init__.py +0 -0
- vllm/benchmarks/datasets.py +3222 -0
- vllm/benchmarks/latency.py +172 -0
- vllm/benchmarks/lib/__init__.py +3 -0
- vllm/benchmarks/lib/endpoint_request_func.py +777 -0
- vllm/benchmarks/lib/ready_checker.py +72 -0
- vllm/benchmarks/lib/utils.py +79 -0
- vllm/benchmarks/serve.py +1531 -0
- vllm/benchmarks/sweep/__init__.py +0 -0
- vllm/benchmarks/sweep/cli.py +38 -0
- vllm/benchmarks/sweep/param_sweep.py +91 -0
- vllm/benchmarks/sweep/plot.py +580 -0
- vllm/benchmarks/sweep/serve.py +416 -0
- vllm/benchmarks/sweep/serve_sla.py +492 -0
- vllm/benchmarks/sweep/server.py +114 -0
- vllm/benchmarks/sweep/sla_sweep.py +132 -0
- vllm/benchmarks/sweep/utils.py +4 -0
- vllm/benchmarks/throughput.py +799 -0
- vllm/collect_env.py +857 -0
- vllm/compilation/__init__.py +0 -0
- vllm/compilation/activation_quant_fusion.py +209 -0
- vllm/compilation/backends.py +759 -0
- vllm/compilation/base_static_graph.py +57 -0
- vllm/compilation/caching.py +178 -0
- vllm/compilation/collective_fusion.py +1234 -0
- vllm/compilation/compiler_interface.py +639 -0
- vllm/compilation/counter.py +48 -0
- vllm/compilation/cuda_graph.py +208 -0
- vllm/compilation/decorators.py +571 -0
- vllm/compilation/fix_functionalization.py +253 -0
- vllm/compilation/fusion.py +374 -0
- vllm/compilation/fusion_attn.py +359 -0
- vllm/compilation/fx_utils.py +91 -0
- vllm/compilation/inductor_pass.py +133 -0
- vllm/compilation/matcher_utils.py +317 -0
- vllm/compilation/monitor.py +62 -0
- vllm/compilation/noop_elimination.py +134 -0
- vllm/compilation/partition_rules.py +72 -0
- vllm/compilation/pass_manager.py +135 -0
- vllm/compilation/piecewise_backend.py +121 -0
- vllm/compilation/post_cleanup.py +21 -0
- vllm/compilation/qk_norm_rope_fusion.py +238 -0
- vllm/compilation/sequence_parallelism.py +363 -0
- vllm/compilation/torch25_custom_graph_pass.py +44 -0
- vllm/compilation/vllm_inductor_pass.py +173 -0
- vllm/compilation/wrapper.py +238 -0
- vllm/config/__init__.py +102 -0
- vllm/config/cache.py +207 -0
- vllm/config/compilation.py +975 -0
- vllm/config/device.py +75 -0
- vllm/config/ec_transfer.py +110 -0
- vllm/config/kv_events.py +56 -0
- vllm/config/kv_transfer.py +114 -0
- vllm/config/load.py +124 -0
- vllm/config/lora.py +112 -0
- vllm/config/model.py +2162 -0
- vllm/config/multimodal.py +248 -0
- vllm/config/observability.py +123 -0
- vllm/config/parallel.py +655 -0
- vllm/config/pooler.py +122 -0
- vllm/config/scheduler.py +298 -0
- vllm/config/speculative.py +654 -0
- vllm/config/speech_to_text.py +38 -0
- vllm/config/structured_outputs.py +92 -0
- vllm/config/utils.py +178 -0
- vllm/config/vllm.py +1166 -0
- vllm/connections.py +189 -0
- vllm/device_allocator/__init__.py +0 -0
- vllm/device_allocator/cumem.py +327 -0
- vllm/distributed/__init__.py +6 -0
- vllm/distributed/communication_op.py +43 -0
- vllm/distributed/device_communicators/__init__.py +0 -0
- vllm/distributed/device_communicators/all2all.py +490 -0
- vllm/distributed/device_communicators/all_reduce_utils.py +344 -0
- vllm/distributed/device_communicators/base_device_communicator.py +297 -0
- vllm/distributed/device_communicators/cpu_communicator.py +209 -0
- vllm/distributed/device_communicators/cuda_communicator.py +340 -0
- vllm/distributed/device_communicators/cuda_wrapper.py +216 -0
- vllm/distributed/device_communicators/custom_all_reduce.py +326 -0
- vllm/distributed/device_communicators/mnnvl_compat.py +27 -0
- vllm/distributed/device_communicators/pynccl.py +386 -0
- vllm/distributed/device_communicators/pynccl_allocator.py +191 -0
- vllm/distributed/device_communicators/pynccl_wrapper.py +564 -0
- vllm/distributed/device_communicators/quick_all_reduce.py +290 -0
- vllm/distributed/device_communicators/ray_communicator.py +259 -0
- vllm/distributed/device_communicators/shm_broadcast.py +733 -0
- vllm/distributed/device_communicators/shm_object_storage.py +660 -0
- vllm/distributed/device_communicators/symm_mem.py +156 -0
- vllm/distributed/device_communicators/tpu_communicator.py +107 -0
- vllm/distributed/device_communicators/xpu_communicator.py +95 -0
- vllm/distributed/ec_transfer/__init__.py +14 -0
- vllm/distributed/ec_transfer/ec_connector/__init__.py +0 -0
- vllm/distributed/ec_transfer/ec_connector/base.py +247 -0
- vllm/distributed/ec_transfer/ec_connector/factory.py +88 -0
- vllm/distributed/ec_transfer/ec_connector/shared_storage_connector.py +201 -0
- vllm/distributed/ec_transfer/ec_transfer_state.py +42 -0
- vllm/distributed/eplb/__init__.py +8 -0
- vllm/distributed/eplb/eplb_state.py +837 -0
- vllm/distributed/eplb/rebalance_algo.py +260 -0
- vllm/distributed/eplb/rebalance_execute.py +431 -0
- vllm/distributed/kv_events.py +371 -0
- vllm/distributed/kv_transfer/README.md +29 -0
- vllm/distributed/kv_transfer/__init__.py +20 -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 +10 -0
- vllm/distributed/kv_transfer/kv_connector/factory.py +192 -0
- vllm/distributed/kv_transfer/kv_connector/utils.py +268 -0
- vllm/distributed/kv_transfer/kv_connector/v1/__init__.py +19 -0
- vllm/distributed/kv_transfer/kv_connector/v1/base.py +546 -0
- vllm/distributed/kv_transfer/kv_connector/v1/decode_bench_connector.py +419 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_connector.py +216 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/__init__.py +18 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/multi_process_adapter.py +379 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/utils.py +221 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/vllm_v1_adapter.py +1411 -0
- vllm/distributed/kv_transfer/kv_connector/v1/lmcache_mp_connector.py +867 -0
- vllm/distributed/kv_transfer/kv_connector/v1/metrics.py +189 -0
- vllm/distributed/kv_transfer/kv_connector/v1/multi_connector.py +454 -0
- vllm/distributed/kv_transfer/kv_connector/v1/nixl_connector.py +2440 -0
- vllm/distributed/kv_transfer/kv_connector/v1/offloading_connector.py +504 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_connector.py +531 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_engine.py +632 -0
- vllm/distributed/kv_transfer/kv_connector/v1/p2p/tensor_memory_pool.py +273 -0
- vllm/distributed/kv_transfer/kv_connector/v1/shared_storage_connector.py +450 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/__init__.py +0 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/base.py +179 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/mooncake_store.py +164 -0
- vllm/distributed/kv_transfer/kv_lookup_buffer/simple_buffer.py +242 -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 +295 -0
- vllm/distributed/kv_transfer/kv_pipe/pynccl_pipe.py +285 -0
- vllm/distributed/kv_transfer/kv_transfer_state.py +78 -0
- vllm/distributed/parallel_state.py +1759 -0
- vllm/distributed/tpu_distributed_utils.py +188 -0
- vllm/distributed/utils.py +543 -0
- vllm/engine/__init__.py +0 -0
- vllm/engine/arg_utils.py +2144 -0
- vllm/engine/async_llm_engine.py +6 -0
- vllm/engine/llm_engine.py +6 -0
- vllm/engine/protocol.py +170 -0
- vllm/entrypoints/__init__.py +0 -0
- vllm/entrypoints/anthropic/__init__.py +0 -0
- vllm/entrypoints/anthropic/protocol.py +162 -0
- vllm/entrypoints/anthropic/serving_messages.py +460 -0
- vllm/entrypoints/api_server.py +184 -0
- vllm/entrypoints/chat_utils.py +1690 -0
- vllm/entrypoints/cli/__init__.py +13 -0
- vllm/entrypoints/cli/benchmark/__init__.py +0 -0
- vllm/entrypoints/cli/benchmark/base.py +25 -0
- vllm/entrypoints/cli/benchmark/latency.py +21 -0
- vllm/entrypoints/cli/benchmark/main.py +56 -0
- vllm/entrypoints/cli/benchmark/serve.py +21 -0
- vllm/entrypoints/cli/benchmark/sweep.py +21 -0
- vllm/entrypoints/cli/benchmark/throughput.py +21 -0
- vllm/entrypoints/cli/collect_env.py +38 -0
- vllm/entrypoints/cli/main.py +79 -0
- vllm/entrypoints/cli/openai.py +256 -0
- vllm/entrypoints/cli/run_batch.py +68 -0
- vllm/entrypoints/cli/serve.py +249 -0
- vllm/entrypoints/cli/types.py +29 -0
- vllm/entrypoints/constants.py +10 -0
- vllm/entrypoints/context.py +572 -0
- vllm/entrypoints/dynamic_lora.py +57 -0
- vllm/entrypoints/harmony_utils.py +535 -0
- vllm/entrypoints/launcher.py +175 -0
- vllm/entrypoints/llm.py +1768 -0
- vllm/entrypoints/logger.py +84 -0
- vllm/entrypoints/openai/__init__.py +0 -0
- vllm/entrypoints/openai/api_server.py +2096 -0
- vllm/entrypoints/openai/cli_args.py +302 -0
- vllm/entrypoints/openai/orca_metrics.py +120 -0
- vllm/entrypoints/openai/protocol.py +3299 -0
- vllm/entrypoints/openai/run_batch.py +547 -0
- vllm/entrypoints/openai/serving_chat.py +1772 -0
- vllm/entrypoints/openai/serving_classification.py +235 -0
- vllm/entrypoints/openai/serving_completion.py +715 -0
- vllm/entrypoints/openai/serving_embedding.py +695 -0
- vllm/entrypoints/openai/serving_engine.py +1433 -0
- vllm/entrypoints/openai/serving_models.py +304 -0
- vllm/entrypoints/openai/serving_pooling.py +346 -0
- vllm/entrypoints/openai/serving_responses.py +2021 -0
- vllm/entrypoints/openai/serving_score.py +503 -0
- vllm/entrypoints/openai/serving_tokenization.py +203 -0
- vllm/entrypoints/openai/serving_tokens.py +269 -0
- vllm/entrypoints/openai/serving_transcription.py +148 -0
- vllm/entrypoints/openai/speech_to_text.py +405 -0
- vllm/entrypoints/openai/tool_parsers/__init__.py +142 -0
- vllm/entrypoints/openai/tool_parsers/abstract_tool_parser.py +273 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv31_tool_parser.py +390 -0
- vllm/entrypoints/openai/tool_parsers/deepseekv3_tool_parser.py +390 -0
- vllm/entrypoints/openai/tool_parsers/ernie45_tool_parser.py +210 -0
- vllm/entrypoints/openai/tool_parsers/glm4_moe_tool_parser.py +200 -0
- vllm/entrypoints/openai/tool_parsers/granite_20b_fc_tool_parser.py +273 -0
- vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py +253 -0
- vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py +494 -0
- vllm/entrypoints/openai/tool_parsers/hunyuan_a13b_tool_parser.py +420 -0
- vllm/entrypoints/openai/tool_parsers/internlm2_tool_parser.py +227 -0
- vllm/entrypoints/openai/tool_parsers/jamba_tool_parser.py +323 -0
- vllm/entrypoints/openai/tool_parsers/kimi_k2_tool_parser.py +590 -0
- vllm/entrypoints/openai/tool_parsers/llama4_pythonic_tool_parser.py +341 -0
- vllm/entrypoints/openai/tool_parsers/llama_tool_parser.py +290 -0
- vllm/entrypoints/openai/tool_parsers/longcat_tool_parser.py +37 -0
- vllm/entrypoints/openai/tool_parsers/minimax_m2_tool_parser.py +643 -0
- vllm/entrypoints/openai/tool_parsers/minimax_tool_parser.py +849 -0
- vllm/entrypoints/openai/tool_parsers/mistral_tool_parser.py +390 -0
- vllm/entrypoints/openai/tool_parsers/olmo3_tool_parser.py +366 -0
- vllm/entrypoints/openai/tool_parsers/openai_tool_parser.py +97 -0
- vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py +120 -0
- vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py +332 -0
- vllm/entrypoints/openai/tool_parsers/qwen3coder_tool_parser.py +781 -0
- vllm/entrypoints/openai/tool_parsers/qwen3xml_tool_parser.py +1316 -0
- vllm/entrypoints/openai/tool_parsers/seed_oss_tool_parser.py +744 -0
- vllm/entrypoints/openai/tool_parsers/step3_tool_parser.py +303 -0
- vllm/entrypoints/openai/tool_parsers/utils.py +229 -0
- vllm/entrypoints/openai/tool_parsers/xlam_tool_parser.py +556 -0
- vllm/entrypoints/renderer.py +409 -0
- vllm/entrypoints/responses_utils.py +77 -0
- vllm/entrypoints/sagemaker/__init__.py +4 -0
- vllm/entrypoints/sagemaker/routes.py +72 -0
- vllm/entrypoints/score_utils.py +242 -0
- vllm/entrypoints/ssl.py +78 -0
- vllm/entrypoints/tool.py +143 -0
- vllm/entrypoints/tool_server.py +209 -0
- vllm/entrypoints/utils.py +319 -0
- vllm/env_override.py +378 -0
- vllm/envs.py +1659 -0
- vllm/forward_context.py +356 -0
- vllm/inputs/__init__.py +44 -0
- vllm/inputs/data.py +359 -0
- vllm/inputs/parse.py +137 -0
- vllm/inputs/preprocess.py +727 -0
- vllm/logger.py +267 -0
- vllm/logging_utils/__init__.py +10 -0
- vllm/logging_utils/dump_input.py +83 -0
- vllm/logging_utils/formatter.py +77 -0
- vllm/logging_utils/log_time.py +34 -0
- vllm/logits_process.py +121 -0
- vllm/logprobs.py +208 -0
- vllm/lora/__init__.py +0 -0
- vllm/lora/layers/__init__.py +41 -0
- vllm/lora/layers/base.py +67 -0
- vllm/lora/layers/base_linear.py +164 -0
- vllm/lora/layers/column_parallel_linear.py +578 -0
- vllm/lora/layers/fused_moe.py +472 -0
- vllm/lora/layers/logits_processor.py +252 -0
- vllm/lora/layers/replicated_linear.py +70 -0
- vllm/lora/layers/row_parallel_linear.py +181 -0
- vllm/lora/layers/utils.py +65 -0
- vllm/lora/layers/vocal_parallel_embedding.py +166 -0
- vllm/lora/lora_weights.py +198 -0
- vllm/lora/models.py +890 -0
- vllm/lora/ops/__init__.py +0 -0
- vllm/lora/ops/ipex_ops/__init__.py +6 -0
- vllm/lora/ops/ipex_ops/lora_ops.py +57 -0
- vllm/lora/ops/torch_ops/__init__.py +20 -0
- vllm/lora/ops/torch_ops/lora_ops.py +128 -0
- vllm/lora/ops/triton_ops/README_TUNING.md +60 -0
- vllm/lora/ops/triton_ops/__init__.py +21 -0
- vllm/lora/ops/triton_ops/fused_moe_lora_op.py +641 -0
- vllm/lora/ops/triton_ops/kernel_utils.py +340 -0
- vllm/lora/ops/triton_ops/lora_expand_op.py +310 -0
- vllm/lora/ops/triton_ops/lora_kernel_metadata.py +154 -0
- vllm/lora/ops/triton_ops/lora_shrink_op.py +287 -0
- vllm/lora/ops/triton_ops/utils.py +295 -0
- vllm/lora/ops/xla_ops/__init__.py +6 -0
- vllm/lora/ops/xla_ops/lora_ops.py +141 -0
- vllm/lora/peft_helper.py +128 -0
- vllm/lora/punica_wrapper/__init__.py +10 -0
- vllm/lora/punica_wrapper/punica_base.py +492 -0
- vllm/lora/punica_wrapper/punica_cpu.py +351 -0
- vllm/lora/punica_wrapper/punica_gpu.py +411 -0
- vllm/lora/punica_wrapper/punica_selector.py +21 -0
- vllm/lora/punica_wrapper/punica_tpu.py +359 -0
- vllm/lora/punica_wrapper/punica_xpu.py +279 -0
- vllm/lora/punica_wrapper/utils.py +150 -0
- vllm/lora/request.py +100 -0
- vllm/lora/resolver.py +88 -0
- vllm/lora/utils.py +293 -0
- vllm/lora/worker_manager.py +279 -0
- vllm/model_executor/__init__.py +11 -0
- vllm/model_executor/custom_op.py +194 -0
- vllm/model_executor/layers/__init__.py +0 -0
- vllm/model_executor/layers/activation.py +569 -0
- vllm/model_executor/layers/attention_layer_base.py +35 -0
- vllm/model_executor/layers/batch_invariant.py +854 -0
- vllm/model_executor/layers/conv.py +236 -0
- vllm/model_executor/layers/fla/__init__.py +8 -0
- vllm/model_executor/layers/fla/ops/__init__.py +17 -0
- vllm/model_executor/layers/fla/ops/chunk.py +240 -0
- vllm/model_executor/layers/fla/ops/chunk_delta_h.py +344 -0
- vllm/model_executor/layers/fla/ops/chunk_o.py +183 -0
- vllm/model_executor/layers/fla/ops/chunk_scaled_dot_kkt.py +154 -0
- vllm/model_executor/layers/fla/ops/cumsum.py +280 -0
- vllm/model_executor/layers/fla/ops/fused_recurrent.py +390 -0
- vllm/model_executor/layers/fla/ops/index.py +41 -0
- vllm/model_executor/layers/fla/ops/kda.py +1351 -0
- vllm/model_executor/layers/fla/ops/l2norm.py +146 -0
- vllm/model_executor/layers/fla/ops/layernorm_guard.py +396 -0
- vllm/model_executor/layers/fla/ops/op.py +60 -0
- vllm/model_executor/layers/fla/ops/solve_tril.py +556 -0
- vllm/model_executor/layers/fla/ops/utils.py +194 -0
- vllm/model_executor/layers/fla/ops/wy_fast.py +158 -0
- vllm/model_executor/layers/fused_moe/__init__.py +106 -0
- vllm/model_executor/layers/fused_moe/all2all_utils.py +160 -0
- vllm/model_executor/layers/fused_moe/batched_deep_gemm_moe.py +406 -0
- vllm/model_executor/layers/fused_moe/batched_triton_or_deep_gemm_moe.py +180 -0
- vllm/model_executor/layers/fused_moe/config.py +916 -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=1792,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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 +146 -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=3072,device_name=NVIDIA_H200,dtype=int8_w8a16.json +146 -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=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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=1,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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=1024,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H100,dtype=fp8_w8a8.json +123 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1024,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1856,device_name=NVIDIA_H100_80GB_HBM3.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=1856,device_name=NVIDIA_L40S.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=192,device_name=NVIDIA_A100-SXM4-80GB.json +146 -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-3e.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=352,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +122 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=384,device_name=NVIDIA_GB200,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,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-3e,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-3e.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=704,device_name=NVIDIA_B200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=704,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +114 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128,128].json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=AMD_Instinct_MI308X.json +213 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=768,device_name=NVIDIA_GB200,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,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-3e,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=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=bf16.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=928,device_name=NVIDIA_H100_80GB_HBM3.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=128,N=928,device_name=NVIDIA_L40S.json +147 -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_B200,dtype=fp8_w8a8.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_B200.json +146 -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=1024,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1024,device_name=NVIDIA_H200.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=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.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=1792,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=16,N=2048,device_name=NVIDIA_H200.json +146 -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=float8.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=3072,device_name=NVIDIA_H200,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=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json +146 -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=float8.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=AMD_Instinct_MI300X.json +201 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=192,device_name=AMD_Instinct_MI350_OAM,dtype=fp8_w8a8.json +164 -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=160,N=192,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=320,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=384,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=384,device_name=AMD_Instinct_MI350_OAM,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=384,device_name=AMD_Instinct_MI355_OAM,dtype=fp8_w8a8.json +164 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=640,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=640,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=160,N=640,device_name=NVIDIA_H100,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_H100,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=20,N=2560,device_name=NVIDIA_H20-3e,dtype=fp8_w8a8,block_shape=[128,128].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=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_H20-3e,dtype=fp8_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=384,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +147 -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=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -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=32,N=1408,device_name=NVIDIA_B200.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=32,N=2048,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=32,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=128,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=128,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=128,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=384,N=256,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=1536,device_name=NVIDIA_B200,dtype=fp8_w8a8.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=2560,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=2560,device_name=NVIDIA_GB200,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=40,N=2560,device_name=NVIDIA_H100,dtype=fp8_w8a8,block_shape=[128,128].json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_A100-SXM4-80GB.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_GB200,dtype=fp8_w8a8.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=128,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_GB200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=256,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_GB200,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=512,device_name=NVIDIA_H200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_A100-SXM4-80GB.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_B200.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_H20-3e.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=512,N=64,device_name=NVIDIA_H200.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=62,N=128,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=256,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=256,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=512,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=62,N=512,device_name=NVIDIA_H100_80GB_HBM3.json +146 -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=1408,device_name=NVIDIA_B200.json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=1536,device_name=NVIDIA_H20,dtype=fp8_w8a8.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=3072,device_name=NVIDIA_H20,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=3072,device_name=NVIDIA_H20.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=384,device_name=NVIDIA_H20,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=384,device_name=NVIDIA_H20.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=64,N=768,device_name=NVIDIA_H100_PCIe,dtype=fp8_w8a8,block_shape=[128,128].json +147 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=768,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=896,device_name=NVIDIA_H20.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=bf16.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=64,N=8960,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json +82 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=192,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=384,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=384,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=768,device_name=AMD_Instinct_MI300X.json +200 -0
- vllm/model_executor/layers/fused_moe/configs/E=72,N=768,device_name=NVIDIA_H100_80GB_HBM3.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,block_shape=[128,128].json +154 -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/cpu_fused_moe.py +354 -0
- vllm/model_executor/layers/fused_moe/cutlass_moe.py +1052 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_moe.py +387 -0
- vllm/model_executor/layers/fused_moe/deep_gemm_utils.py +416 -0
- vllm/model_executor/layers/fused_moe/deepep_ht_prepare_finalize.py +420 -0
- vllm/model_executor/layers/fused_moe/deepep_ll_prepare_finalize.py +367 -0
- vllm/model_executor/layers/fused_moe/flashinfer_cutlass_moe.py +307 -0
- vllm/model_executor/layers/fused_moe/flashinfer_cutlass_prepare_finalize.py +362 -0
- vllm/model_executor/layers/fused_moe/flashinfer_trtllm_moe.py +192 -0
- vllm/model_executor/layers/fused_moe/fused_batched_moe.py +1012 -0
- vllm/model_executor/layers/fused_moe/fused_marlin_moe.py +792 -0
- vllm/model_executor/layers/fused_moe/fused_moe.py +2175 -0
- vllm/model_executor/layers/fused_moe/fused_moe_method_base.py +112 -0
- vllm/model_executor/layers/fused_moe/fused_moe_modular_method.py +164 -0
- vllm/model_executor/layers/fused_moe/gpt_oss_triton_kernels_moe.py +316 -0
- vllm/model_executor/layers/fused_moe/layer.py +1944 -0
- vllm/model_executor/layers/fused_moe/modular_kernel.py +1222 -0
- vllm/model_executor/layers/fused_moe/moe_align_block_size.py +174 -0
- vllm/model_executor/layers/fused_moe/moe_pallas.py +83 -0
- vllm/model_executor/layers/fused_moe/moe_permute_unpermute.py +229 -0
- vllm/model_executor/layers/fused_moe/moe_torch_iterative.py +60 -0
- vllm/model_executor/layers/fused_moe/pplx_prepare_finalize.py +362 -0
- vllm/model_executor/layers/fused_moe/prepare_finalize.py +77 -0
- vllm/model_executor/layers/fused_moe/rocm_aiter_fused_moe.py +265 -0
- vllm/model_executor/layers/fused_moe/routing_simulator.py +310 -0
- vllm/model_executor/layers/fused_moe/shared_fused_moe.py +97 -0
- vllm/model_executor/layers/fused_moe/topk_weight_and_reduce.py +171 -0
- vllm/model_executor/layers/fused_moe/triton_deep_gemm_moe.py +163 -0
- vllm/model_executor/layers/fused_moe/trtllm_moe.py +143 -0
- vllm/model_executor/layers/fused_moe/unquantized_fused_moe_method.py +578 -0
- vllm/model_executor/layers/fused_moe/utils.py +332 -0
- vllm/model_executor/layers/kda.py +448 -0
- vllm/model_executor/layers/layernorm.py +442 -0
- vllm/model_executor/layers/lightning_attn.py +729 -0
- vllm/model_executor/layers/linear.py +1424 -0
- vllm/model_executor/layers/logits_processor.py +106 -0
- vllm/model_executor/layers/mamba/__init__.py +0 -0
- vllm/model_executor/layers/mamba/abstract.py +71 -0
- vllm/model_executor/layers/mamba/linear_attn.py +402 -0
- vllm/model_executor/layers/mamba/mamba_mixer.py +535 -0
- vllm/model_executor/layers/mamba/mamba_mixer2.py +928 -0
- vllm/model_executor/layers/mamba/mamba_utils.py +225 -0
- vllm/model_executor/layers/mamba/ops/__init__.py +0 -0
- vllm/model_executor/layers/mamba/ops/causal_conv1d.py +1240 -0
- vllm/model_executor/layers/mamba/ops/layernorm_gated.py +172 -0
- vllm/model_executor/layers/mamba/ops/mamba_ssm.py +478 -0
- vllm/model_executor/layers/mamba/ops/ssd_bmm.py +211 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_scan.py +456 -0
- vllm/model_executor/layers/mamba/ops/ssd_chunk_state.py +700 -0
- vllm/model_executor/layers/mamba/ops/ssd_combined.py +230 -0
- vllm/model_executor/layers/mamba/ops/ssd_state_passing.py +157 -0
- vllm/model_executor/layers/mamba/short_conv.py +264 -0
- vllm/model_executor/layers/mla.py +168 -0
- vllm/model_executor/layers/pooler.py +817 -0
- vllm/model_executor/layers/quantization/__init__.py +174 -0
- vllm/model_executor/layers/quantization/auto_round.py +454 -0
- vllm/model_executor/layers/quantization/awq.py +277 -0
- vllm/model_executor/layers/quantization/awq_marlin.py +659 -0
- vllm/model_executor/layers/quantization/awq_triton.py +337 -0
- vllm/model_executor/layers/quantization/base_config.py +170 -0
- vllm/model_executor/layers/quantization/bitblas.py +502 -0
- vllm/model_executor/layers/quantization/bitsandbytes.py +658 -0
- vllm/model_executor/layers/quantization/compressed_tensors/__init__.py +3 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors.py +914 -0
- vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe.py +2284 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/__init__.py +35 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_24.py +392 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_scheme.py +55 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_24.py +176 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a16_nvfp4.py +124 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a4_nvfp4.py +218 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a8_fp8.py +183 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w4a8_int.py +153 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a16_fp8.py +138 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_fp8.py +200 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_w8a8_int8.py +125 -0
- vllm/model_executor/layers/quantization/compressed_tensors/schemes/compressed_tensors_wNa16.py +219 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/linear.py +260 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/module.py +173 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/schemes/__init__.py +0 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/schemes/linear_qutlass_nvfp4.py +64 -0
- vllm/model_executor/layers/quantization/compressed_tensors/transform/utils.py +13 -0
- vllm/model_executor/layers/quantization/compressed_tensors/triton_scaled_mm.py +224 -0
- vllm/model_executor/layers/quantization/compressed_tensors/utils.py +216 -0
- vllm/model_executor/layers/quantization/deepspeedfp.py +218 -0
- vllm/model_executor/layers/quantization/experts_int8.py +240 -0
- vllm/model_executor/layers/quantization/fbgemm_fp8.py +195 -0
- vllm/model_executor/layers/quantization/fp8.py +1333 -0
- vllm/model_executor/layers/quantization/fp_quant.py +420 -0
- vllm/model_executor/layers/quantization/gguf.py +643 -0
- vllm/model_executor/layers/quantization/gptq.py +393 -0
- vllm/model_executor/layers/quantization/gptq_bitblas.py +482 -0
- vllm/model_executor/layers/quantization/gptq_marlin.py +789 -0
- vllm/model_executor/layers/quantization/gptq_marlin_24.py +320 -0
- vllm/model_executor/layers/quantization/hqq_marlin.py +371 -0
- vllm/model_executor/layers/quantization/inc.py +65 -0
- vllm/model_executor/layers/quantization/input_quant_fp8.py +171 -0
- vllm/model_executor/layers/quantization/ipex_quant.py +467 -0
- vllm/model_executor/layers/quantization/kernels/__init__.py +0 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/MPLinearKernel.py +94 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/__init__.py +105 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/allspark.py +115 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/bitblas.py +323 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/conch.py +98 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/cutlass.py +119 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/dynamic_4bit.py +111 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/exllama.py +161 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/machete.py +159 -0
- vllm/model_executor/layers/quantization/kernels/mixed_precision/marlin.py +166 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/ScaledMMLinearKernel.py +73 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/__init__.py +97 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/aiter.py +120 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cpu.py +219 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/cutlass.py +140 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/triton.py +42 -0
- vllm/model_executor/layers/quantization/kernels/scaled_mm/xla.py +105 -0
- vllm/model_executor/layers/quantization/kv_cache.py +146 -0
- vllm/model_executor/layers/quantization/modelopt.py +1788 -0
- vllm/model_executor/layers/quantization/moe_wna16.py +541 -0
- vllm/model_executor/layers/quantization/mxfp4.py +1162 -0
- vllm/model_executor/layers/quantization/petit.py +320 -0
- vllm/model_executor/layers/quantization/ptpc_fp8.py +137 -0
- vllm/model_executor/layers/quantization/quark/__init__.py +0 -0
- vllm/model_executor/layers/quantization/quark/quark.py +528 -0
- vllm/model_executor/layers/quantization/quark/quark_moe.py +683 -0
- vllm/model_executor/layers/quantization/quark/schemes/__init__.py +9 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_ocp_mx.py +306 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_scheme.py +55 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_fp8.py +179 -0
- vllm/model_executor/layers/quantization/quark/schemes/quark_w8a8_int8.py +139 -0
- vllm/model_executor/layers/quantization/quark/utils.py +105 -0
- vllm/model_executor/layers/quantization/qutlass_utils.py +185 -0
- vllm/model_executor/layers/quantization/rtn.py +652 -0
- vllm/model_executor/layers/quantization/schema.py +90 -0
- vllm/model_executor/layers/quantization/torchao.py +380 -0
- vllm/model_executor/layers/quantization/tpu_int8.py +139 -0
- vllm/model_executor/layers/quantization/utils/__init__.py +6 -0
- vllm/model_executor/layers/quantization/utils/allspark_utils.py +67 -0
- vllm/model_executor/layers/quantization/utils/bitblas_utils.py +229 -0
- vllm/model_executor/layers/quantization/utils/configs/N=12288,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=12288,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=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=2112,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=2112,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=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=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=24576,K=1536,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=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=4096,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=4096,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=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/configs/README.md +3 -0
- vllm/model_executor/layers/quantization/utils/flashinfer_fp4_moe.py +89 -0
- vllm/model_executor/layers/quantization/utils/flashinfer_utils.py +298 -0
- vllm/model_executor/layers/quantization/utils/fp8_utils.py +1203 -0
- vllm/model_executor/layers/quantization/utils/gptq_utils.py +158 -0
- vllm/model_executor/layers/quantization/utils/int8_utils.py +489 -0
- vllm/model_executor/layers/quantization/utils/layer_utils.py +41 -0
- vllm/model_executor/layers/quantization/utils/machete_utils.py +56 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils.py +575 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp4.py +397 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_fp8.py +351 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test.py +161 -0
- vllm/model_executor/layers/quantization/utils/marlin_utils_test_24.py +467 -0
- vllm/model_executor/layers/quantization/utils/mxfp4_utils.py +181 -0
- vllm/model_executor/layers/quantization/utils/mxfp6_utils.py +142 -0
- vllm/model_executor/layers/quantization/utils/mxfp8_utils.py +24 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_emulation_utils.py +142 -0
- vllm/model_executor/layers/quantization/utils/nvfp4_moe_support.py +63 -0
- vllm/model_executor/layers/quantization/utils/ocp_mx_utils.py +51 -0
- vllm/model_executor/layers/quantization/utils/petit_utils.py +124 -0
- vllm/model_executor/layers/quantization/utils/quant_utils.py +687 -0
- vllm/model_executor/layers/quantization/utils/w8a8_utils.py +516 -0
- vllm/model_executor/layers/resampler.py +283 -0
- vllm/model_executor/layers/rotary_embedding/__init__.py +278 -0
- vllm/model_executor/layers/rotary_embedding/base.py +235 -0
- vllm/model_executor/layers/rotary_embedding/common.py +188 -0
- vllm/model_executor/layers/rotary_embedding/deepseek_scaling_rope.py +165 -0
- vllm/model_executor/layers/rotary_embedding/dual_chunk_rope.py +215 -0
- vllm/model_executor/layers/rotary_embedding/dynamic_ntk_alpha_rope.py +43 -0
- vllm/model_executor/layers/rotary_embedding/dynamic_ntk_scaling_rope.py +68 -0
- vllm/model_executor/layers/rotary_embedding/ernie45_vl_rope.py +75 -0
- vllm/model_executor/layers/rotary_embedding/linear_scaling_rope.py +115 -0
- vllm/model_executor/layers/rotary_embedding/llama3_rope.py +54 -0
- vllm/model_executor/layers/rotary_embedding/llama4_vision_rope.py +80 -0
- vllm/model_executor/layers/rotary_embedding/mrope.py +397 -0
- vllm/model_executor/layers/rotary_embedding/ntk_scaling_rope.py +47 -0
- vllm/model_executor/layers/rotary_embedding/phi3_long_rope_scaled_rope.py +159 -0
- vllm/model_executor/layers/rotary_embedding/yarn_scaling_rope.py +81 -0
- vllm/model_executor/layers/utils.py +251 -0
- vllm/model_executor/layers/vocab_parallel_embedding.py +558 -0
- vllm/model_executor/model_loader/__init__.py +148 -0
- vllm/model_executor/model_loader/base_loader.py +57 -0
- vllm/model_executor/model_loader/bitsandbytes_loader.py +822 -0
- vllm/model_executor/model_loader/default_loader.py +327 -0
- vllm/model_executor/model_loader/dummy_loader.py +28 -0
- vllm/model_executor/model_loader/gguf_loader.py +176 -0
- vllm/model_executor/model_loader/online_quantization.py +224 -0
- vllm/model_executor/model_loader/runai_streamer_loader.py +116 -0
- vllm/model_executor/model_loader/sharded_state_loader.py +206 -0
- vllm/model_executor/model_loader/tensorizer.py +790 -0
- vllm/model_executor/model_loader/tensorizer_loader.py +151 -0
- vllm/model_executor/model_loader/tpu.py +118 -0
- vllm/model_executor/model_loader/utils.py +288 -0
- vllm/model_executor/model_loader/weight_utils.py +1084 -0
- vllm/model_executor/models/__init__.py +44 -0
- vllm/model_executor/models/adapters.py +543 -0
- vllm/model_executor/models/afmoe.py +711 -0
- vllm/model_executor/models/aimv2.py +247 -0
- vllm/model_executor/models/apertus.py +587 -0
- vllm/model_executor/models/arcee.py +439 -0
- vllm/model_executor/models/arctic.py +635 -0
- vllm/model_executor/models/aria.py +655 -0
- vllm/model_executor/models/aya_vision.py +450 -0
- vllm/model_executor/models/baichuan.py +496 -0
- vllm/model_executor/models/bailing_moe.py +646 -0
- vllm/model_executor/models/bamba.py +522 -0
- vllm/model_executor/models/bee.py +157 -0
- vllm/model_executor/models/bert.py +925 -0
- vllm/model_executor/models/bert_with_rope.py +732 -0
- vllm/model_executor/models/blip.py +349 -0
- vllm/model_executor/models/blip2.py +695 -0
- vllm/model_executor/models/bloom.py +390 -0
- vllm/model_executor/models/chameleon.py +1120 -0
- vllm/model_executor/models/chatglm.py +498 -0
- vllm/model_executor/models/clip.py +965 -0
- vllm/model_executor/models/cohere2_vision.py +472 -0
- vllm/model_executor/models/commandr.py +473 -0
- vllm/model_executor/models/config.py +503 -0
- vllm/model_executor/models/dbrx.py +482 -0
- vllm/model_executor/models/deepencoder.py +673 -0
- vllm/model_executor/models/deepseek_eagle.py +260 -0
- vllm/model_executor/models/deepseek_mtp.py +360 -0
- vllm/model_executor/models/deepseek_ocr.py +593 -0
- vllm/model_executor/models/deepseek_v2.py +1649 -0
- vllm/model_executor/models/deepseek_vl2.py +655 -0
- vllm/model_executor/models/dots1.py +574 -0
- vllm/model_executor/models/dots_ocr.py +900 -0
- vllm/model_executor/models/ernie45.py +53 -0
- vllm/model_executor/models/ernie45_moe.py +759 -0
- vllm/model_executor/models/ernie45_vl.py +1742 -0
- vllm/model_executor/models/ernie45_vl_moe.py +803 -0
- vllm/model_executor/models/ernie_mtp.py +279 -0
- vllm/model_executor/models/exaone.py +545 -0
- vllm/model_executor/models/exaone4.py +531 -0
- vllm/model_executor/models/fairseq2_llama.py +154 -0
- vllm/model_executor/models/falcon.py +545 -0
- vllm/model_executor/models/falcon_h1.py +685 -0
- vllm/model_executor/models/flex_olmo.py +155 -0
- vllm/model_executor/models/fuyu.py +373 -0
- vllm/model_executor/models/gemma.py +426 -0
- vllm/model_executor/models/gemma2.py +439 -0
- vllm/model_executor/models/gemma3.py +571 -0
- vllm/model_executor/models/gemma3_mm.py +741 -0
- vllm/model_executor/models/gemma3n.py +1165 -0
- vllm/model_executor/models/gemma3n_mm.py +811 -0
- vllm/model_executor/models/glm.py +23 -0
- vllm/model_executor/models/glm4.py +305 -0
- vllm/model_executor/models/glm4_1v.py +1821 -0
- vllm/model_executor/models/glm4_moe.py +747 -0
- vllm/model_executor/models/glm4_moe_mtp.py +359 -0
- vllm/model_executor/models/glm4v.py +784 -0
- vllm/model_executor/models/gpt2.py +397 -0
- vllm/model_executor/models/gpt_bigcode.py +339 -0
- vllm/model_executor/models/gpt_j.py +346 -0
- vllm/model_executor/models/gpt_neox.py +344 -0
- vllm/model_executor/models/gpt_oss.py +738 -0
- vllm/model_executor/models/granite.py +516 -0
- vllm/model_executor/models/granite_speech.py +913 -0
- vllm/model_executor/models/granitemoe.py +569 -0
- vllm/model_executor/models/granitemoehybrid.py +709 -0
- vllm/model_executor/models/granitemoeshared.py +333 -0
- vllm/model_executor/models/gritlm.py +245 -0
- vllm/model_executor/models/grok1.py +558 -0
- vllm/model_executor/models/h2ovl.py +554 -0
- vllm/model_executor/models/hunyuan_v1.py +1053 -0
- vllm/model_executor/models/hyperclovax_vision.py +1166 -0
- vllm/model_executor/models/idefics2_vision_model.py +426 -0
- vllm/model_executor/models/idefics3.py +717 -0
- vllm/model_executor/models/interfaces.py +1092 -0
- vllm/model_executor/models/interfaces_base.py +214 -0
- vllm/model_executor/models/intern_vit.py +453 -0
- vllm/model_executor/models/internlm2.py +460 -0
- vllm/model_executor/models/internlm2_ve.py +142 -0
- vllm/model_executor/models/interns1.py +830 -0
- vllm/model_executor/models/interns1_vit.py +432 -0
- vllm/model_executor/models/internvl.py +1452 -0
- vllm/model_executor/models/jais.py +397 -0
- vllm/model_executor/models/jamba.py +610 -0
- vllm/model_executor/models/jina_vl.py +147 -0
- vllm/model_executor/models/keye.py +1761 -0
- vllm/model_executor/models/keye_vl1_5.py +726 -0
- vllm/model_executor/models/kimi_linear.py +663 -0
- vllm/model_executor/models/kimi_vl.py +578 -0
- vllm/model_executor/models/lfm2.py +532 -0
- vllm/model_executor/models/lfm2_moe.py +762 -0
- vllm/model_executor/models/lightonocr.py +195 -0
- vllm/model_executor/models/llama.py +732 -0
- vllm/model_executor/models/llama4.py +859 -0
- vllm/model_executor/models/llama4_eagle.py +223 -0
- vllm/model_executor/models/llama_eagle.py +218 -0
- vllm/model_executor/models/llama_eagle3.py +367 -0
- vllm/model_executor/models/llava.py +842 -0
- vllm/model_executor/models/llava_next.py +583 -0
- vllm/model_executor/models/llava_next_video.py +467 -0
- vllm/model_executor/models/llava_onevision.py +923 -0
- vllm/model_executor/models/longcat_flash.py +749 -0
- vllm/model_executor/models/longcat_flash_mtp.py +349 -0
- vllm/model_executor/models/mamba.py +276 -0
- vllm/model_executor/models/mamba2.py +289 -0
- vllm/model_executor/models/medusa.py +179 -0
- vllm/model_executor/models/midashenglm.py +827 -0
- vllm/model_executor/models/mimo.py +188 -0
- vllm/model_executor/models/mimo_mtp.py +294 -0
- vllm/model_executor/models/minicpm.py +664 -0
- vllm/model_executor/models/minicpm3.py +242 -0
- vllm/model_executor/models/minicpm_eagle.py +389 -0
- vllm/model_executor/models/minicpmo.py +768 -0
- vllm/model_executor/models/minicpmv.py +1745 -0
- vllm/model_executor/models/minimax_m2.py +552 -0
- vllm/model_executor/models/minimax_text_01.py +1012 -0
- vllm/model_executor/models/minimax_vl_01.py +396 -0
- vllm/model_executor/models/mistral3.py +637 -0
- vllm/model_executor/models/mixtral.py +621 -0
- vllm/model_executor/models/mllama4.py +1147 -0
- vllm/model_executor/models/mlp_speculator.py +235 -0
- vllm/model_executor/models/modernbert.py +450 -0
- vllm/model_executor/models/module_mapping.py +74 -0
- vllm/model_executor/models/molmo.py +1555 -0
- vllm/model_executor/models/moonvit.py +677 -0
- vllm/model_executor/models/mpt.py +335 -0
- vllm/model_executor/models/nano_nemotron_vl.py +1740 -0
- vllm/model_executor/models/nemotron.py +518 -0
- vllm/model_executor/models/nemotron_h.py +852 -0
- vllm/model_executor/models/nemotron_nas.py +491 -0
- vllm/model_executor/models/nemotron_vl.py +653 -0
- vllm/model_executor/models/nvlm_d.py +216 -0
- vllm/model_executor/models/olmo.py +414 -0
- vllm/model_executor/models/olmo2.py +454 -0
- vllm/model_executor/models/olmoe.py +498 -0
- vllm/model_executor/models/openpangu.py +1062 -0
- vllm/model_executor/models/openpangu_mtp.py +265 -0
- vllm/model_executor/models/opt.py +426 -0
- vllm/model_executor/models/orion.py +372 -0
- vllm/model_executor/models/ouro.py +516 -0
- vllm/model_executor/models/ovis.py +559 -0
- vllm/model_executor/models/ovis2_5.py +673 -0
- vllm/model_executor/models/paddleocr_vl.py +1407 -0
- vllm/model_executor/models/paligemma.py +412 -0
- vllm/model_executor/models/persimmon.py +377 -0
- vllm/model_executor/models/phi.py +374 -0
- vllm/model_executor/models/phi3.py +18 -0
- vllm/model_executor/models/phi3v.py +737 -0
- vllm/model_executor/models/phi4_multimodal.py +1447 -0
- vllm/model_executor/models/phi4mm.py +1253 -0
- vllm/model_executor/models/phi4mm_audio.py +1296 -0
- vllm/model_executor/models/phi4mm_utils.py +1907 -0
- vllm/model_executor/models/phimoe.py +675 -0
- vllm/model_executor/models/pixtral.py +1352 -0
- vllm/model_executor/models/plamo2.py +981 -0
- vllm/model_executor/models/qwen.py +368 -0
- vllm/model_executor/models/qwen2.py +541 -0
- vllm/model_executor/models/qwen2_5_omni_thinker.py +1246 -0
- vllm/model_executor/models/qwen2_5_vl.py +1613 -0
- vllm/model_executor/models/qwen2_audio.py +473 -0
- vllm/model_executor/models/qwen2_moe.py +596 -0
- vllm/model_executor/models/qwen2_rm.py +123 -0
- vllm/model_executor/models/qwen2_vl.py +1670 -0
- vllm/model_executor/models/qwen3.py +336 -0
- vllm/model_executor/models/qwen3_moe.py +744 -0
- vllm/model_executor/models/qwen3_next.py +1395 -0
- vllm/model_executor/models/qwen3_next_mtp.py +296 -0
- vllm/model_executor/models/qwen3_omni_moe_thinker.py +1721 -0
- vllm/model_executor/models/qwen3_vl.py +1673 -0
- vllm/model_executor/models/qwen3_vl_moe.py +415 -0
- vllm/model_executor/models/qwen_vl.py +802 -0
- vllm/model_executor/models/radio.py +555 -0
- vllm/model_executor/models/registry.py +1155 -0
- vllm/model_executor/models/roberta.py +259 -0
- vllm/model_executor/models/rvl.py +107 -0
- vllm/model_executor/models/seed_oss.py +497 -0
- vllm/model_executor/models/siglip.py +1174 -0
- vllm/model_executor/models/siglip2navit.py +724 -0
- vllm/model_executor/models/skyworkr1v.py +953 -0
- vllm/model_executor/models/smolvlm.py +38 -0
- vllm/model_executor/models/solar.py +502 -0
- vllm/model_executor/models/stablelm.py +359 -0
- vllm/model_executor/models/starcoder2.py +367 -0
- vllm/model_executor/models/step3_text.py +559 -0
- vllm/model_executor/models/step3_vl.py +1148 -0
- vllm/model_executor/models/swin.py +514 -0
- vllm/model_executor/models/tarsier.py +619 -0
- vllm/model_executor/models/telechat2.py +153 -0
- vllm/model_executor/models/teleflm.py +78 -0
- vllm/model_executor/models/terratorch.py +319 -0
- vllm/model_executor/models/transformers/__init__.py +127 -0
- vllm/model_executor/models/transformers/base.py +464 -0
- vllm/model_executor/models/transformers/causal.py +65 -0
- vllm/model_executor/models/transformers/legacy.py +90 -0
- vllm/model_executor/models/transformers/moe.py +318 -0
- vllm/model_executor/models/transformers/multimodal.py +411 -0
- vllm/model_executor/models/transformers/pooling.py +119 -0
- vllm/model_executor/models/transformers/utils.py +207 -0
- vllm/model_executor/models/ultravox.py +681 -0
- vllm/model_executor/models/utils.py +877 -0
- vllm/model_executor/models/vision.py +552 -0
- vllm/model_executor/models/voxtral.py +845 -0
- vllm/model_executor/models/whisper.py +959 -0
- vllm/model_executor/models/zamba2.py +986 -0
- vllm/model_executor/parameter.py +642 -0
- vllm/model_executor/utils.py +94 -0
- vllm/model_executor/warmup/__init__.py +0 -0
- vllm/model_executor/warmup/deep_gemm_warmup.py +314 -0
- vllm/model_executor/warmup/kernel_warmup.py +98 -0
- vllm/multimodal/__init__.py +40 -0
- vllm/multimodal/audio.py +118 -0
- vllm/multimodal/base.py +26 -0
- vllm/multimodal/cache.py +755 -0
- vllm/multimodal/evs.py +294 -0
- vllm/multimodal/hasher.py +106 -0
- vllm/multimodal/image.py +130 -0
- vllm/multimodal/inputs.py +1036 -0
- vllm/multimodal/parse.py +544 -0
- vllm/multimodal/processing.py +2186 -0
- vllm/multimodal/profiling.py +369 -0
- vllm/multimodal/registry.py +360 -0
- vllm/multimodal/utils.py +512 -0
- vllm/multimodal/video.py +306 -0
- vllm/outputs.py +345 -0
- vllm/platforms/__init__.py +277 -0
- vllm/platforms/cpu.py +414 -0
- vllm/platforms/cuda.py +657 -0
- vllm/platforms/interface.py +639 -0
- vllm/platforms/rocm.py +466 -0
- vllm/platforms/tpu.py +276 -0
- vllm/platforms/xpu.py +274 -0
- vllm/plugins/__init__.py +78 -0
- vllm/plugins/io_processors/__init__.py +68 -0
- vllm/plugins/io_processors/interface.py +77 -0
- vllm/plugins/lora_resolvers/__init__.py +0 -0
- vllm/plugins/lora_resolvers/filesystem_resolver.py +52 -0
- vllm/pooling_params.py +228 -0
- vllm/profiler/__init__.py +0 -0
- vllm/profiler/gpu_profiler.py +37 -0
- vllm/profiler/layerwise_profile.py +392 -0
- vllm/profiler/utils.py +151 -0
- vllm/py.typed +2 -0
- vllm/ray/__init__.py +0 -0
- vllm/ray/lazy_utils.py +26 -0
- vllm/ray/ray_env.py +79 -0
- vllm/reasoning/__init__.py +92 -0
- vllm/reasoning/abs_reasoning_parsers.py +290 -0
- vllm/reasoning/basic_parsers.py +162 -0
- vllm/reasoning/deepseek_r1_reasoning_parser.py +67 -0
- vllm/reasoning/deepseek_v3_reasoning_parser.py +62 -0
- vllm/reasoning/ernie45_reasoning_parser.py +165 -0
- vllm/reasoning/glm4_moe_reasoning_parser.py +171 -0
- vllm/reasoning/gptoss_reasoning_parser.py +173 -0
- vllm/reasoning/granite_reasoning_parser.py +363 -0
- vllm/reasoning/hunyuan_a13b_reasoning_parser.py +237 -0
- vllm/reasoning/identity_reasoning_parser.py +58 -0
- vllm/reasoning/minimax_m2_reasoning_parser.py +67 -0
- vllm/reasoning/mistral_reasoning_parser.py +55 -0
- vllm/reasoning/olmo3_reasoning_parser.py +302 -0
- vllm/reasoning/qwen3_reasoning_parser.py +67 -0
- vllm/reasoning/seedoss_reasoning_parser.py +27 -0
- vllm/reasoning/step3_reasoning_parser.py +107 -0
- vllm/sampling_params.py +669 -0
- vllm/scalar_type.py +355 -0
- vllm/scripts.py +17 -0
- vllm/sequence.py +98 -0
- vllm/tasks.py +13 -0
- vllm/third_party/__init__.py +0 -0
- vllm/third_party/pynvml.py +6140 -0
- vllm/tracing.py +135 -0
- vllm/transformers_utils/__init__.py +26 -0
- vllm/transformers_utils/chat_templates/__init__.py +5 -0
- vllm/transformers_utils/chat_templates/registry.py +73 -0
- vllm/transformers_utils/chat_templates/template_basic.jinja +3 -0
- vllm/transformers_utils/chat_templates/template_blip2.jinja +11 -0
- vllm/transformers_utils/chat_templates/template_chatml.jinja +10 -0
- vllm/transformers_utils/chat_templates/template_deepseek_ocr.jinja +14 -0
- vllm/transformers_utils/chat_templates/template_deepseek_vl2.jinja +23 -0
- vllm/transformers_utils/chat_templates/template_fuyu.jinja +3 -0
- vllm/transformers_utils/chat_templates/template_minicpmv45.jinja +93 -0
- vllm/transformers_utils/config.py +1203 -0
- vllm/transformers_utils/config_parser_base.py +20 -0
- vllm/transformers_utils/configs/__init__.py +70 -0
- vllm/transformers_utils/configs/afmoe.py +84 -0
- vllm/transformers_utils/configs/arctic.py +206 -0
- vllm/transformers_utils/configs/chatglm.py +75 -0
- vllm/transformers_utils/configs/deepseek_vl2.py +126 -0
- vllm/transformers_utils/configs/dotsocr.py +71 -0
- vllm/transformers_utils/configs/eagle.py +84 -0
- vllm/transformers_utils/configs/falcon.py +89 -0
- vllm/transformers_utils/configs/flex_olmo.py +77 -0
- vllm/transformers_utils/configs/jais.py +243 -0
- vllm/transformers_utils/configs/kimi_linear.py +144 -0
- vllm/transformers_utils/configs/kimi_vl.py +38 -0
- vllm/transformers_utils/configs/lfm2_moe.py +159 -0
- vllm/transformers_utils/configs/medusa.py +65 -0
- vllm/transformers_utils/configs/midashenglm.py +103 -0
- vllm/transformers_utils/configs/mistral.py +174 -0
- vllm/transformers_utils/configs/mlp_speculator.py +69 -0
- vllm/transformers_utils/configs/moonvit.py +33 -0
- vllm/transformers_utils/configs/nemotron.py +212 -0
- vllm/transformers_utils/configs/nemotron_h.py +282 -0
- vllm/transformers_utils/configs/olmo3.py +79 -0
- vllm/transformers_utils/configs/ovis.py +182 -0
- vllm/transformers_utils/configs/qwen3_next.py +274 -0
- vllm/transformers_utils/configs/radio.py +89 -0
- vllm/transformers_utils/configs/speculators/__init__.py +2 -0
- vllm/transformers_utils/configs/speculators/algos.py +38 -0
- vllm/transformers_utils/configs/speculators/base.py +114 -0
- vllm/transformers_utils/configs/step3_vl.py +174 -0
- vllm/transformers_utils/configs/ultravox.py +118 -0
- vllm/transformers_utils/detokenizer_utils.py +198 -0
- vllm/transformers_utils/dynamic_module.py +59 -0
- vllm/transformers_utils/processor.py +402 -0
- vllm/transformers_utils/processors/__init__.py +15 -0
- vllm/transformers_utils/processors/deepseek_ocr.py +438 -0
- vllm/transformers_utils/processors/deepseek_vl2.py +406 -0
- vllm/transformers_utils/processors/ovis.py +453 -0
- vllm/transformers_utils/processors/ovis2_5.py +468 -0
- vllm/transformers_utils/runai_utils.py +104 -0
- vllm/transformers_utils/s3_utils.py +95 -0
- vllm/transformers_utils/tokenizer.py +293 -0
- vllm/transformers_utils/tokenizer_base.py +155 -0
- vllm/transformers_utils/tokenizers/__init__.py +16 -0
- vllm/transformers_utils/tokenizers/mistral.py +502 -0
- vllm/transformers_utils/utils.py +130 -0
- vllm/triton_utils/__init__.py +19 -0
- vllm/triton_utils/importing.py +103 -0
- vllm/usage/__init__.py +0 -0
- vllm/usage/usage_lib.py +294 -0
- vllm/utils/__init__.py +82 -0
- vllm/utils/argparse_utils.py +487 -0
- vllm/utils/async_utils.py +303 -0
- vllm/utils/cache.py +214 -0
- vllm/utils/collection_utils.py +139 -0
- vllm/utils/counter.py +45 -0
- vllm/utils/deep_gemm.py +391 -0
- vllm/utils/flashinfer.py +490 -0
- vllm/utils/func_utils.py +236 -0
- vllm/utils/gc_utils.py +147 -0
- vllm/utils/hashing.py +63 -0
- vllm/utils/import_utils.py +411 -0
- vllm/utils/jsontree.py +165 -0
- vllm/utils/math_utils.py +32 -0
- vllm/utils/mem_constants.py +13 -0
- vllm/utils/mem_utils.py +232 -0
- vllm/utils/nccl.py +64 -0
- vllm/utils/network_utils.py +331 -0
- vllm/utils/platform_utils.py +59 -0
- vllm/utils/profiling.py +56 -0
- vllm/utils/registry.py +49 -0
- vllm/utils/serial_utils.py +169 -0
- vllm/utils/system_utils.py +229 -0
- vllm/utils/tensor_schema.py +255 -0
- vllm/utils/torch_utils.py +657 -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/cpu_attn.py +496 -0
- vllm/v1/attention/backends/flash_attn.py +1028 -0
- vllm/v1/attention/backends/flashinfer.py +1572 -0
- vllm/v1/attention/backends/flex_attention.py +926 -0
- vllm/v1/attention/backends/gdn_attn.py +387 -0
- vllm/v1/attention/backends/linear_attn.py +74 -0
- vllm/v1/attention/backends/mamba1_attn.py +165 -0
- vllm/v1/attention/backends/mamba2_attn.py +354 -0
- vllm/v1/attention/backends/mamba_attn.py +115 -0
- vllm/v1/attention/backends/mla/__init__.py +0 -0
- vllm/v1/attention/backends/mla/common.py +2031 -0
- vllm/v1/attention/backends/mla/cutlass_mla.py +275 -0
- vllm/v1/attention/backends/mla/flashattn_mla.py +337 -0
- vllm/v1/attention/backends/mla/flashinfer_mla.py +171 -0
- vllm/v1/attention/backends/mla/flashmla.py +314 -0
- vllm/v1/attention/backends/mla/flashmla_sparse.py +548 -0
- vllm/v1/attention/backends/mla/indexer.py +362 -0
- vllm/v1/attention/backends/mla/rocm_aiter_mla.py +294 -0
- vllm/v1/attention/backends/mla/triton_mla.py +171 -0
- vllm/v1/attention/backends/pallas.py +436 -0
- vllm/v1/attention/backends/rocm_aiter_fa.py +816 -0
- vllm/v1/attention/backends/rocm_aiter_unified_attn.py +196 -0
- vllm/v1/attention/backends/rocm_attn.py +362 -0
- vllm/v1/attention/backends/short_conv_attn.py +105 -0
- vllm/v1/attention/backends/tree_attn.py +425 -0
- vllm/v1/attention/backends/triton_attn.py +373 -0
- vllm/v1/attention/backends/utils.py +1116 -0
- vllm/v1/attention/backends/xformers.py +417 -0
- vllm/v1/core/__init__.py +0 -0
- vllm/v1/core/block_pool.py +428 -0
- vllm/v1/core/encoder_cache_manager.py +343 -0
- vllm/v1/core/kv_cache_coordinator.py +480 -0
- vllm/v1/core/kv_cache_manager.py +420 -0
- vllm/v1/core/kv_cache_utils.py +1340 -0
- vllm/v1/core/sched/__init__.py +0 -0
- vllm/v1/core/sched/async_scheduler.py +62 -0
- vllm/v1/core/sched/interface.py +181 -0
- vllm/v1/core/sched/output.py +202 -0
- vllm/v1/core/sched/request_queue.py +221 -0
- vllm/v1/core/sched/scheduler.py +1617 -0
- vllm/v1/core/sched/utils.py +72 -0
- vllm/v1/core/single_type_kv_cache_manager.py +736 -0
- vllm/v1/cudagraph_dispatcher.py +148 -0
- vllm/v1/engine/__init__.py +206 -0
- vllm/v1/engine/async_llm.py +797 -0
- vllm/v1/engine/coordinator.py +377 -0
- vllm/v1/engine/core.py +1420 -0
- vllm/v1/engine/core_client.py +1400 -0
- vllm/v1/engine/detokenizer.py +351 -0
- vllm/v1/engine/exceptions.py +18 -0
- vllm/v1/engine/llm_engine.py +408 -0
- vllm/v1/engine/logprobs.py +182 -0
- vllm/v1/engine/output_processor.py +642 -0
- vllm/v1/engine/parallel_sampling.py +145 -0
- vllm/v1/engine/processor.py +621 -0
- vllm/v1/engine/utils.py +1072 -0
- vllm/v1/executor/__init__.py +6 -0
- vllm/v1/executor/abstract.py +352 -0
- vllm/v1/executor/multiproc_executor.py +877 -0
- vllm/v1/executor/ray_distributed_executor.py +8 -0
- vllm/v1/executor/ray_executor.py +626 -0
- vllm/v1/executor/ray_utils.py +465 -0
- vllm/v1/executor/uniproc_executor.py +183 -0
- vllm/v1/kv_cache_interface.py +403 -0
- vllm/v1/kv_offload/__init__.py +0 -0
- vllm/v1/kv_offload/abstract.py +161 -0
- vllm/v1/kv_offload/arc_manager.py +237 -0
- vllm/v1/kv_offload/backend.py +97 -0
- vllm/v1/kv_offload/backends/__init__.py +0 -0
- vllm/v1/kv_offload/backends/cpu.py +62 -0
- vllm/v1/kv_offload/cpu.py +93 -0
- vllm/v1/kv_offload/factory.py +56 -0
- vllm/v1/kv_offload/lru_manager.py +139 -0
- vllm/v1/kv_offload/mediums.py +39 -0
- vllm/v1/kv_offload/spec.py +62 -0
- vllm/v1/kv_offload/worker/__init__.py +0 -0
- vllm/v1/kv_offload/worker/cpu_gpu.py +185 -0
- vllm/v1/kv_offload/worker/worker.py +144 -0
- vllm/v1/metrics/__init__.py +0 -0
- vllm/v1/metrics/loggers.py +1238 -0
- vllm/v1/metrics/prometheus.py +82 -0
- vllm/v1/metrics/ray_wrappers.py +169 -0
- vllm/v1/metrics/reader.py +257 -0
- vllm/v1/metrics/stats.py +420 -0
- vllm/v1/outputs.py +249 -0
- vllm/v1/pool/__init__.py +0 -0
- vllm/v1/pool/metadata.py +82 -0
- vllm/v1/request.py +259 -0
- vllm/v1/sample/__init__.py +0 -0
- vllm/v1/sample/logits_processor/__init__.py +352 -0
- vllm/v1/sample/logits_processor/builtin.py +274 -0
- vllm/v1/sample/logits_processor/interface.py +106 -0
- vllm/v1/sample/logits_processor/state.py +165 -0
- vllm/v1/sample/metadata.py +44 -0
- vllm/v1/sample/ops/__init__.py +0 -0
- vllm/v1/sample/ops/bad_words.py +52 -0
- vllm/v1/sample/ops/logprobs.py +25 -0
- vllm/v1/sample/ops/penalties.py +57 -0
- vllm/v1/sample/ops/topk_topp_sampler.py +290 -0
- vllm/v1/sample/rejection_sampler.py +793 -0
- vllm/v1/sample/sampler.py +316 -0
- vllm/v1/sample/tpu/__init__.py +0 -0
- vllm/v1/sample/tpu/metadata.py +120 -0
- vllm/v1/sample/tpu/sampler.py +215 -0
- vllm/v1/serial_utils.py +532 -0
- vllm/v1/spec_decode/__init__.py +0 -0
- vllm/v1/spec_decode/eagle.py +1225 -0
- vllm/v1/spec_decode/medusa.py +73 -0
- vllm/v1/spec_decode/metadata.py +66 -0
- vllm/v1/spec_decode/metrics.py +224 -0
- vllm/v1/spec_decode/ngram_proposer.py +291 -0
- vllm/v1/spec_decode/suffix_decoding.py +103 -0
- vllm/v1/spec_decode/utils.py +16 -0
- vllm/v1/structured_output/__init__.py +338 -0
- vllm/v1/structured_output/backend_guidance.py +265 -0
- vllm/v1/structured_output/backend_lm_format_enforcer.py +177 -0
- vllm/v1/structured_output/backend_outlines.py +324 -0
- vllm/v1/structured_output/backend_types.py +136 -0
- vllm/v1/structured_output/backend_xgrammar.py +362 -0
- vllm/v1/structured_output/request.py +94 -0
- vllm/v1/structured_output/utils.py +469 -0
- vllm/v1/utils.py +414 -0
- vllm/v1/worker/__init__.py +0 -0
- vllm/v1/worker/block_table.py +327 -0
- vllm/v1/worker/cpu_model_runner.py +122 -0
- vllm/v1/worker/cpu_worker.py +206 -0
- vllm/v1/worker/dp_utils.py +230 -0
- vllm/v1/worker/ec_connector_model_runner_mixin.py +87 -0
- vllm/v1/worker/gpu_input_batch.py +975 -0
- vllm/v1/worker/gpu_model_runner.py +5102 -0
- vllm/v1/worker/gpu_ubatch_wrapper.py +466 -0
- vllm/v1/worker/gpu_worker.py +894 -0
- vllm/v1/worker/kv_connector_model_runner_mixin.py +144 -0
- vllm/v1/worker/lora_model_runner_mixin.py +213 -0
- vllm/v1/worker/tpu_input_batch.py +593 -0
- vllm/v1/worker/tpu_model_runner.py +2173 -0
- vllm/v1/worker/tpu_worker.py +355 -0
- vllm/v1/worker/ubatch_utils.py +73 -0
- vllm/v1/worker/ubatching.py +231 -0
- vllm/v1/worker/utils.py +366 -0
- vllm/v1/worker/worker_base.py +375 -0
- vllm/v1/worker/xpu_model_runner.py +55 -0
- vllm/v1/worker/xpu_worker.py +189 -0
- vllm/version.py +39 -0
- vllm/vllm_flash_attn/.gitkeep +0 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/METADATA +345 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/RECORD +1536 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/WHEEL +5 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/entry_points.txt +5 -0
- vllm_cpu_amxbf16-0.11.2.post2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2175 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
3
|
+
"""Fused MoE Triton kernels."""
|
|
4
|
+
|
|
5
|
+
import functools
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import torch
|
|
12
|
+
import torch.nn.functional as F
|
|
13
|
+
|
|
14
|
+
import vllm.envs as envs
|
|
15
|
+
import vllm.model_executor.layers.fused_moe.modular_kernel as mk
|
|
16
|
+
from vllm import _custom_ops as ops
|
|
17
|
+
from vllm._aiter_ops import rocm_aiter_ops
|
|
18
|
+
from vllm.logger import init_logger
|
|
19
|
+
from vllm.model_executor.layers.batch_invariant import (
|
|
20
|
+
vllm_is_batch_invariant,
|
|
21
|
+
)
|
|
22
|
+
from vllm.model_executor.layers.fused_moe.config import (
|
|
23
|
+
FUSED_MOE_UNQUANTIZED_CONFIG,
|
|
24
|
+
FusedMoEQuantConfig,
|
|
25
|
+
_get_config_dtype_str,
|
|
26
|
+
)
|
|
27
|
+
from vllm.model_executor.layers.fused_moe.cutlass_moe import (
|
|
28
|
+
_valid_cutlass_block_scaled_grouped_gemm,
|
|
29
|
+
run_cutlass_block_scaled_fused_experts,
|
|
30
|
+
)
|
|
31
|
+
from vllm.model_executor.layers.fused_moe.deep_gemm_moe import (
|
|
32
|
+
_valid_deep_gemm,
|
|
33
|
+
deep_gemm_moe_fp8,
|
|
34
|
+
)
|
|
35
|
+
from vllm.model_executor.layers.fused_moe.moe_align_block_size import (
|
|
36
|
+
moe_align_block_size,
|
|
37
|
+
)
|
|
38
|
+
from vllm.model_executor.layers.fused_moe.prepare_finalize import (
|
|
39
|
+
MoEPrepareAndFinalizeNoEP,
|
|
40
|
+
)
|
|
41
|
+
from vllm.model_executor.layers.fused_moe.topk_weight_and_reduce import (
|
|
42
|
+
TopKWeightAndReduceNoOP,
|
|
43
|
+
)
|
|
44
|
+
from vllm.model_executor.layers.fused_moe.utils import (
|
|
45
|
+
_resize_cache,
|
|
46
|
+
activation_without_mul,
|
|
47
|
+
disable_inplace,
|
|
48
|
+
moe_kernel_quantize_input,
|
|
49
|
+
)
|
|
50
|
+
from vllm.model_executor.layers.quantization.utils.mxfp4_utils import dequant_mxfp4
|
|
51
|
+
from vllm.model_executor.layers.quantization.utils.mxfp6_utils import dequant_mxfp6
|
|
52
|
+
from vllm.model_executor.layers.quantization.utils.ocp_mx_utils import OCP_MX_Scheme
|
|
53
|
+
from vllm.model_executor.utils import maybe_disable_graph_partition
|
|
54
|
+
from vllm.platforms import current_platform
|
|
55
|
+
from vllm.triton_utils import tl, triton
|
|
56
|
+
from vllm.utils.deep_gemm import is_deep_gemm_e8m0_used
|
|
57
|
+
from vllm.utils.torch_utils import direct_register_custom_op, is_torch_equal_or_newer
|
|
58
|
+
|
|
59
|
+
logger = init_logger(__name__)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@triton.jit
|
|
63
|
+
def write_zeros_to_output(
|
|
64
|
+
c_ptr,
|
|
65
|
+
stride_cm,
|
|
66
|
+
stride_cn,
|
|
67
|
+
pid_n,
|
|
68
|
+
N,
|
|
69
|
+
offs_token,
|
|
70
|
+
token_mask,
|
|
71
|
+
BLOCK_SIZE_M,
|
|
72
|
+
BLOCK_SIZE_N,
|
|
73
|
+
compute_type,
|
|
74
|
+
):
|
|
75
|
+
accumulator = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=compute_type)
|
|
76
|
+
offs_cn = pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N)
|
|
77
|
+
c_ptrs = c_ptr + stride_cm * offs_token[:, None] + stride_cn * offs_cn[None, :]
|
|
78
|
+
c_mask = token_mask[:, None] & (offs_cn[None, :] < N)
|
|
79
|
+
tl.store(c_ptrs, accumulator, mask=c_mask)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@triton.jit
|
|
83
|
+
def fused_moe_kernel_gptq_awq(
|
|
84
|
+
# Pointers to matrices
|
|
85
|
+
a_ptr,
|
|
86
|
+
b_ptr,
|
|
87
|
+
c_ptr,
|
|
88
|
+
b_scale_ptr,
|
|
89
|
+
b_zp_ptr,
|
|
90
|
+
topk_weights_ptr,
|
|
91
|
+
sorted_token_ids_ptr,
|
|
92
|
+
expert_ids_ptr,
|
|
93
|
+
num_tokens_post_padded_ptr,
|
|
94
|
+
# Matrix dimensions
|
|
95
|
+
N: tl.constexpr,
|
|
96
|
+
K: tl.constexpr,
|
|
97
|
+
EM,
|
|
98
|
+
num_valid_tokens,
|
|
99
|
+
# The stride variables represent how much to increase the ptr by when
|
|
100
|
+
# moving by 1 element in a particular dimension. E.g. `stride_am` is
|
|
101
|
+
# how much to increase `a_ptr` by to get the element one row down
|
|
102
|
+
# (A has M rows).
|
|
103
|
+
stride_am,
|
|
104
|
+
stride_ak,
|
|
105
|
+
stride_be,
|
|
106
|
+
stride_bk,
|
|
107
|
+
stride_bn,
|
|
108
|
+
stride_cm,
|
|
109
|
+
stride_cn,
|
|
110
|
+
stride_bse,
|
|
111
|
+
stride_bsk,
|
|
112
|
+
stride_bsn,
|
|
113
|
+
stride_bze,
|
|
114
|
+
stride_bzk,
|
|
115
|
+
stride_bzn,
|
|
116
|
+
block_k_diviable: tl.constexpr,
|
|
117
|
+
group_size: tl.constexpr,
|
|
118
|
+
# Meta-parameters
|
|
119
|
+
BLOCK_SIZE_M: tl.constexpr,
|
|
120
|
+
BLOCK_SIZE_N: tl.constexpr,
|
|
121
|
+
BLOCK_SIZE_K: tl.constexpr,
|
|
122
|
+
GROUP_SIZE_M: tl.constexpr,
|
|
123
|
+
SPLIT_K: tl.constexpr,
|
|
124
|
+
MUL_ROUTED_WEIGHT: tl.constexpr,
|
|
125
|
+
top_k: tl.constexpr,
|
|
126
|
+
compute_type: tl.constexpr,
|
|
127
|
+
has_zp: tl.constexpr,
|
|
128
|
+
use_int4_w4a16: tl.constexpr,
|
|
129
|
+
use_int8_w8a16: tl.constexpr,
|
|
130
|
+
):
|
|
131
|
+
"""
|
|
132
|
+
Implements the fused computation for a Mixture of Experts (MOE) using
|
|
133
|
+
token and expert matrices.
|
|
134
|
+
|
|
135
|
+
Key Parameters:
|
|
136
|
+
- A: The input tensor representing tokens with shape (*, K), where '*' can
|
|
137
|
+
be any shape representing batches and K is the feature dimension of
|
|
138
|
+
each token.
|
|
139
|
+
- B: The stacked MOE weight tensor with shape (E, N, K), where E is
|
|
140
|
+
the number of experts, K is the input feature dimension, and N is
|
|
141
|
+
the output feature dimension.
|
|
142
|
+
- C: The output cache tensor with shape (M, topk, N), where M is the
|
|
143
|
+
total number of tokens post padding, topk is the number of times
|
|
144
|
+
each token is repeated, and N is the output feature dimension.
|
|
145
|
+
- sorted_token_ids: A tensor containing the sorted indices of tokens,
|
|
146
|
+
repeated topk times and arranged by the expert index they are
|
|
147
|
+
assigned to.
|
|
148
|
+
- expert_ids: A tensor containing the indices of the expert for each
|
|
149
|
+
block. It determines which expert matrix from B should be used for
|
|
150
|
+
each block in A.
|
|
151
|
+
This kernel performs the multiplication of a token by its corresponding
|
|
152
|
+
expert matrix as determined by `expert_ids`. The sorting of
|
|
153
|
+
`sorted_token_ids` by expert index and padding ensures divisibility by
|
|
154
|
+
BLOCK_SIZE_M, which is necessary to maintain consistency in block matrix
|
|
155
|
+
multiplication across different blocks processed by the same expert.
|
|
156
|
+
"""
|
|
157
|
+
# -----------------------------------------------------------
|
|
158
|
+
# Map program ids `pid` to the block of C it should compute.
|
|
159
|
+
# This is done in a grouped ordering to promote L2 data reuse.
|
|
160
|
+
pid = tl.program_id(axis=0)
|
|
161
|
+
num_pid_m = tl.cdiv(EM, BLOCK_SIZE_M)
|
|
162
|
+
num_pid_n = tl.cdiv(N, BLOCK_SIZE_N)
|
|
163
|
+
num_pid_in_group = GROUP_SIZE_M * num_pid_n
|
|
164
|
+
group_id = pid // num_pid_in_group
|
|
165
|
+
first_pid_m = group_id * GROUP_SIZE_M
|
|
166
|
+
group_size_m = min(num_pid_m - first_pid_m, GROUP_SIZE_M)
|
|
167
|
+
pid_m = first_pid_m + ((pid % num_pid_in_group) % group_size_m)
|
|
168
|
+
pid_n = (pid % num_pid_in_group) // group_size_m
|
|
169
|
+
|
|
170
|
+
# ----------------------------------------------------------
|
|
171
|
+
# Create pointers for the first blocks of A and B.
|
|
172
|
+
# We will advance this pointer as we move in the K direction
|
|
173
|
+
# and accumulate
|
|
174
|
+
# `a_ptrs` is a block of [BLOCK_SIZE_M, BLOCK_SIZE_K] pointers
|
|
175
|
+
# `b_ptrs` is a block of [BLOCK_SIZE_K, BLOCK_SIZE_N] pointers
|
|
176
|
+
num_tokens_post_padded = tl.load(num_tokens_post_padded_ptr)
|
|
177
|
+
if pid_m * BLOCK_SIZE_M >= num_tokens_post_padded:
|
|
178
|
+
return
|
|
179
|
+
offs_token_id = pid_m * BLOCK_SIZE_M + tl.arange(0, BLOCK_SIZE_M).to(tl.int64)
|
|
180
|
+
offs_token = tl.load(sorted_token_ids_ptr + offs_token_id)
|
|
181
|
+
token_mask = offs_token < num_valid_tokens
|
|
182
|
+
|
|
183
|
+
off_experts = tl.load(expert_ids_ptr + pid_m).to(tl.int64)
|
|
184
|
+
if off_experts == -1:
|
|
185
|
+
# -----------------------------------------------------------
|
|
186
|
+
# Write back zeros to the output when the expert is not
|
|
187
|
+
# in the current expert parallel rank.
|
|
188
|
+
write_zeros_to_output(
|
|
189
|
+
c_ptr,
|
|
190
|
+
stride_cm,
|
|
191
|
+
stride_cn,
|
|
192
|
+
pid_n,
|
|
193
|
+
N,
|
|
194
|
+
offs_token,
|
|
195
|
+
token_mask,
|
|
196
|
+
BLOCK_SIZE_M,
|
|
197
|
+
BLOCK_SIZE_N,
|
|
198
|
+
compute_type,
|
|
199
|
+
)
|
|
200
|
+
return
|
|
201
|
+
|
|
202
|
+
offs_bn = (pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N).to(tl.int64)) % N
|
|
203
|
+
offs_k = tl.arange(0, BLOCK_SIZE_K)
|
|
204
|
+
a_ptrs = a_ptr + (
|
|
205
|
+
offs_token[:, None] // top_k * stride_am + offs_k[None, :] * stride_ak
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
if use_int4_w4a16:
|
|
209
|
+
b_ptrs = (
|
|
210
|
+
b_ptr
|
|
211
|
+
+ off_experts * stride_be
|
|
212
|
+
+ (offs_k[:, None] // 2) * stride_bk
|
|
213
|
+
+ offs_bn[None, :] * stride_bn
|
|
214
|
+
)
|
|
215
|
+
b_shifter = (offs_k[:, None] % 2) * 4
|
|
216
|
+
elif use_int8_w8a16:
|
|
217
|
+
b_ptrs = (
|
|
218
|
+
b_ptr
|
|
219
|
+
+ off_experts * stride_be
|
|
220
|
+
+ offs_k[:, None] * stride_bk
|
|
221
|
+
+ offs_bn[None, :] * stride_bn
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
if not has_zp and use_int4_w4a16:
|
|
225
|
+
b_zp_num = 8
|
|
226
|
+
if not has_zp and use_int8_w8a16:
|
|
227
|
+
b_zp_num = 128
|
|
228
|
+
elif has_zp and use_int4_w4a16:
|
|
229
|
+
b_zp_shifter = (offs_bn[None, :] % 2) * 4
|
|
230
|
+
|
|
231
|
+
# -----------------------------------------------------------
|
|
232
|
+
# Iterate to compute a block of the C matrix.
|
|
233
|
+
# We accumulate into a `[BLOCK_SIZE_M, BLOCK_SIZE_N]` block
|
|
234
|
+
# of fp32 values for higher accuracy.
|
|
235
|
+
# `accumulator` will be converted back to fp16 after the loop.
|
|
236
|
+
accumulator = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=tl.float32)
|
|
237
|
+
for k in range(0, tl.cdiv(K, BLOCK_SIZE_K)):
|
|
238
|
+
# Load the next block of A and B, generate a mask by checking the
|
|
239
|
+
# K dimension.
|
|
240
|
+
|
|
241
|
+
if not block_k_diviable:
|
|
242
|
+
k_mask = offs_k[:, None] < K - k * BLOCK_SIZE_K
|
|
243
|
+
k_other = 0.0
|
|
244
|
+
else:
|
|
245
|
+
k_mask = None
|
|
246
|
+
k_other = None
|
|
247
|
+
|
|
248
|
+
a = tl.load(
|
|
249
|
+
a_ptrs,
|
|
250
|
+
mask=token_mask[:, None] & (offs_k[None, :] < K - k * BLOCK_SIZE_K),
|
|
251
|
+
other=0.0,
|
|
252
|
+
)
|
|
253
|
+
b = tl.load(b_ptrs)
|
|
254
|
+
if use_int4_w4a16:
|
|
255
|
+
b = (b >> b_shifter) & 0xF
|
|
256
|
+
|
|
257
|
+
b_scale_ptrs = (
|
|
258
|
+
b_scale_ptr
|
|
259
|
+
+ off_experts * stride_bse
|
|
260
|
+
+ offs_bn[None, :] * stride_bsn
|
|
261
|
+
+ ((offs_k[:, None] + BLOCK_SIZE_K * k) // group_size) * stride_bsk
|
|
262
|
+
)
|
|
263
|
+
b_scale = tl.load(b_scale_ptrs, mask=k_mask, other=k_other)
|
|
264
|
+
b_scale = b_scale.to(tl.float32)
|
|
265
|
+
|
|
266
|
+
if has_zp and use_int4_w4a16:
|
|
267
|
+
offs_k_true = (offs_k[:, None] + BLOCK_SIZE_K * k) // group_size
|
|
268
|
+
b_zp_ptrs = (
|
|
269
|
+
b_zp_ptr
|
|
270
|
+
+ off_experts * stride_bze
|
|
271
|
+
+ (offs_bn[None, :] // 2) * stride_bzn
|
|
272
|
+
+ offs_k_true * stride_bzk
|
|
273
|
+
)
|
|
274
|
+
b_zp = tl.load(b_zp_ptrs, mask=k_mask, other=k_other)
|
|
275
|
+
b_zp = (b_zp >> b_zp_shifter) & 0xF
|
|
276
|
+
b_zp = b_zp.to(tl.float32)
|
|
277
|
+
elif has_zp and use_int8_w8a16:
|
|
278
|
+
offs_k_true = (offs_k[:, None] + BLOCK_SIZE_K * k) // group_size
|
|
279
|
+
b_zp_ptrs = (
|
|
280
|
+
b_zp_ptr
|
|
281
|
+
+ off_experts * stride_bze
|
|
282
|
+
+ offs_bn[None, :] * stride_bzn
|
|
283
|
+
+ offs_k_true * stride_bzk
|
|
284
|
+
)
|
|
285
|
+
b_zp = tl.load(b_zp_ptrs, mask=k_mask, other=k_other)
|
|
286
|
+
b_zp = b_zp.to(tl.float32)
|
|
287
|
+
|
|
288
|
+
# We accumulate along the K dimension.
|
|
289
|
+
if has_zp:
|
|
290
|
+
b = ((b.to(tl.float32) - b_zp) * b_scale).to(compute_type)
|
|
291
|
+
else:
|
|
292
|
+
b = ((b.to(tl.float32) - b_zp_num) * b_scale).to(compute_type)
|
|
293
|
+
accumulator = tl.dot(a, b, acc=accumulator)
|
|
294
|
+
|
|
295
|
+
# Advance the ptrs to the next K block.
|
|
296
|
+
a_ptrs += BLOCK_SIZE_K * stride_ak
|
|
297
|
+
if use_int4_w4a16:
|
|
298
|
+
b_ptrs += (BLOCK_SIZE_K // 2) * stride_bk
|
|
299
|
+
else:
|
|
300
|
+
b_ptrs += BLOCK_SIZE_K * stride_bk
|
|
301
|
+
|
|
302
|
+
if MUL_ROUTED_WEIGHT:
|
|
303
|
+
moe_weight = tl.load(topk_weights_ptr + offs_token, mask=token_mask, other=0)
|
|
304
|
+
accumulator = accumulator * moe_weight[:, None]
|
|
305
|
+
|
|
306
|
+
accumulator = accumulator.to(compute_type)
|
|
307
|
+
# -----------------------------------------------------------
|
|
308
|
+
# Write back the block of the output
|
|
309
|
+
offs_cn = pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N)
|
|
310
|
+
c_ptrs = c_ptr + stride_cm * offs_token[:, None] + stride_cn * offs_cn[None, :]
|
|
311
|
+
c_mask = token_mask[:, None] & (offs_cn[None, :] < N)
|
|
312
|
+
tl.store(c_ptrs, accumulator, mask=c_mask)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
@triton.jit
|
|
316
|
+
def fused_moe_kernel(
|
|
317
|
+
# Pointers to matrices
|
|
318
|
+
a_ptr,
|
|
319
|
+
b_ptr,
|
|
320
|
+
c_ptr,
|
|
321
|
+
b_bias_ptr,
|
|
322
|
+
a_scale_ptr,
|
|
323
|
+
b_scale_ptr,
|
|
324
|
+
topk_weights_ptr,
|
|
325
|
+
sorted_token_ids_ptr,
|
|
326
|
+
expert_ids_ptr,
|
|
327
|
+
num_tokens_post_padded_ptr,
|
|
328
|
+
# Matrix dimensions
|
|
329
|
+
N,
|
|
330
|
+
K,
|
|
331
|
+
EM,
|
|
332
|
+
num_valid_tokens,
|
|
333
|
+
# The stride variables represent how much to increase the ptr by when
|
|
334
|
+
# moving by 1 element in a particular dimension. E.g. `stride_am` is
|
|
335
|
+
# how much to increase `a_ptr` by to get the element one row down
|
|
336
|
+
# (A has M rows).
|
|
337
|
+
stride_am,
|
|
338
|
+
stride_ak,
|
|
339
|
+
stride_be,
|
|
340
|
+
stride_bk,
|
|
341
|
+
stride_bn,
|
|
342
|
+
stride_cm,
|
|
343
|
+
stride_cn,
|
|
344
|
+
stride_asm,
|
|
345
|
+
stride_ask,
|
|
346
|
+
stride_bse,
|
|
347
|
+
stride_bsk,
|
|
348
|
+
stride_bsn,
|
|
349
|
+
stride_bbe, # bias expert stride
|
|
350
|
+
stride_bbn, # bias N stride
|
|
351
|
+
# Block size for block-wise quantization
|
|
352
|
+
group_n: tl.constexpr,
|
|
353
|
+
group_k: tl.constexpr,
|
|
354
|
+
# Meta-parameters
|
|
355
|
+
BLOCK_SIZE_M: tl.constexpr,
|
|
356
|
+
BLOCK_SIZE_N: tl.constexpr,
|
|
357
|
+
BLOCK_SIZE_K: tl.constexpr,
|
|
358
|
+
GROUP_SIZE_M: tl.constexpr,
|
|
359
|
+
SPLIT_K: tl.constexpr,
|
|
360
|
+
MUL_ROUTED_WEIGHT: tl.constexpr,
|
|
361
|
+
top_k: tl.constexpr,
|
|
362
|
+
compute_type: tl.constexpr,
|
|
363
|
+
use_fp8_w8a8: tl.constexpr,
|
|
364
|
+
use_int8_w8a8: tl.constexpr,
|
|
365
|
+
use_int8_w8a16: tl.constexpr,
|
|
366
|
+
per_channel_quant: tl.constexpr,
|
|
367
|
+
HAS_BIAS: tl.constexpr,
|
|
368
|
+
):
|
|
369
|
+
"""
|
|
370
|
+
Implements the fused computation for a Mixture of Experts (MOE) using
|
|
371
|
+
token and expert matrices.
|
|
372
|
+
|
|
373
|
+
Key Parameters:
|
|
374
|
+
- A: The input tensor representing tokens with shape (*, K), where '*' can
|
|
375
|
+
be any shape representing batches and K is the feature dimension of
|
|
376
|
+
each token.
|
|
377
|
+
- B: The stacked MOE weight tensor with shape (E, N, K), where E is
|
|
378
|
+
the number of experts, K is the input feature dimension, and N is
|
|
379
|
+
the output feature dimension.
|
|
380
|
+
- C: The output cache tensor with shape (M, topk, N), where M is the
|
|
381
|
+
total number of tokens post padding, topk is the number of times
|
|
382
|
+
each token is repeated, and N is the output feature dimension.
|
|
383
|
+
- sorted_token_ids: A tensor containing the sorted indices of tokens,
|
|
384
|
+
repeated topk times and arranged by the expert index they are
|
|
385
|
+
assigned to.
|
|
386
|
+
- expert_ids: A tensor containing the indices of the expert for each
|
|
387
|
+
block. It determines which expert matrix from B should be used for
|
|
388
|
+
each block in A.
|
|
389
|
+
This kernel performs the multiplication of a token by its corresponding
|
|
390
|
+
expert matrix as determined by `expert_ids`. The sorting of
|
|
391
|
+
`sorted_token_ids` by expert index and padding ensures divisibility by
|
|
392
|
+
BLOCK_SIZE_M, which is necessary to maintain consistency in block matrix
|
|
393
|
+
multiplication across different blocks processed by the same expert.
|
|
394
|
+
"""
|
|
395
|
+
# -----------------------------------------------------------
|
|
396
|
+
# Map program ids `pid` to the block of C it should compute.
|
|
397
|
+
# This is done in a grouped ordering to promote L2 data reuse.
|
|
398
|
+
pid = tl.program_id(axis=0)
|
|
399
|
+
num_pid_m = tl.cdiv(EM, BLOCK_SIZE_M)
|
|
400
|
+
num_pid_n = tl.cdiv(N, BLOCK_SIZE_N)
|
|
401
|
+
num_pid_in_group = GROUP_SIZE_M * num_pid_n
|
|
402
|
+
group_id = pid // num_pid_in_group
|
|
403
|
+
first_pid_m = group_id * GROUP_SIZE_M
|
|
404
|
+
group_size_m = min(num_pid_m - first_pid_m, GROUP_SIZE_M)
|
|
405
|
+
pid_m = first_pid_m + ((pid % num_pid_in_group) % group_size_m)
|
|
406
|
+
pid_n = (pid % num_pid_in_group) // group_size_m
|
|
407
|
+
|
|
408
|
+
# ----------------------------------------------------------
|
|
409
|
+
# Create pointers for the first blocks of A and B.
|
|
410
|
+
# We will advance this pointer as we move in the K direction
|
|
411
|
+
# and accumulate
|
|
412
|
+
# `a_ptrs` is a block of [BLOCK_SIZE_M, BLOCK_SIZE_K] pointers
|
|
413
|
+
# `b_ptrs` is a block of [BLOCK_SIZE_K, BLOCK_SIZE_N] pointers
|
|
414
|
+
num_tokens_post_padded = tl.load(num_tokens_post_padded_ptr)
|
|
415
|
+
if pid_m * BLOCK_SIZE_M >= num_tokens_post_padded:
|
|
416
|
+
return
|
|
417
|
+
offs_token_id = pid_m * BLOCK_SIZE_M + tl.arange(0, BLOCK_SIZE_M).to(tl.int64)
|
|
418
|
+
offs_token = tl.load(sorted_token_ids_ptr + offs_token_id)
|
|
419
|
+
token_mask = offs_token < num_valid_tokens
|
|
420
|
+
|
|
421
|
+
off_experts = tl.load(expert_ids_ptr + pid_m).to(tl.int64)
|
|
422
|
+
if off_experts == -1:
|
|
423
|
+
# -----------------------------------------------------------
|
|
424
|
+
# Write back zeros to the output when the expert is not
|
|
425
|
+
# in the current expert parallel rank.
|
|
426
|
+
write_zeros_to_output(
|
|
427
|
+
c_ptr,
|
|
428
|
+
stride_cm,
|
|
429
|
+
stride_cn,
|
|
430
|
+
pid_n,
|
|
431
|
+
N,
|
|
432
|
+
offs_token,
|
|
433
|
+
token_mask,
|
|
434
|
+
BLOCK_SIZE_M,
|
|
435
|
+
BLOCK_SIZE_N,
|
|
436
|
+
compute_type,
|
|
437
|
+
)
|
|
438
|
+
return
|
|
439
|
+
|
|
440
|
+
offs_bn = (pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N).to(tl.int64)) % N
|
|
441
|
+
offs_k = tl.arange(0, BLOCK_SIZE_K)
|
|
442
|
+
a_ptrs = a_ptr + (
|
|
443
|
+
offs_token[:, None] // top_k * stride_am + offs_k[None, :] * stride_ak
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
b_ptrs = (
|
|
447
|
+
b_ptr
|
|
448
|
+
+ off_experts * stride_be
|
|
449
|
+
+ (offs_k[:, None] * stride_bk + offs_bn[None, :] * stride_bn)
|
|
450
|
+
)
|
|
451
|
+
if use_int8_w8a16:
|
|
452
|
+
b_scale_ptrs = (
|
|
453
|
+
b_scale_ptr + off_experts * stride_bse + offs_bn[None, :] * stride_bsn
|
|
454
|
+
)
|
|
455
|
+
b_scale = tl.load(b_scale_ptrs)
|
|
456
|
+
|
|
457
|
+
if use_fp8_w8a8 or use_int8_w8a8:
|
|
458
|
+
# block-wise
|
|
459
|
+
if group_k > 0 and group_n > 0:
|
|
460
|
+
a_scale_ptrs = a_scale_ptr + (offs_token // top_k) * stride_asm
|
|
461
|
+
offs_bsn = offs_bn // group_n
|
|
462
|
+
b_scale_ptrs = (
|
|
463
|
+
b_scale_ptr + off_experts * stride_bse + offs_bsn * stride_bsn
|
|
464
|
+
)
|
|
465
|
+
# channel-wise
|
|
466
|
+
elif per_channel_quant:
|
|
467
|
+
b_scale_ptrs = (
|
|
468
|
+
b_scale_ptr + off_experts * stride_bse + offs_bn[None, :] * stride_bsn
|
|
469
|
+
)
|
|
470
|
+
b_scale = tl.load(b_scale_ptrs)
|
|
471
|
+
# Load per-token scale for activations
|
|
472
|
+
a_scale_ptrs = a_scale_ptr + (offs_token // top_k) * stride_asm
|
|
473
|
+
a_scale = tl.load(a_scale_ptrs, mask=token_mask, other=0.0)[:, None]
|
|
474
|
+
# tensor-wise
|
|
475
|
+
else:
|
|
476
|
+
a_scale = tl.load(a_scale_ptr)
|
|
477
|
+
b_scale = tl.load(b_scale_ptr + off_experts)
|
|
478
|
+
if HAS_BIAS:
|
|
479
|
+
# bias shape: [num_experts, N]
|
|
480
|
+
bias_ptrs = b_bias_ptr + off_experts * stride_bbe + offs_bn * stride_bbn
|
|
481
|
+
bias = tl.load(bias_ptrs, mask=(offs_bn < N), other=0.0)
|
|
482
|
+
# -----------------------------------------------------------
|
|
483
|
+
# Iterate to compute a block of the C matrix.
|
|
484
|
+
# We accumulate into a `[BLOCK_SIZE_M, BLOCK_SIZE_N]` block
|
|
485
|
+
# of fp32 values for higher accuracy.
|
|
486
|
+
# `accumulator` will be converted back to fp16 after the loop.
|
|
487
|
+
accumulator = tl.zeros((BLOCK_SIZE_M, BLOCK_SIZE_N), dtype=tl.float32)
|
|
488
|
+
for k in range(0, tl.cdiv(K, BLOCK_SIZE_K)):
|
|
489
|
+
# Load the next block of A and B, generate a mask by checking the
|
|
490
|
+
# K dimension.
|
|
491
|
+
a = tl.load(
|
|
492
|
+
a_ptrs,
|
|
493
|
+
mask=token_mask[:, None] & (offs_k[None, :] < K - k * BLOCK_SIZE_K),
|
|
494
|
+
other=0.0,
|
|
495
|
+
)
|
|
496
|
+
b = tl.load(b_ptrs, mask=offs_k[:, None] < K - k * BLOCK_SIZE_K, other=0.0)
|
|
497
|
+
# We accumulate along the K dimension.
|
|
498
|
+
if use_int8_w8a16:
|
|
499
|
+
accumulator = tl.dot(a, b.to(compute_type), acc=accumulator)
|
|
500
|
+
elif use_fp8_w8a8 or use_int8_w8a8:
|
|
501
|
+
if group_k > 0 and group_n > 0:
|
|
502
|
+
k_start = k * BLOCK_SIZE_K
|
|
503
|
+
offs_ks = k_start // group_k
|
|
504
|
+
a_scale = tl.load(
|
|
505
|
+
a_scale_ptrs + offs_ks * stride_ask, mask=token_mask, other=0.0
|
|
506
|
+
)
|
|
507
|
+
b_scale = tl.load(b_scale_ptrs + offs_ks * stride_bsk)
|
|
508
|
+
|
|
509
|
+
accumulator += tl.dot(a, b) * a_scale[:, None] * b_scale[None, :]
|
|
510
|
+
else:
|
|
511
|
+
if use_fp8_w8a8:
|
|
512
|
+
# acc used to enable fp8_fast_accum
|
|
513
|
+
accumulator = tl.dot(a, b, acc=accumulator)
|
|
514
|
+
else:
|
|
515
|
+
accumulator += tl.dot(a, b)
|
|
516
|
+
else:
|
|
517
|
+
accumulator += tl.dot(a, b)
|
|
518
|
+
# Advance the ptrs to the next K block.
|
|
519
|
+
a_ptrs += BLOCK_SIZE_K * stride_ak
|
|
520
|
+
b_ptrs += BLOCK_SIZE_K * stride_bk
|
|
521
|
+
if HAS_BIAS:
|
|
522
|
+
accumulator = accumulator + bias[None, :]
|
|
523
|
+
if MUL_ROUTED_WEIGHT:
|
|
524
|
+
moe_weight = tl.load(topk_weights_ptr + offs_token, mask=token_mask, other=0)
|
|
525
|
+
accumulator = accumulator * moe_weight[:, None]
|
|
526
|
+
if use_int8_w8a16:
|
|
527
|
+
accumulator = (accumulator * b_scale).to(compute_type)
|
|
528
|
+
elif use_fp8_w8a8 or use_int8_w8a8:
|
|
529
|
+
if group_k > 0 and group_n > 0:
|
|
530
|
+
accumulator = accumulator.to(compute_type)
|
|
531
|
+
else:
|
|
532
|
+
accumulator = (accumulator * a_scale * b_scale).to(compute_type)
|
|
533
|
+
else:
|
|
534
|
+
accumulator = accumulator.to(compute_type)
|
|
535
|
+
|
|
536
|
+
# -----------------------------------------------------------
|
|
537
|
+
# Write back the block of the output
|
|
538
|
+
offs_cn = pid_n * BLOCK_SIZE_N + tl.arange(0, BLOCK_SIZE_N)
|
|
539
|
+
c_ptrs = c_ptr + stride_cm * offs_token[:, None] + stride_cn * offs_cn[None, :]
|
|
540
|
+
c_mask = token_mask[:, None] & (offs_cn[None, :] < N)
|
|
541
|
+
tl.store(c_ptrs, accumulator, mask=c_mask)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
def invoke_fused_moe_kernel(
|
|
545
|
+
A: torch.Tensor,
|
|
546
|
+
B: torch.Tensor,
|
|
547
|
+
C: torch.Tensor,
|
|
548
|
+
A_scale: torch.Tensor | None,
|
|
549
|
+
B_scale: torch.Tensor | None,
|
|
550
|
+
B_zp: torch.Tensor | None,
|
|
551
|
+
topk_weights: torch.Tensor | None,
|
|
552
|
+
sorted_token_ids: torch.Tensor,
|
|
553
|
+
expert_ids: torch.Tensor,
|
|
554
|
+
num_tokens_post_padded: torch.Tensor,
|
|
555
|
+
mul_routed_weight: bool,
|
|
556
|
+
top_k: int,
|
|
557
|
+
config: dict[str, Any],
|
|
558
|
+
compute_type: tl.dtype,
|
|
559
|
+
use_fp8_w8a8: bool,
|
|
560
|
+
use_int8_w8a8: bool,
|
|
561
|
+
use_int8_w8a16: bool,
|
|
562
|
+
use_int4_w4a16: bool,
|
|
563
|
+
per_channel_quant: bool,
|
|
564
|
+
block_shape: list[int] | None = None,
|
|
565
|
+
B_bias: torch.Tensor | None = None,
|
|
566
|
+
) -> None:
|
|
567
|
+
assert topk_weights is not None or not mul_routed_weight
|
|
568
|
+
assert topk_weights is None or topk_weights.stride(1) == 1
|
|
569
|
+
assert sorted_token_ids.stride(0) == 1
|
|
570
|
+
|
|
571
|
+
if use_fp8_w8a8 or use_int8_w8a8:
|
|
572
|
+
assert B_scale is not None
|
|
573
|
+
assert block_shape is None or triton.cdiv(
|
|
574
|
+
B.size(-2), block_shape[0]
|
|
575
|
+
) == B_scale.size(-2)
|
|
576
|
+
assert block_shape is None or triton.cdiv(
|
|
577
|
+
B.size(-1), block_shape[1]
|
|
578
|
+
) == B_scale.size(-1)
|
|
579
|
+
|
|
580
|
+
elif use_int8_w8a16 or use_int4_w4a16:
|
|
581
|
+
assert B_scale is not None
|
|
582
|
+
assert block_shape is None or block_shape[0] == 0
|
|
583
|
+
else:
|
|
584
|
+
assert A_scale is None
|
|
585
|
+
assert B_scale is None
|
|
586
|
+
|
|
587
|
+
M = A.size(0)
|
|
588
|
+
num_tokens = M * top_k
|
|
589
|
+
|
|
590
|
+
EM = sorted_token_ids.size(0)
|
|
591
|
+
if A.size(0) < config["BLOCK_SIZE_M"]:
|
|
592
|
+
# optimize for small batch_size.
|
|
593
|
+
# We assume that top_ids of each token is unique,
|
|
594
|
+
# so num_valid_experts <= batch_size <= BLOCK_SIZE_M,
|
|
595
|
+
# and we can skip some invalid blocks.
|
|
596
|
+
EM = min(sorted_token_ids.size(0), A.size(0) * top_k * config["BLOCK_SIZE_M"])
|
|
597
|
+
grid = lambda META: (
|
|
598
|
+
triton.cdiv(EM, META["BLOCK_SIZE_M"])
|
|
599
|
+
* triton.cdiv(B.size(1), META["BLOCK_SIZE_N"]),
|
|
600
|
+
)
|
|
601
|
+
HAS_BIAS = B_bias is not None
|
|
602
|
+
if (
|
|
603
|
+
(use_int8_w8a16 or use_int4_w4a16)
|
|
604
|
+
and block_shape is not None
|
|
605
|
+
and block_shape[1] > 0
|
|
606
|
+
):
|
|
607
|
+
assert B_scale is not None and B_scale.ndim == 3
|
|
608
|
+
assert B_zp is None or B_zp.ndim == 3
|
|
609
|
+
|
|
610
|
+
use_moe_wna16_cuda = should_moe_wna16_use_cuda(
|
|
611
|
+
num_valid_tokens=num_tokens,
|
|
612
|
+
group_size=block_shape[1],
|
|
613
|
+
num_experts=B.size(0),
|
|
614
|
+
bit=4 if use_int4_w4a16 else 8,
|
|
615
|
+
)
|
|
616
|
+
config = config.copy()
|
|
617
|
+
config.update(
|
|
618
|
+
get_moe_wna16_block_config(
|
|
619
|
+
config=config,
|
|
620
|
+
use_moe_wna16_cuda=use_moe_wna16_cuda,
|
|
621
|
+
num_valid_tokens=num_tokens,
|
|
622
|
+
size_k=A.size(1),
|
|
623
|
+
size_n=B.size(1),
|
|
624
|
+
num_experts=B.size(1),
|
|
625
|
+
group_size=block_shape[1],
|
|
626
|
+
real_top_k=top_k,
|
|
627
|
+
block_size_m=config["BLOCK_SIZE_M"],
|
|
628
|
+
)
|
|
629
|
+
)
|
|
630
|
+
|
|
631
|
+
if use_moe_wna16_cuda:
|
|
632
|
+
bit = 4 if use_int4_w4a16 else 8
|
|
633
|
+
ops.moe_wna16_gemm(
|
|
634
|
+
A,
|
|
635
|
+
C,
|
|
636
|
+
B,
|
|
637
|
+
B_scale,
|
|
638
|
+
B_zp,
|
|
639
|
+
topk_weights if mul_routed_weight else None,
|
|
640
|
+
sorted_token_ids,
|
|
641
|
+
expert_ids,
|
|
642
|
+
num_tokens_post_padded,
|
|
643
|
+
top_k,
|
|
644
|
+
config["BLOCK_SIZE_M"],
|
|
645
|
+
config["BLOCK_SIZE_N"],
|
|
646
|
+
config["BLOCK_SIZE_K"],
|
|
647
|
+
bit,
|
|
648
|
+
)
|
|
649
|
+
return
|
|
650
|
+
fused_moe_kernel_gptq_awq[grid](
|
|
651
|
+
A,
|
|
652
|
+
B,
|
|
653
|
+
C,
|
|
654
|
+
B_scale,
|
|
655
|
+
B_zp,
|
|
656
|
+
topk_weights,
|
|
657
|
+
sorted_token_ids,
|
|
658
|
+
expert_ids,
|
|
659
|
+
num_tokens_post_padded,
|
|
660
|
+
B.size(1),
|
|
661
|
+
A.size(1),
|
|
662
|
+
EM,
|
|
663
|
+
num_tokens,
|
|
664
|
+
A.stride(0),
|
|
665
|
+
A.stride(1),
|
|
666
|
+
B.stride(0),
|
|
667
|
+
B.stride(2),
|
|
668
|
+
B.stride(1),
|
|
669
|
+
C.stride(1),
|
|
670
|
+
C.stride(2),
|
|
671
|
+
B_scale.stride(0),
|
|
672
|
+
B_scale.stride(2),
|
|
673
|
+
B_scale.stride(1),
|
|
674
|
+
B_zp.stride(0) if B_zp is not None else 0,
|
|
675
|
+
B_zp.stride(2) if B_zp is not None else 0,
|
|
676
|
+
B_zp.stride(1) if B_zp is not None else 0,
|
|
677
|
+
block_k_diviable=A.size(1) % config["BLOCK_SIZE_K"] == 0,
|
|
678
|
+
group_size=block_shape[1],
|
|
679
|
+
MUL_ROUTED_WEIGHT=mul_routed_weight,
|
|
680
|
+
top_k=top_k,
|
|
681
|
+
compute_type=compute_type,
|
|
682
|
+
has_zp=B_zp is not None,
|
|
683
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
684
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
685
|
+
**config,
|
|
686
|
+
)
|
|
687
|
+
else:
|
|
688
|
+
config = config.copy()
|
|
689
|
+
config["SPLIT_K"] = 1
|
|
690
|
+
BLOCK_SIZE_K = config.pop("BLOCK_SIZE_K")
|
|
691
|
+
if block_shape is not None:
|
|
692
|
+
BLOCK_SIZE_K = min(BLOCK_SIZE_K, min(block_shape[0], block_shape[1]))
|
|
693
|
+
fused_moe_kernel[grid](
|
|
694
|
+
A,
|
|
695
|
+
B,
|
|
696
|
+
C,
|
|
697
|
+
B_bias,
|
|
698
|
+
A_scale,
|
|
699
|
+
B_scale,
|
|
700
|
+
topk_weights,
|
|
701
|
+
sorted_token_ids,
|
|
702
|
+
expert_ids,
|
|
703
|
+
num_tokens_post_padded,
|
|
704
|
+
B.size(1),
|
|
705
|
+
B.size(2),
|
|
706
|
+
EM,
|
|
707
|
+
num_tokens,
|
|
708
|
+
A.stride(0),
|
|
709
|
+
A.stride(1),
|
|
710
|
+
B.stride(0),
|
|
711
|
+
B.stride(2),
|
|
712
|
+
B.stride(1),
|
|
713
|
+
C.stride(1),
|
|
714
|
+
C.stride(2),
|
|
715
|
+
A_scale.stride(0) if A_scale is not None and A_scale.ndim == 2 else 0,
|
|
716
|
+
A_scale.stride(1) if A_scale is not None and A_scale.ndim == 2 else 0,
|
|
717
|
+
B_scale.stride(0) if B_scale is not None and B_scale.ndim >= 2 else 0,
|
|
718
|
+
B_scale.stride(2) if B_scale is not None and B_scale.ndim == 3 else 0,
|
|
719
|
+
B_scale.stride(1) if B_scale is not None and B_scale.ndim >= 2 else 0,
|
|
720
|
+
B_bias.stride(0) if B_bias is not None else 0,
|
|
721
|
+
B_bias.stride(1) if B_bias is not None else 0,
|
|
722
|
+
0 if block_shape is None else block_shape[0],
|
|
723
|
+
0 if block_shape is None else block_shape[1],
|
|
724
|
+
MUL_ROUTED_WEIGHT=mul_routed_weight,
|
|
725
|
+
top_k=top_k,
|
|
726
|
+
compute_type=compute_type,
|
|
727
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
728
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
729
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
730
|
+
per_channel_quant=per_channel_quant,
|
|
731
|
+
HAS_BIAS=HAS_BIAS,
|
|
732
|
+
BLOCK_SIZE_K=BLOCK_SIZE_K,
|
|
733
|
+
**config,
|
|
734
|
+
)
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
@triton.jit
|
|
738
|
+
def compute_identity_kernel(
|
|
739
|
+
top_k: int,
|
|
740
|
+
hidden_states_ptr: tl.tensor,
|
|
741
|
+
expert_scales_ptr: tl.tensor,
|
|
742
|
+
num_tokens: int,
|
|
743
|
+
output_ptr: tl.tensor,
|
|
744
|
+
hidden_dim: int,
|
|
745
|
+
scales_stride: int,
|
|
746
|
+
BLOCK_SIZE: tl.constexpr,
|
|
747
|
+
) -> None:
|
|
748
|
+
pid = tl.program_id(0)
|
|
749
|
+
|
|
750
|
+
batch_id = pid // (hidden_dim // BLOCK_SIZE)
|
|
751
|
+
dim_offset = pid % (hidden_dim // BLOCK_SIZE) * BLOCK_SIZE
|
|
752
|
+
|
|
753
|
+
if batch_id >= num_tokens or dim_offset >= hidden_dim:
|
|
754
|
+
return
|
|
755
|
+
|
|
756
|
+
h = tl.load(
|
|
757
|
+
hidden_states_ptr
|
|
758
|
+
+ batch_id * hidden_dim
|
|
759
|
+
+ dim_offset
|
|
760
|
+
+ tl.arange(0, BLOCK_SIZE),
|
|
761
|
+
mask=(dim_offset + tl.arange(0, BLOCK_SIZE)) < hidden_dim,
|
|
762
|
+
)
|
|
763
|
+
|
|
764
|
+
result = tl.zeros([BLOCK_SIZE], dtype=tl.float32)
|
|
765
|
+
for i in range(top_k):
|
|
766
|
+
scale = tl.load(expert_scales_ptr + batch_id * scales_stride + i)
|
|
767
|
+
result += h * scale
|
|
768
|
+
|
|
769
|
+
tl.store(
|
|
770
|
+
output_ptr + batch_id * hidden_dim + dim_offset + tl.arange(0, BLOCK_SIZE),
|
|
771
|
+
result,
|
|
772
|
+
mask=(dim_offset + tl.arange(0, BLOCK_SIZE)) < hidden_dim,
|
|
773
|
+
)
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
def zero_experts_compute_triton(
|
|
777
|
+
expert_indices: torch.Tensor,
|
|
778
|
+
expert_scales: torch.Tensor,
|
|
779
|
+
num_experts: int,
|
|
780
|
+
zero_expert_type: str,
|
|
781
|
+
hidden_states: torch.Tensor,
|
|
782
|
+
) -> torch.Tensor:
|
|
783
|
+
N = expert_indices.numel()
|
|
784
|
+
top_k = expert_indices.size(-1)
|
|
785
|
+
grid = lambda meta: (triton.cdiv(N, meta["BLOCK_SIZE"]),)
|
|
786
|
+
|
|
787
|
+
if zero_expert_type == "identity":
|
|
788
|
+
zero_expert_mask = expert_indices < num_experts
|
|
789
|
+
zero_expert_scales = expert_scales.clone()
|
|
790
|
+
zero_expert_scales[zero_expert_mask] = 0.0
|
|
791
|
+
|
|
792
|
+
normal_expert_mask = expert_indices >= num_experts
|
|
793
|
+
expert_indices[normal_expert_mask] = 0
|
|
794
|
+
expert_scales[normal_expert_mask] = 0.0
|
|
795
|
+
|
|
796
|
+
output = torch.zeros_like(hidden_states).to(hidden_states.device)
|
|
797
|
+
hidden_dim = hidden_states.size(-1)
|
|
798
|
+
num_tokens = hidden_states.size(0)
|
|
799
|
+
|
|
800
|
+
grid = lambda meta: (num_tokens * (hidden_dim // meta["BLOCK_SIZE"]),)
|
|
801
|
+
compute_identity_kernel[grid](
|
|
802
|
+
top_k,
|
|
803
|
+
hidden_states,
|
|
804
|
+
zero_expert_scales,
|
|
805
|
+
num_tokens,
|
|
806
|
+
output,
|
|
807
|
+
hidden_dim,
|
|
808
|
+
zero_expert_scales.stride(0),
|
|
809
|
+
BLOCK_SIZE=256,
|
|
810
|
+
)
|
|
811
|
+
|
|
812
|
+
return output
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
# Adapted from: https://github.com/sgl-project/sglang/pull/2628
|
|
816
|
+
def get_config_file_name(
|
|
817
|
+
E: int, N: int, dtype: str | None, block_shape: list[int] | None = None
|
|
818
|
+
) -> str:
|
|
819
|
+
device_name = current_platform.get_device_name().replace(" ", "_")
|
|
820
|
+
# Set device_name to H200 if a device from the H200 family is detected
|
|
821
|
+
if "H200" in device_name.split("_"):
|
|
822
|
+
device_name = "NVIDIA_H200"
|
|
823
|
+
dtype_selector = "" if not dtype else f",dtype={dtype}"
|
|
824
|
+
block_shape_selector = (
|
|
825
|
+
"" if not block_shape or not all(block_shape) else f",block_shape={block_shape}"
|
|
826
|
+
).replace(" ", "")
|
|
827
|
+
return f"E={E},N={N},device_name={device_name}{dtype_selector}{block_shape_selector}.json" # noqa: E501
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
# Adapted from: https://github.com/sgl-project/sglang/pull/2628
|
|
831
|
+
@functools.lru_cache
|
|
832
|
+
def get_moe_configs(
|
|
833
|
+
E: int,
|
|
834
|
+
N: int,
|
|
835
|
+
dtype: str | None,
|
|
836
|
+
block_n: int | None = None,
|
|
837
|
+
block_k: int | None = None,
|
|
838
|
+
) -> dict[int, Any] | None:
|
|
839
|
+
"""
|
|
840
|
+
Return optimized configurations for the fused MoE kernel.
|
|
841
|
+
|
|
842
|
+
The return value will be a dictionary that maps an irregular grid of
|
|
843
|
+
batch sizes to configurations of the fused_moe kernel. To evaluate the
|
|
844
|
+
kernel on a given batch size bs, the closest batch size in the grid should
|
|
845
|
+
be picked and the associated configuration chosen to invoke the kernel.
|
|
846
|
+
"""
|
|
847
|
+
|
|
848
|
+
# Avoid optimizing for the batch invariant case. Use default config
|
|
849
|
+
if vllm_is_batch_invariant():
|
|
850
|
+
return None
|
|
851
|
+
|
|
852
|
+
# First look up if an optimized configuration is available in the configs
|
|
853
|
+
# directory
|
|
854
|
+
block_shape = [block_n, block_k] if block_n and block_k else None
|
|
855
|
+
json_file_name = get_config_file_name(E, N, dtype, block_shape)
|
|
856
|
+
|
|
857
|
+
config_file_paths = []
|
|
858
|
+
|
|
859
|
+
# note that we prioritize user defined config
|
|
860
|
+
user_defined_config_folder = envs.VLLM_TUNED_CONFIG_FOLDER
|
|
861
|
+
if user_defined_config_folder is not None:
|
|
862
|
+
user_defined_config_file_path = os.path.join(
|
|
863
|
+
user_defined_config_folder, json_file_name
|
|
864
|
+
)
|
|
865
|
+
config_file_paths.append(user_defined_config_file_path)
|
|
866
|
+
|
|
867
|
+
default_config_file_path = os.path.join(
|
|
868
|
+
os.path.dirname(os.path.realpath(__file__)), "configs", json_file_name
|
|
869
|
+
)
|
|
870
|
+
config_file_paths.append(default_config_file_path)
|
|
871
|
+
|
|
872
|
+
for config_file_path in config_file_paths:
|
|
873
|
+
if os.path.exists(config_file_path):
|
|
874
|
+
with open(config_file_path) as f:
|
|
875
|
+
logger.info(
|
|
876
|
+
"Using configuration from %s for MoE layer.", config_file_path
|
|
877
|
+
)
|
|
878
|
+
# If a configuration has been found, return it
|
|
879
|
+
tuned_config = json.load(f)
|
|
880
|
+
# Delete triton_version from tuned_config
|
|
881
|
+
tuned_config.pop("triton_version", None)
|
|
882
|
+
return {int(key): val for key, val in tuned_config.items()}
|
|
883
|
+
|
|
884
|
+
# If no optimized configuration is available, we will use the default
|
|
885
|
+
# configuration
|
|
886
|
+
logger.warning(
|
|
887
|
+
(
|
|
888
|
+
"Using default MoE config. Performance might be sub-optimal! "
|
|
889
|
+
"Config file not found at %s"
|
|
890
|
+
),
|
|
891
|
+
config_file_paths,
|
|
892
|
+
)
|
|
893
|
+
return None
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
def get_moe_wna16_block_config(
|
|
897
|
+
config: dict[str, int],
|
|
898
|
+
use_moe_wna16_cuda: bool,
|
|
899
|
+
num_valid_tokens: int,
|
|
900
|
+
size_k: int,
|
|
901
|
+
size_n: int,
|
|
902
|
+
num_experts: int,
|
|
903
|
+
group_size: int,
|
|
904
|
+
real_top_k: int,
|
|
905
|
+
block_size_m: int,
|
|
906
|
+
):
|
|
907
|
+
if "BLOCK_SIZE_N" in config and "BLOCK_SIZE_K" in config:
|
|
908
|
+
# optimal block config is set
|
|
909
|
+
return {}
|
|
910
|
+
if not use_moe_wna16_cuda:
|
|
911
|
+
# triton moe wna16 kernel
|
|
912
|
+
if num_valid_tokens // real_top_k == 1:
|
|
913
|
+
# if bs=1, use a smaller BLOCK_SIZE_N
|
|
914
|
+
return {"BLOCK_SIZE_N": 32, "BLOCK_SIZE_K": 64}
|
|
915
|
+
else:
|
|
916
|
+
return {"BLOCK_SIZE_N": 64, "BLOCK_SIZE_K": 32}
|
|
917
|
+
else:
|
|
918
|
+
# cuda moe wna16 kernel
|
|
919
|
+
# set default block_size 128, and increase them when num_blocks
|
|
920
|
+
# is too large.
|
|
921
|
+
block_size_n = 128
|
|
922
|
+
block_size_k = 128
|
|
923
|
+
if block_size_k <= group_size:
|
|
924
|
+
block_size_k = group_size
|
|
925
|
+
|
|
926
|
+
num_n_blocks = size_k // block_size_k
|
|
927
|
+
num_k_blocks = size_n // block_size_k
|
|
928
|
+
num_m_blocks = (
|
|
929
|
+
num_valid_tokens + block_size_m - 1
|
|
930
|
+
) / block_size_m + num_experts
|
|
931
|
+
if num_valid_tokens // real_top_k <= block_size_m:
|
|
932
|
+
num_m_blocks = min(num_m_blocks, num_valid_tokens)
|
|
933
|
+
num_blocks = num_m_blocks * num_n_blocks * num_k_blocks
|
|
934
|
+
|
|
935
|
+
if size_k % 256 == 0 and num_blocks >= 256 and block_size_k < 256:
|
|
936
|
+
block_size_k = 256
|
|
937
|
+
num_blocks = num_blocks // (256 // block_size_k)
|
|
938
|
+
|
|
939
|
+
if (
|
|
940
|
+
num_m_blocks <= 16
|
|
941
|
+
and size_k % (block_size_k * 2) == 0
|
|
942
|
+
and size_k % (block_size_k * 2) == 0
|
|
943
|
+
and block_size_k <= 512
|
|
944
|
+
and num_blocks >= 512
|
|
945
|
+
):
|
|
946
|
+
block_size_k = block_size_k * 2
|
|
947
|
+
num_blocks = num_blocks // 2
|
|
948
|
+
|
|
949
|
+
if num_blocks > 1024:
|
|
950
|
+
block_size_n = 256
|
|
951
|
+
num_n_blocks = num_n_blocks // 2
|
|
952
|
+
num_blocks = num_blocks // 2
|
|
953
|
+
|
|
954
|
+
if size_n <= 1024 and num_blocks >= 1024:
|
|
955
|
+
# The kernel performance got much better with BLOCK_SIZE_N=1024
|
|
956
|
+
# when num_blocks is large, event when N is small.
|
|
957
|
+
# Not sure why, maybe it force the CUDA SM process only one block
|
|
958
|
+
# at the same time.
|
|
959
|
+
block_size_n = 1024
|
|
960
|
+
|
|
961
|
+
return {"BLOCK_SIZE_N": block_size_n, "BLOCK_SIZE_K": block_size_k}
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
def should_moe_wna16_use_cuda(
|
|
965
|
+
num_valid_tokens: int, group_size: int, num_experts: int, bit: int
|
|
966
|
+
):
|
|
967
|
+
return (
|
|
968
|
+
current_platform.is_cuda()
|
|
969
|
+
and bit == 4
|
|
970
|
+
and group_size in [32, 64, 128]
|
|
971
|
+
and num_valid_tokens / num_experts <= 6
|
|
972
|
+
)
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
def get_default_config(
|
|
976
|
+
M: int,
|
|
977
|
+
E: int,
|
|
978
|
+
N: int,
|
|
979
|
+
K: int,
|
|
980
|
+
topk: int,
|
|
981
|
+
dtype: str | None,
|
|
982
|
+
block_shape: list[int] | None = None,
|
|
983
|
+
) -> dict[str, int]:
|
|
984
|
+
if vllm_is_batch_invariant():
|
|
985
|
+
config = {
|
|
986
|
+
"BLOCK_SIZE_M": 64,
|
|
987
|
+
"BLOCK_SIZE_N": 64,
|
|
988
|
+
"BLOCK_SIZE_K": 32,
|
|
989
|
+
"GROUP_SIZE_M": 8,
|
|
990
|
+
"SPLIT_K": 1,
|
|
991
|
+
}
|
|
992
|
+
return config
|
|
993
|
+
|
|
994
|
+
if dtype == "fp8_w8a8" and block_shape is not None:
|
|
995
|
+
# Block-wise quant: BLOCK_SIZE_N must be divisible by block_shape[0]
|
|
996
|
+
# BLOCK_SIZE_K must be divisible by block_shape[1]
|
|
997
|
+
# num_stages=3 can cause triton.runtime.errors.OutOfResources
|
|
998
|
+
# on ROCm, set it to 2 instead.
|
|
999
|
+
config = {
|
|
1000
|
+
"BLOCK_SIZE_M": 64,
|
|
1001
|
+
"BLOCK_SIZE_N": block_shape[0],
|
|
1002
|
+
"BLOCK_SIZE_K": block_shape[1],
|
|
1003
|
+
"GROUP_SIZE_M": 32,
|
|
1004
|
+
"SPLIT_K": 1,
|
|
1005
|
+
"num_warps": 4,
|
|
1006
|
+
"num_stages": 3 if not current_platform.is_rocm() else 2,
|
|
1007
|
+
}
|
|
1008
|
+
elif dtype in ["int4_w4a16", "int8_w8a16"] and block_shape is not None:
|
|
1009
|
+
# moe wna16 kernels
|
|
1010
|
+
# only set BLOCK_SIZE_M
|
|
1011
|
+
# BLOCK_SIZE_N and BLOCK_SIZE_K would be set later
|
|
1012
|
+
bit = 4 if dtype == "int4_w4a16" else 8
|
|
1013
|
+
use_moe_wna16_cuda = should_moe_wna16_use_cuda(M * topk, block_shape[1], E, bit)
|
|
1014
|
+
if use_moe_wna16_cuda:
|
|
1015
|
+
config = {"BLOCK_SIZE_M": min(16, M), "SPLIT_K": 1}
|
|
1016
|
+
elif M <= 20:
|
|
1017
|
+
config = {"BLOCK_SIZE_M": 16, "GROUP_SIZE_M": 1, "SPLIT_K": 1}
|
|
1018
|
+
elif M <= 40:
|
|
1019
|
+
config = {"BLOCK_SIZE_M": 32, "GROUP_SIZE_M": 1, "SPLIT_K": 1}
|
|
1020
|
+
else:
|
|
1021
|
+
config = {"BLOCK_SIZE_M": 64, "GROUP_SIZE_M": 1, "SPLIT_K": 1}
|
|
1022
|
+
elif M <= E:
|
|
1023
|
+
config = {
|
|
1024
|
+
"BLOCK_SIZE_M": 16,
|
|
1025
|
+
"BLOCK_SIZE_N": 32,
|
|
1026
|
+
"BLOCK_SIZE_K": 64,
|
|
1027
|
+
"GROUP_SIZE_M": 1,
|
|
1028
|
+
"SPLIT_K": 1,
|
|
1029
|
+
}
|
|
1030
|
+
else:
|
|
1031
|
+
config = {
|
|
1032
|
+
"BLOCK_SIZE_M": 64,
|
|
1033
|
+
"BLOCK_SIZE_N": 64,
|
|
1034
|
+
"BLOCK_SIZE_K": 32,
|
|
1035
|
+
"GROUP_SIZE_M": 8,
|
|
1036
|
+
"SPLIT_K": 1,
|
|
1037
|
+
}
|
|
1038
|
+
return config
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
def try_get_optimal_moe_config(
|
|
1042
|
+
w1_shape: tuple[int, ...],
|
|
1043
|
+
w2_shape: tuple[int, ...],
|
|
1044
|
+
top_k: int,
|
|
1045
|
+
dtype: str | None,
|
|
1046
|
+
M: int,
|
|
1047
|
+
block_shape: list[int] | None = None,
|
|
1048
|
+
) -> dict[str, int]:
|
|
1049
|
+
from vllm.model_executor.layers.fused_moe import get_config
|
|
1050
|
+
|
|
1051
|
+
override_config = get_config()
|
|
1052
|
+
if override_config:
|
|
1053
|
+
config = override_config
|
|
1054
|
+
else:
|
|
1055
|
+
# First try to load optimal config from the file
|
|
1056
|
+
E, _, N = w2_shape
|
|
1057
|
+
if dtype == "int4_w4a16":
|
|
1058
|
+
N = N * 2
|
|
1059
|
+
block_n = block_shape[0] if block_shape else 0
|
|
1060
|
+
block_k = block_shape[1] if block_shape else 0
|
|
1061
|
+
configs = get_moe_configs(E, N, dtype, block_n, block_k)
|
|
1062
|
+
|
|
1063
|
+
if configs:
|
|
1064
|
+
# If an optimal configuration map has been found, look up the
|
|
1065
|
+
# optimal config
|
|
1066
|
+
config = configs[min(configs.keys(), key=lambda x: abs(x - M))]
|
|
1067
|
+
else:
|
|
1068
|
+
# Else use the default config
|
|
1069
|
+
config = get_default_config(M, E, N, w1_shape[2], top_k, dtype, block_shape)
|
|
1070
|
+
return config
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
def vllm_topk_softmax(
|
|
1074
|
+
topk_weights: torch.Tensor,
|
|
1075
|
+
topk_indices: torch.Tensor,
|
|
1076
|
+
token_expert_indices: torch.Tensor,
|
|
1077
|
+
gating_output: torch.Tensor,
|
|
1078
|
+
renormalize: bool,
|
|
1079
|
+
) -> tuple[torch.Tensor, ...]:
|
|
1080
|
+
ops.topk_softmax(
|
|
1081
|
+
topk_weights,
|
|
1082
|
+
topk_indices,
|
|
1083
|
+
token_expert_indices,
|
|
1084
|
+
gating_output,
|
|
1085
|
+
renormalize,
|
|
1086
|
+
)
|
|
1087
|
+
|
|
1088
|
+
return topk_weights, topk_indices
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
def dispatch_topk_func(
|
|
1092
|
+
use_rocm_aiter: bool = False,
|
|
1093
|
+
) -> Callable[..., tuple[torch.Tensor, ...]]:
|
|
1094
|
+
if use_rocm_aiter:
|
|
1095
|
+
return rocm_aiter_ops.topk_softmax
|
|
1096
|
+
return vllm_topk_softmax
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
def fused_topk(
|
|
1100
|
+
hidden_states: torch.Tensor,
|
|
1101
|
+
gating_output: torch.Tensor,
|
|
1102
|
+
topk: int,
|
|
1103
|
+
renormalize: bool,
|
|
1104
|
+
indices_type: torch.dtype | None = None,
|
|
1105
|
+
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
|
1106
|
+
assert hidden_states.size(0) == gating_output.size(0), "Number of tokens mismatch"
|
|
1107
|
+
|
|
1108
|
+
M, _ = hidden_states.size()
|
|
1109
|
+
|
|
1110
|
+
topk_weights = torch.empty(
|
|
1111
|
+
M, topk, dtype=torch.float32, device=hidden_states.device
|
|
1112
|
+
)
|
|
1113
|
+
topk_ids = torch.empty(
|
|
1114
|
+
M,
|
|
1115
|
+
topk,
|
|
1116
|
+
dtype=torch.int32 if indices_type is None else indices_type,
|
|
1117
|
+
device=hidden_states.device,
|
|
1118
|
+
)
|
|
1119
|
+
token_expert_indices = torch.empty(
|
|
1120
|
+
M, topk, dtype=torch.int32, device=hidden_states.device
|
|
1121
|
+
)
|
|
1122
|
+
|
|
1123
|
+
topk_func = dispatch_topk_func(use_rocm_aiter=rocm_aiter_ops.is_fused_moe_enabled())
|
|
1124
|
+
topk_weights, topk_ids = topk_func(
|
|
1125
|
+
topk_weights, topk_ids, token_expert_indices, gating_output, renormalize
|
|
1126
|
+
)
|
|
1127
|
+
|
|
1128
|
+
return topk_weights, topk_ids, token_expert_indices
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
def fused_topk_bias(
|
|
1132
|
+
hidden_states: torch.Tensor,
|
|
1133
|
+
gating_output: torch.Tensor,
|
|
1134
|
+
e_score_correction_bias: torch.Tensor,
|
|
1135
|
+
topk: int,
|
|
1136
|
+
renormalize: bool,
|
|
1137
|
+
):
|
|
1138
|
+
n_routed_experts = gating_output.shape[-1]
|
|
1139
|
+
scores = gating_output.softmax(dim=-1)
|
|
1140
|
+
scores_for_choice = scores.view(
|
|
1141
|
+
-1, n_routed_experts
|
|
1142
|
+
) + e_score_correction_bias.unsqueeze(0)
|
|
1143
|
+
|
|
1144
|
+
# For batch invariance, use sorted=True to ensure deterministic expert selection
|
|
1145
|
+
use_sorted = vllm_is_batch_invariant()
|
|
1146
|
+
topk_indices = torch.topk(scores_for_choice, k=topk, dim=-1, sorted=use_sorted)[1]
|
|
1147
|
+
topk_weights = scores.gather(1, topk_indices)
|
|
1148
|
+
if renormalize:
|
|
1149
|
+
topk_weights = topk_weights / topk_weights.sum(dim=-1, keepdim=True)
|
|
1150
|
+
return topk_weights.to(torch.float32), topk_indices.to(torch.int32)
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
# This is used by the Deepseek-V2 and Deepseek-V3 model
|
|
1154
|
+
@torch.compile(
|
|
1155
|
+
dynamic=True,
|
|
1156
|
+
backend=current_platform.simple_compile_backend,
|
|
1157
|
+
options=maybe_disable_graph_partition(current_platform.simple_compile_backend),
|
|
1158
|
+
)
|
|
1159
|
+
def grouped_topk(
|
|
1160
|
+
hidden_states: torch.Tensor,
|
|
1161
|
+
gating_output: torch.Tensor,
|
|
1162
|
+
topk: int,
|
|
1163
|
+
renormalize: bool,
|
|
1164
|
+
num_expert_group: int = 0,
|
|
1165
|
+
topk_group: int = 0,
|
|
1166
|
+
scoring_func: str = "softmax",
|
|
1167
|
+
routed_scaling_factor: float = 1.0,
|
|
1168
|
+
e_score_correction_bias: torch.Tensor | None = None,
|
|
1169
|
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1170
|
+
if (
|
|
1171
|
+
envs.VLLM_USE_FUSED_MOE_GROUPED_TOPK
|
|
1172
|
+
and current_platform.is_cuda()
|
|
1173
|
+
and num_expert_group <= 32
|
|
1174
|
+
and topk <= 32
|
|
1175
|
+
and e_score_correction_bias is not None
|
|
1176
|
+
):
|
|
1177
|
+
return fused_grouped_topk(
|
|
1178
|
+
hidden_states=hidden_states,
|
|
1179
|
+
gating_output=gating_output,
|
|
1180
|
+
topk=topk,
|
|
1181
|
+
renormalize=renormalize,
|
|
1182
|
+
e_score_correction_bias=e_score_correction_bias,
|
|
1183
|
+
num_expert_group=num_expert_group,
|
|
1184
|
+
topk_group=topk_group,
|
|
1185
|
+
scoring_func=scoring_func,
|
|
1186
|
+
routed_scaling_factor=routed_scaling_factor,
|
|
1187
|
+
)
|
|
1188
|
+
|
|
1189
|
+
assert hidden_states.size(0) == gating_output.size(0), "Number of tokens mismatch"
|
|
1190
|
+
|
|
1191
|
+
if scoring_func == "softmax":
|
|
1192
|
+
scores = torch.softmax(gating_output, dim=-1)
|
|
1193
|
+
elif scoring_func == "sigmoid":
|
|
1194
|
+
scores = gating_output.sigmoid()
|
|
1195
|
+
else:
|
|
1196
|
+
raise ValueError(f"Unsupported scoring function: {scoring_func}")
|
|
1197
|
+
|
|
1198
|
+
num_token = scores.size(0)
|
|
1199
|
+
if e_score_correction_bias is not None:
|
|
1200
|
+
# Store original scores before applying correction bias. We use biased
|
|
1201
|
+
# scores for expert selection but original scores for routing weights
|
|
1202
|
+
original_scores = scores
|
|
1203
|
+
scores = scores + e_score_correction_bias.unsqueeze(0)
|
|
1204
|
+
group_scores = (
|
|
1205
|
+
scores.view(num_token, num_expert_group, -1).topk(2, dim=-1)[0].sum(dim=-1)
|
|
1206
|
+
)
|
|
1207
|
+
else:
|
|
1208
|
+
group_scores = (
|
|
1209
|
+
scores.view(num_token, num_expert_group, -1).max(dim=-1).values
|
|
1210
|
+
) # [n, n_group]
|
|
1211
|
+
|
|
1212
|
+
# For batch invariance, use sorted=True to ensure deterministic expert selection
|
|
1213
|
+
use_sorted = vllm_is_batch_invariant()
|
|
1214
|
+
group_idx = torch.topk(group_scores, k=topk_group, dim=-1, sorted=use_sorted)[
|
|
1215
|
+
1
|
|
1216
|
+
] # [n, top_k_group]
|
|
1217
|
+
group_mask = torch.zeros_like(group_scores) # [n, n_group]
|
|
1218
|
+
group_mask.scatter_(1, group_idx, 1) # [n, n_group]
|
|
1219
|
+
score_mask = (
|
|
1220
|
+
group_mask.unsqueeze(-1)
|
|
1221
|
+
.expand(num_token, num_expert_group, scores.size(-1) // num_expert_group)
|
|
1222
|
+
.reshape(num_token, -1)
|
|
1223
|
+
) # [n, e]
|
|
1224
|
+
tmp_scores = scores.masked_fill(~score_mask.bool(), float("-inf")) # [n, e]
|
|
1225
|
+
|
|
1226
|
+
if e_score_correction_bias is not None:
|
|
1227
|
+
topk_ids = torch.topk(tmp_scores, k=topk, dim=-1, sorted=use_sorted)[1]
|
|
1228
|
+
# Use original unbiased scores for the routing weights
|
|
1229
|
+
topk_weights = original_scores.gather(1, topk_ids)
|
|
1230
|
+
else:
|
|
1231
|
+
topk_weights, topk_ids = torch.topk(
|
|
1232
|
+
tmp_scores, k=topk, dim=-1, sorted=use_sorted
|
|
1233
|
+
)
|
|
1234
|
+
|
|
1235
|
+
if renormalize:
|
|
1236
|
+
topk_weights = topk_weights / topk_weights.sum(dim=-1, keepdim=True)
|
|
1237
|
+
|
|
1238
|
+
if routed_scaling_factor != 1.0:
|
|
1239
|
+
topk_weights = topk_weights * routed_scaling_factor
|
|
1240
|
+
return topk_weights.to(torch.float32), topk_ids.to(torch.int32)
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
@torch.compile(dynamic=True, backend=current_platform.simple_compile_backend)
|
|
1244
|
+
def eplb_map_to_physical_and_record(
|
|
1245
|
+
topk_ids: torch.Tensor,
|
|
1246
|
+
expert_load_view: torch.Tensor,
|
|
1247
|
+
logical_to_physical_map: torch.Tensor,
|
|
1248
|
+
logical_replica_count: torch.Tensor,
|
|
1249
|
+
indices_type: torch.dtype | None = None,
|
|
1250
|
+
) -> torch.Tensor:
|
|
1251
|
+
"""
|
|
1252
|
+
Map the logical expert ids to physical expert ids
|
|
1253
|
+
and record the expert load metrics.
|
|
1254
|
+
|
|
1255
|
+
This will select a pseudo-random replica for each logical expert.
|
|
1256
|
+
Only used for EPLB.
|
|
1257
|
+
|
|
1258
|
+
Args:
|
|
1259
|
+
topk_ids: The logical expert ids.
|
|
1260
|
+
expert_load_view: The expert load view.
|
|
1261
|
+
logical_to_physical_map: The logical to physical map.
|
|
1262
|
+
logical_replica_count: The logical replica count.
|
|
1263
|
+
indices_type: The indices type.
|
|
1264
|
+
|
|
1265
|
+
Returns:
|
|
1266
|
+
The physical expert ids.
|
|
1267
|
+
"""
|
|
1268
|
+
|
|
1269
|
+
# 1. Convert the logical expert ids to physical expert ids
|
|
1270
|
+
# Directly select a random replica for each logical expert
|
|
1271
|
+
|
|
1272
|
+
# In case `indices_type` is not `torch.long` or `torch.int`,
|
|
1273
|
+
# e.g. `torch.uint32` as required by dispatch/combine kernels
|
|
1274
|
+
topk_ids_long = topk_ids.long()
|
|
1275
|
+
# Use (token position) modulo (replica count)
|
|
1276
|
+
# to deterministically choose a replica
|
|
1277
|
+
replica_count = logical_replica_count[topk_ids_long]
|
|
1278
|
+
# Flatten-position based index, reshaped back to `topk_ids` shape
|
|
1279
|
+
pos_indices = torch.arange(
|
|
1280
|
+
topk_ids.numel(), device=topk_ids.device, dtype=torch.long
|
|
1281
|
+
).reshape_as(topk_ids)
|
|
1282
|
+
# Compute pseudo-random indices by modulo
|
|
1283
|
+
replica_indices = (pos_indices % replica_count).unsqueeze(-1)
|
|
1284
|
+
physical_ids = (
|
|
1285
|
+
logical_to_physical_map[topk_ids_long].gather(-1, replica_indices).squeeze(-1)
|
|
1286
|
+
)
|
|
1287
|
+
|
|
1288
|
+
topk_ids = physical_ids
|
|
1289
|
+
|
|
1290
|
+
# 2. Record expert load metrics.
|
|
1291
|
+
|
|
1292
|
+
# TODO(bowen): When using `FusedMoEModularKernel`, this
|
|
1293
|
+
# can be done in a more unified way, since
|
|
1294
|
+
# `FusedMoEPrepareAndFinalize` will return the expert
|
|
1295
|
+
# token count, in some cases directly from the kernel.
|
|
1296
|
+
# However, now there are many code paths not using
|
|
1297
|
+
# the modular kernel, e.g. calling `fused_experts`,
|
|
1298
|
+
# so we decide to keep the logic here.
|
|
1299
|
+
#
|
|
1300
|
+
# If later refactor moved all the MoE kernel calls
|
|
1301
|
+
# to the modular kernel, we can move this logic there
|
|
1302
|
+
# to achieve better efficiency.
|
|
1303
|
+
|
|
1304
|
+
# `expert_load_view`: (num_physical_experts,)
|
|
1305
|
+
|
|
1306
|
+
# `torch.bincount` is not compilable, so use `scatter_add_` instead.
|
|
1307
|
+
topk_ids_flatten = topk_ids.flatten()
|
|
1308
|
+
expert_load_view.scatter_add_(
|
|
1309
|
+
dim=0,
|
|
1310
|
+
index=topk_ids_flatten.long(),
|
|
1311
|
+
src=torch.ones_like(topk_ids_flatten).to(expert_load_view),
|
|
1312
|
+
)
|
|
1313
|
+
|
|
1314
|
+
if indices_type is not None:
|
|
1315
|
+
topk_ids = topk_ids.to(dtype=indices_type)
|
|
1316
|
+
return topk_ids
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
def fused_grouped_topk(
|
|
1320
|
+
hidden_states: torch.Tensor,
|
|
1321
|
+
gating_output: torch.Tensor,
|
|
1322
|
+
topk: int,
|
|
1323
|
+
renormalize: bool,
|
|
1324
|
+
e_score_correction_bias: torch.Tensor,
|
|
1325
|
+
num_expert_group: int = 0,
|
|
1326
|
+
topk_group: int = 0,
|
|
1327
|
+
scoring_func: str = "softmax",
|
|
1328
|
+
routed_scaling_factor: float = 1.0,
|
|
1329
|
+
) -> tuple[torch.Tensor, torch.Tensor]:
|
|
1330
|
+
assert hidden_states.size(0) == gating_output.size(0), "Number of tokens mismatch"
|
|
1331
|
+
|
|
1332
|
+
if scoring_func == "sigmoid":
|
|
1333
|
+
# Fully fused kernel path for sigmoid
|
|
1334
|
+
topk_values, topk_indices = ops.grouped_topk(
|
|
1335
|
+
gating_output, # raw logits
|
|
1336
|
+
num_expert_group,
|
|
1337
|
+
topk_group,
|
|
1338
|
+
topk,
|
|
1339
|
+
renormalize,
|
|
1340
|
+
routed_scaling_factor,
|
|
1341
|
+
e_score_correction_bias.to(gating_output.dtype),
|
|
1342
|
+
1, # scoring_func=1 for sigmoid
|
|
1343
|
+
)
|
|
1344
|
+
elif scoring_func == "softmax":
|
|
1345
|
+
# Apply softmax in Python, then use fused kernel
|
|
1346
|
+
# TODO: Add support for softmax in kernel
|
|
1347
|
+
scores = torch.softmax(gating_output, dim=-1)
|
|
1348
|
+
topk_values, topk_indices = ops.grouped_topk(
|
|
1349
|
+
scores, # pre-computed scores
|
|
1350
|
+
num_expert_group,
|
|
1351
|
+
topk_group,
|
|
1352
|
+
topk,
|
|
1353
|
+
renormalize,
|
|
1354
|
+
routed_scaling_factor,
|
|
1355
|
+
e_score_correction_bias.to(gating_output.dtype),
|
|
1356
|
+
0, # scoring_func=0 (no activation, scores already computed)
|
|
1357
|
+
)
|
|
1358
|
+
else:
|
|
1359
|
+
raise ValueError(f"Unsupported scoring function: {scoring_func}")
|
|
1360
|
+
|
|
1361
|
+
# Fused kernel outputs float32 values and int32 indices directly
|
|
1362
|
+
return topk_values, topk_indices
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
def inplace_fused_experts(
|
|
1366
|
+
hidden_states: torch.Tensor,
|
|
1367
|
+
w1: torch.Tensor,
|
|
1368
|
+
w2: torch.Tensor,
|
|
1369
|
+
topk_weights: torch.Tensor,
|
|
1370
|
+
topk_ids: torch.Tensor,
|
|
1371
|
+
activation: str = "silu",
|
|
1372
|
+
apply_router_weight_on_input: bool = False,
|
|
1373
|
+
use_fp8_w8a8: bool = False,
|
|
1374
|
+
use_int8_w8a8: bool = False,
|
|
1375
|
+
use_int8_w8a16: bool = False,
|
|
1376
|
+
use_int4_w4a16: bool = False,
|
|
1377
|
+
ocp_mx_scheme: str | None = None,
|
|
1378
|
+
per_channel_quant: bool = False,
|
|
1379
|
+
global_num_experts: int = -1,
|
|
1380
|
+
expert_map: torch.Tensor | None = None,
|
|
1381
|
+
w1_scale: torch.Tensor | None = None,
|
|
1382
|
+
w2_scale: torch.Tensor | None = None,
|
|
1383
|
+
w1_zp: torch.Tensor | None = None,
|
|
1384
|
+
w2_zp: torch.Tensor | None = None,
|
|
1385
|
+
a1_scale: torch.Tensor | None = None,
|
|
1386
|
+
a2_scale: torch.Tensor | None = None,
|
|
1387
|
+
block_shape: list[int] | None = None,
|
|
1388
|
+
w1_bias: torch.Tensor | None = None,
|
|
1389
|
+
w2_bias: torch.Tensor | None = None,
|
|
1390
|
+
) -> None:
|
|
1391
|
+
fused_experts_impl(
|
|
1392
|
+
hidden_states,
|
|
1393
|
+
w1,
|
|
1394
|
+
w2,
|
|
1395
|
+
topk_weights,
|
|
1396
|
+
topk_ids,
|
|
1397
|
+
True,
|
|
1398
|
+
activation,
|
|
1399
|
+
apply_router_weight_on_input,
|
|
1400
|
+
use_fp8_w8a8,
|
|
1401
|
+
use_int8_w8a8,
|
|
1402
|
+
use_int8_w8a16,
|
|
1403
|
+
use_int4_w4a16,
|
|
1404
|
+
ocp_mx_scheme,
|
|
1405
|
+
per_channel_quant,
|
|
1406
|
+
global_num_experts,
|
|
1407
|
+
expert_map,
|
|
1408
|
+
w1_scale,
|
|
1409
|
+
w2_scale,
|
|
1410
|
+
w1_zp,
|
|
1411
|
+
w2_zp,
|
|
1412
|
+
a1_scale,
|
|
1413
|
+
a2_scale,
|
|
1414
|
+
block_shape,
|
|
1415
|
+
w1_bias,
|
|
1416
|
+
w2_bias,
|
|
1417
|
+
)
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
def inplace_fused_experts_fake(
|
|
1421
|
+
hidden_states: torch.Tensor,
|
|
1422
|
+
w1: torch.Tensor,
|
|
1423
|
+
w2: torch.Tensor,
|
|
1424
|
+
topk_weights: torch.Tensor,
|
|
1425
|
+
topk_ids: torch.Tensor,
|
|
1426
|
+
activation: str = "silu",
|
|
1427
|
+
apply_router_weight_on_input: bool = False,
|
|
1428
|
+
use_fp8_w8a8: bool = False,
|
|
1429
|
+
use_int8_w8a8: bool = False,
|
|
1430
|
+
use_int8_w8a16: bool = False,
|
|
1431
|
+
use_int4_w4a16: bool = False,
|
|
1432
|
+
ocp_mx_scheme: str | None = None,
|
|
1433
|
+
per_channel_quant: bool = False,
|
|
1434
|
+
global_num_experts: int = -1,
|
|
1435
|
+
expert_map: torch.Tensor | None = None,
|
|
1436
|
+
w1_scale: torch.Tensor | None = None,
|
|
1437
|
+
w2_scale: torch.Tensor | None = None,
|
|
1438
|
+
w1_zp: torch.Tensor | None = None,
|
|
1439
|
+
w2_zp: torch.Tensor | None = None,
|
|
1440
|
+
a1_scale: torch.Tensor | None = None,
|
|
1441
|
+
a2_scale: torch.Tensor | None = None,
|
|
1442
|
+
block_shape: list[int] | None = None,
|
|
1443
|
+
w1_bias: torch.Tensor | None = None,
|
|
1444
|
+
w2_bias: torch.Tensor | None = None,
|
|
1445
|
+
) -> None:
|
|
1446
|
+
pass
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
direct_register_custom_op(
|
|
1450
|
+
op_name="inplace_fused_experts",
|
|
1451
|
+
op_func=inplace_fused_experts,
|
|
1452
|
+
mutates_args=["hidden_states"],
|
|
1453
|
+
fake_impl=inplace_fused_experts_fake,
|
|
1454
|
+
tags=(
|
|
1455
|
+
()
|
|
1456
|
+
if is_torch_equal_or_newer("2.7.0")
|
|
1457
|
+
else (torch.Tag.needs_fixed_stride_order,)
|
|
1458
|
+
),
|
|
1459
|
+
)
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
def outplace_fused_experts(
|
|
1463
|
+
hidden_states: torch.Tensor,
|
|
1464
|
+
w1: torch.Tensor,
|
|
1465
|
+
w2: torch.Tensor,
|
|
1466
|
+
topk_weights: torch.Tensor,
|
|
1467
|
+
topk_ids: torch.Tensor,
|
|
1468
|
+
activation: str = "silu",
|
|
1469
|
+
apply_router_weight_on_input: bool = False,
|
|
1470
|
+
use_fp8_w8a8: bool = False,
|
|
1471
|
+
use_int8_w8a8: bool = False,
|
|
1472
|
+
use_int8_w8a16: bool = False,
|
|
1473
|
+
use_int4_w4a16: bool = False,
|
|
1474
|
+
ocp_mx_scheme: str | None = None,
|
|
1475
|
+
per_channel_quant: bool = False,
|
|
1476
|
+
global_num_experts: int = -1,
|
|
1477
|
+
expert_map: torch.Tensor | None = None,
|
|
1478
|
+
w1_scale: torch.Tensor | None = None,
|
|
1479
|
+
w2_scale: torch.Tensor | None = None,
|
|
1480
|
+
w1_zp: torch.Tensor | None = None,
|
|
1481
|
+
w2_zp: torch.Tensor | None = None,
|
|
1482
|
+
a1_scale: torch.Tensor | None = None,
|
|
1483
|
+
a2_scale: torch.Tensor | None = None,
|
|
1484
|
+
block_shape: list[int] | None = None,
|
|
1485
|
+
w1_bias: torch.Tensor | None = None,
|
|
1486
|
+
w2_bias: torch.Tensor | None = None,
|
|
1487
|
+
) -> torch.Tensor:
|
|
1488
|
+
return fused_experts_impl(
|
|
1489
|
+
hidden_states,
|
|
1490
|
+
w1,
|
|
1491
|
+
w2,
|
|
1492
|
+
topk_weights,
|
|
1493
|
+
topk_ids,
|
|
1494
|
+
False,
|
|
1495
|
+
activation,
|
|
1496
|
+
apply_router_weight_on_input,
|
|
1497
|
+
use_fp8_w8a8,
|
|
1498
|
+
use_int8_w8a8,
|
|
1499
|
+
use_int8_w8a16,
|
|
1500
|
+
use_int4_w4a16,
|
|
1501
|
+
ocp_mx_scheme,
|
|
1502
|
+
per_channel_quant,
|
|
1503
|
+
global_num_experts,
|
|
1504
|
+
expert_map,
|
|
1505
|
+
w1_scale,
|
|
1506
|
+
w2_scale,
|
|
1507
|
+
w1_zp,
|
|
1508
|
+
w2_zp,
|
|
1509
|
+
a1_scale,
|
|
1510
|
+
a2_scale,
|
|
1511
|
+
block_shape,
|
|
1512
|
+
w1_bias,
|
|
1513
|
+
w2_bias,
|
|
1514
|
+
)
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
def outplace_fused_experts_fake(
|
|
1518
|
+
hidden_states: torch.Tensor,
|
|
1519
|
+
w1: torch.Tensor,
|
|
1520
|
+
w2: torch.Tensor,
|
|
1521
|
+
topk_weights: torch.Tensor,
|
|
1522
|
+
topk_ids: torch.Tensor,
|
|
1523
|
+
activation: str = "silu",
|
|
1524
|
+
use_fp8_w8a8: bool = False,
|
|
1525
|
+
use_int8_w8a8: bool = False,
|
|
1526
|
+
use_int8_w8a16: bool = False,
|
|
1527
|
+
use_int4_w4a16: bool = False,
|
|
1528
|
+
ocp_mx_scheme: str | None = None,
|
|
1529
|
+
per_channel_quant: bool = False,
|
|
1530
|
+
global_num_experts: int = -1,
|
|
1531
|
+
expert_map: torch.Tensor | None = None,
|
|
1532
|
+
w1_scale: torch.Tensor | None = None,
|
|
1533
|
+
w2_scale: torch.Tensor | None = None,
|
|
1534
|
+
w1_zp: torch.Tensor | None = None,
|
|
1535
|
+
w2_zp: torch.Tensor | None = None,
|
|
1536
|
+
a1_scale: torch.Tensor | None = None,
|
|
1537
|
+
a2_scale: torch.Tensor | None = None,
|
|
1538
|
+
block_shape: list[int] | None = None,
|
|
1539
|
+
w1_bias: torch.Tensor | None = None,
|
|
1540
|
+
w2_bias: torch.Tensor | None = None,
|
|
1541
|
+
) -> torch.Tensor:
|
|
1542
|
+
return torch.empty_like(hidden_states)
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
direct_register_custom_op(
|
|
1546
|
+
op_name="outplace_fused_experts",
|
|
1547
|
+
op_func=outplace_fused_experts,
|
|
1548
|
+
fake_impl=outplace_fused_experts_fake,
|
|
1549
|
+
tags=(
|
|
1550
|
+
()
|
|
1551
|
+
if is_torch_equal_or_newer("2.7.0")
|
|
1552
|
+
else (torch.Tag.needs_fixed_stride_order,)
|
|
1553
|
+
),
|
|
1554
|
+
)
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
def torch_vllm_inplace_fused_experts(**kwargs) -> torch.Tensor:
|
|
1558
|
+
torch.ops.vllm.inplace_fused_experts(**kwargs)
|
|
1559
|
+
hidden_states = kwargs["hidden_states"]
|
|
1560
|
+
return hidden_states
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
def torch_vllm_outplace_fused_experts(**kwargs) -> torch.Tensor:
|
|
1564
|
+
return torch.ops.vllm.outplace_fused_experts(**kwargs)
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
def dispatch_fused_experts_func(inplace: bool) -> Callable[..., torch.Tensor]:
|
|
1568
|
+
if inplace and not disable_inplace():
|
|
1569
|
+
return torch_vllm_inplace_fused_experts
|
|
1570
|
+
return torch_vllm_outplace_fused_experts
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
# TODO (bnell): replace this with modular op. Can get rid of inplace/outplace
|
|
1574
|
+
# torch ops.
|
|
1575
|
+
def fused_experts(
|
|
1576
|
+
hidden_states: torch.Tensor,
|
|
1577
|
+
w1: torch.Tensor,
|
|
1578
|
+
w2: torch.Tensor,
|
|
1579
|
+
topk_weights: torch.Tensor,
|
|
1580
|
+
topk_ids: torch.Tensor,
|
|
1581
|
+
inplace: bool = False,
|
|
1582
|
+
activation: str = "silu",
|
|
1583
|
+
apply_router_weight_on_input: bool = False,
|
|
1584
|
+
global_num_experts: int = -1,
|
|
1585
|
+
expert_map: torch.Tensor | None = None,
|
|
1586
|
+
quant_config: FusedMoEQuantConfig | None = None,
|
|
1587
|
+
allow_deep_gemm: bool = False,
|
|
1588
|
+
allow_cutlass_block_scaled_grouped_gemm: bool = False,
|
|
1589
|
+
) -> torch.Tensor:
|
|
1590
|
+
if quant_config is None:
|
|
1591
|
+
quant_config = FUSED_MOE_UNQUANTIZED_CONFIG
|
|
1592
|
+
use_fp8_w8a8 = quant_config.use_fp8_w8a8
|
|
1593
|
+
|
|
1594
|
+
# For now, disable DeepGemm for small N (<= 512) until better
|
|
1595
|
+
# permute/unpermute ops are available.
|
|
1596
|
+
# However, on B200, we use DeepGemm for all cases because they only support
|
|
1597
|
+
# E8M0 scale, which means we requantize the weight and input to the specific
|
|
1598
|
+
# scale. Fallen back to cutlass or triton for some cases would cause
|
|
1599
|
+
# accuracy issue.
|
|
1600
|
+
if (
|
|
1601
|
+
allow_deep_gemm
|
|
1602
|
+
and quant_config.use_fp8_w8a8
|
|
1603
|
+
and (is_deep_gemm_e8m0_used() or _valid_deep_gemm(hidden_states, w1, w2))
|
|
1604
|
+
):
|
|
1605
|
+
assert quant_config is not None
|
|
1606
|
+
assert apply_router_weight_on_input is False
|
|
1607
|
+
return deep_gemm_moe_fp8(
|
|
1608
|
+
hidden_states=hidden_states,
|
|
1609
|
+
w1=w1,
|
|
1610
|
+
w2=w2,
|
|
1611
|
+
topk_weights=topk_weights,
|
|
1612
|
+
topk_ids=topk_ids,
|
|
1613
|
+
inplace=inplace,
|
|
1614
|
+
activation=activation,
|
|
1615
|
+
global_num_experts=global_num_experts,
|
|
1616
|
+
expert_map=expert_map,
|
|
1617
|
+
w1_scale=quant_config.w1_scale,
|
|
1618
|
+
w2_scale=quant_config.w2_scale,
|
|
1619
|
+
a1_scale=quant_config.a1_scale,
|
|
1620
|
+
a2_scale=quant_config.a2_scale,
|
|
1621
|
+
apply_router_weight_on_input=apply_router_weight_on_input,
|
|
1622
|
+
)
|
|
1623
|
+
elif (
|
|
1624
|
+
allow_cutlass_block_scaled_grouped_gemm
|
|
1625
|
+
and use_fp8_w8a8
|
|
1626
|
+
and _valid_cutlass_block_scaled_grouped_gemm(
|
|
1627
|
+
w1, w2, inplace, activation, apply_router_weight_on_input, expert_map
|
|
1628
|
+
)
|
|
1629
|
+
):
|
|
1630
|
+
assert quant_config is not None
|
|
1631
|
+
return run_cutlass_block_scaled_fused_experts(
|
|
1632
|
+
a=hidden_states,
|
|
1633
|
+
w1=w1,
|
|
1634
|
+
w2=w2,
|
|
1635
|
+
w1_scale=quant_config.w1_scale,
|
|
1636
|
+
w2_scale=quant_config.w2_scale,
|
|
1637
|
+
topk_weights=topk_weights,
|
|
1638
|
+
topk_ids=topk_ids,
|
|
1639
|
+
)
|
|
1640
|
+
else:
|
|
1641
|
+
return dispatch_fused_experts_func(inplace)(
|
|
1642
|
+
hidden_states=hidden_states,
|
|
1643
|
+
w1=w1,
|
|
1644
|
+
w2=w2,
|
|
1645
|
+
topk_weights=topk_weights,
|
|
1646
|
+
topk_ids=topk_ids,
|
|
1647
|
+
activation=activation,
|
|
1648
|
+
apply_router_weight_on_input=apply_router_weight_on_input,
|
|
1649
|
+
use_fp8_w8a8=quant_config.use_fp8_w8a8,
|
|
1650
|
+
use_int8_w8a8=quant_config.use_int8_w8a8,
|
|
1651
|
+
use_int8_w8a16=quant_config.use_int8_w8a16,
|
|
1652
|
+
use_int4_w4a16=quant_config.use_int4_w4a16,
|
|
1653
|
+
ocp_mx_scheme=quant_config.ocp_mx_scheme,
|
|
1654
|
+
per_channel_quant=quant_config.per_act_token_quant,
|
|
1655
|
+
global_num_experts=global_num_experts,
|
|
1656
|
+
expert_map=expert_map,
|
|
1657
|
+
w1_scale=quant_config.w1_scale,
|
|
1658
|
+
w2_scale=quant_config.w2_scale,
|
|
1659
|
+
w1_zp=quant_config.w1_zp,
|
|
1660
|
+
w2_zp=quant_config.w2_zp,
|
|
1661
|
+
a1_scale=quant_config.a1_scale,
|
|
1662
|
+
a2_scale=quant_config.a2_scale,
|
|
1663
|
+
block_shape=quant_config.block_shape,
|
|
1664
|
+
w1_bias=quant_config.w1_bias,
|
|
1665
|
+
w2_bias=quant_config.w2_bias,
|
|
1666
|
+
)
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
SILU_NO_MUL: str = activation_without_mul("silu")
|
|
1670
|
+
GELU_NO_MUL: str = activation_without_mul("gelu")
|
|
1671
|
+
RELU2_NO_MUL: str = activation_without_mul("relu2")
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
def _get_config_quant_dtype(
|
|
1675
|
+
use_fp8_w8a8: bool,
|
|
1676
|
+
use_int8_w8a8: bool,
|
|
1677
|
+
ocp_mx_scheme: str | None,
|
|
1678
|
+
) -> None | torch.dtype | str:
|
|
1679
|
+
"""
|
|
1680
|
+
Get the quantization type based on the quantization strategy flags.
|
|
1681
|
+
We don't have a quant_config at this point so we need to work backwards.
|
|
1682
|
+
A return type of None means no quantization is required because the
|
|
1683
|
+
input is unquantized or has been quantized prior to calling
|
|
1684
|
+
fused_experts_impl.
|
|
1685
|
+
"""
|
|
1686
|
+
if use_fp8_w8a8:
|
|
1687
|
+
return torch.float8_e4m3fn
|
|
1688
|
+
elif use_int8_w8a8:
|
|
1689
|
+
return torch.int8
|
|
1690
|
+
elif ocp_mx_scheme == "w_mxfp4_a_mxfp4":
|
|
1691
|
+
return "mxfp4"
|
|
1692
|
+
elif ocp_mx_scheme in {"w_mxfp4_a_mxfp6_e3m2", "w_mxfp6_e3m2_a_mxfp6_e3m2"}:
|
|
1693
|
+
return "mxfp6_e3m2"
|
|
1694
|
+
elif ocp_mx_scheme in {"w_mxfp4_a_mxfp6_e2m3", "w_mxfp6_e2m3_a_mxfp6_e2m3"}:
|
|
1695
|
+
return "mxfp6_e2m3"
|
|
1696
|
+
return None
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
def fused_experts_impl(
|
|
1700
|
+
hidden_states: torch.Tensor,
|
|
1701
|
+
w1: torch.Tensor,
|
|
1702
|
+
w2: torch.Tensor,
|
|
1703
|
+
topk_weights: torch.Tensor,
|
|
1704
|
+
topk_ids: torch.Tensor,
|
|
1705
|
+
inplace: bool = False,
|
|
1706
|
+
activation: str = "silu",
|
|
1707
|
+
apply_router_weight_on_input: bool = False,
|
|
1708
|
+
use_fp8_w8a8: bool = False,
|
|
1709
|
+
use_int8_w8a8: bool = False,
|
|
1710
|
+
use_int8_w8a16: bool = False,
|
|
1711
|
+
use_int4_w4a16: bool = False,
|
|
1712
|
+
ocp_mx_scheme: str | None = None,
|
|
1713
|
+
per_channel_quant: bool = False,
|
|
1714
|
+
global_num_experts: int = -1,
|
|
1715
|
+
expert_map: torch.Tensor | None = None,
|
|
1716
|
+
w1_scale: torch.Tensor | None = None,
|
|
1717
|
+
w2_scale: torch.Tensor | None = None,
|
|
1718
|
+
w1_zp: torch.Tensor | None = None,
|
|
1719
|
+
w2_zp: torch.Tensor | None = None,
|
|
1720
|
+
a1_scale: torch.Tensor | None = None,
|
|
1721
|
+
a2_scale: torch.Tensor | None = None,
|
|
1722
|
+
block_shape: list[int] | None = None,
|
|
1723
|
+
w1_bias: torch.Tensor | None = None,
|
|
1724
|
+
w2_bias: torch.Tensor | None = None,
|
|
1725
|
+
) -> torch.Tensor:
|
|
1726
|
+
# Check constraints.
|
|
1727
|
+
if use_int4_w4a16:
|
|
1728
|
+
assert hidden_states.size(1) // 2 == w1.size(2), "Hidden size mismatch"
|
|
1729
|
+
elif ocp_mx_scheme is not None:
|
|
1730
|
+
if ocp_mx_scheme in {
|
|
1731
|
+
"w_mxfp4_a_mxfp4",
|
|
1732
|
+
"w_mxfp4_a_mxfp6_e3m2",
|
|
1733
|
+
"w_mxfp4_a_mxfp6_e2m3",
|
|
1734
|
+
}:
|
|
1735
|
+
# 16bit activation and fp4x2 packed weight
|
|
1736
|
+
assert hidden_states.size(1) == w1.size(2) * 2, "hidden size mismatch"
|
|
1737
|
+
elif ocp_mx_scheme in {
|
|
1738
|
+
"w_mxfp6_e3m2_a_mxfp6_e3m2",
|
|
1739
|
+
"w_mxfp6_e2m3_a_mxfp6_e2m3",
|
|
1740
|
+
}:
|
|
1741
|
+
assert hidden_states.size(1) == (w1.size(2) * 4) // 3, (
|
|
1742
|
+
"hidden size mismatch"
|
|
1743
|
+
)
|
|
1744
|
+
else:
|
|
1745
|
+
raise NotImplementedError(f"Unsupported ocp_mx_scheme={ocp_mx_scheme}")
|
|
1746
|
+
else:
|
|
1747
|
+
assert hidden_states.size(1) == w1.size(2), (
|
|
1748
|
+
f"Hidden size mismatch {hidden_states.size(1)} != {w1.size(2)}"
|
|
1749
|
+
)
|
|
1750
|
+
|
|
1751
|
+
assert topk_weights.size() == topk_ids.size(), "topk shape mismatch"
|
|
1752
|
+
assert hidden_states.is_contiguous(), "Hidden_states must be contiguous"
|
|
1753
|
+
assert w1.stride(-1) == 1, "Stride of last dimension must be 1"
|
|
1754
|
+
assert w2.stride(-1) == 1, "Stride of last dimension must be 1"
|
|
1755
|
+
assert hidden_states.dtype in [torch.float32, torch.float16, torch.bfloat16]
|
|
1756
|
+
|
|
1757
|
+
num_tokens = hidden_states.size(0)
|
|
1758
|
+
E, N, _ = w1.size()
|
|
1759
|
+
K = w2.size(1)
|
|
1760
|
+
if global_num_experts == -1:
|
|
1761
|
+
global_num_experts = E
|
|
1762
|
+
top_k_num = topk_ids.size(1)
|
|
1763
|
+
# We execute the fused_moe kernel in chunks to circumvent this issue:
|
|
1764
|
+
# https://github.com/vllm-project/vllm/issues/5938
|
|
1765
|
+
CHUNK_SIZE = envs.VLLM_FUSED_MOE_CHUNK_SIZE
|
|
1766
|
+
M = min(num_tokens, CHUNK_SIZE)
|
|
1767
|
+
|
|
1768
|
+
config_dtype = _get_config_dtype_str(
|
|
1769
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1770
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1771
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1772
|
+
ocp_mx_scheme=ocp_mx_scheme,
|
|
1773
|
+
dtype=hidden_states.dtype,
|
|
1774
|
+
)
|
|
1775
|
+
|
|
1776
|
+
# Note: for use_int8_w8a16 or use_int4_w4a16, the activations are
|
|
1777
|
+
# quantized prior to calling fused_experts.
|
|
1778
|
+
quant_dtype = _get_config_quant_dtype(
|
|
1779
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1780
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1781
|
+
ocp_mx_scheme=ocp_mx_scheme,
|
|
1782
|
+
)
|
|
1783
|
+
|
|
1784
|
+
get_config_func = functools.partial(
|
|
1785
|
+
try_get_optimal_moe_config,
|
|
1786
|
+
w1.size(),
|
|
1787
|
+
w2.size(),
|
|
1788
|
+
top_k_num,
|
|
1789
|
+
config_dtype,
|
|
1790
|
+
block_shape=block_shape,
|
|
1791
|
+
)
|
|
1792
|
+
|
|
1793
|
+
config = get_config_func(M)
|
|
1794
|
+
|
|
1795
|
+
# We can reuse the memory between these because by the time we need
|
|
1796
|
+
# cache3, we're done with cache1
|
|
1797
|
+
cache13 = torch.empty(
|
|
1798
|
+
M * top_k_num * max(N, K),
|
|
1799
|
+
device=hidden_states.device,
|
|
1800
|
+
dtype=hidden_states.dtype,
|
|
1801
|
+
)
|
|
1802
|
+
intermediate_cache1 = cache13[: M * top_k_num * N].view(M, top_k_num, N)
|
|
1803
|
+
intermediate_cache3 = cache13[: M * top_k_num * K].view(M, top_k_num, K)
|
|
1804
|
+
|
|
1805
|
+
# This needs separate memory since it's used concurrently with cache1
|
|
1806
|
+
intermediate_cache2 = torch.empty(
|
|
1807
|
+
(M * top_k_num, N // 2), device=hidden_states.device, dtype=hidden_states.dtype
|
|
1808
|
+
)
|
|
1809
|
+
|
|
1810
|
+
if hidden_states.dtype == torch.bfloat16:
|
|
1811
|
+
compute_type = tl.bfloat16
|
|
1812
|
+
elif hidden_states.dtype == torch.float16:
|
|
1813
|
+
compute_type = tl.float16
|
|
1814
|
+
elif hidden_states.dtype == torch.float32:
|
|
1815
|
+
compute_type = tl.float32
|
|
1816
|
+
else:
|
|
1817
|
+
raise ValueError(f"Unsupported compute_type: {hidden_states.dtype}")
|
|
1818
|
+
|
|
1819
|
+
if inplace and not disable_inplace():
|
|
1820
|
+
out_hidden_states = hidden_states
|
|
1821
|
+
else:
|
|
1822
|
+
out_hidden_states = torch.empty_like(hidden_states)
|
|
1823
|
+
|
|
1824
|
+
if ocp_mx_scheme is not None:
|
|
1825
|
+
# TODO: On platforms for which `current_platform.supports_mx()` is True
|
|
1826
|
+
# and for which we have a native OCP mx fused MOE kernel,
|
|
1827
|
+
# this dequantization step should not be done.
|
|
1828
|
+
if ocp_mx_scheme in {
|
|
1829
|
+
OCP_MX_Scheme.w_mxfp4_a_mxfp4,
|
|
1830
|
+
OCP_MX_Scheme.w_mxfp4_a_mxfp6_e3m2,
|
|
1831
|
+
OCP_MX_Scheme.w_mxfp4_a_mxfp6_e2m3,
|
|
1832
|
+
}:
|
|
1833
|
+
# Weight has to be dequantized for mxfp4 emulation.
|
|
1834
|
+
w1 = dequant_mxfp4(w1, w1_scale, hidden_states.dtype)
|
|
1835
|
+
w1_scale = None
|
|
1836
|
+
w2 = dequant_mxfp4(w2, w2_scale, hidden_states.dtype)
|
|
1837
|
+
w2_scale = None
|
|
1838
|
+
elif ocp_mx_scheme == OCP_MX_Scheme.w_mxfp6_e3m2_a_mxfp6_e3m2:
|
|
1839
|
+
w1 = dequant_mxfp6(
|
|
1840
|
+
w1, w1_scale, quant_dtype="fp6_e3m2", float_dtype=hidden_states.dtype
|
|
1841
|
+
)
|
|
1842
|
+
w1_scale = None
|
|
1843
|
+
w2 = dequant_mxfp6(
|
|
1844
|
+
w2, w2_scale, quant_dtype="fp6_e3m2", float_dtype=hidden_states.dtype
|
|
1845
|
+
)
|
|
1846
|
+
w2_scale = None
|
|
1847
|
+
elif ocp_mx_scheme == OCP_MX_Scheme.w_mxfp6_e2m3_a_mxfp6_e2m3:
|
|
1848
|
+
w1 = dequant_mxfp6(
|
|
1849
|
+
w1, w1_scale, quant_dtype="fp6_e2m3", float_dtype=hidden_states.dtype
|
|
1850
|
+
)
|
|
1851
|
+
w1_scale = None
|
|
1852
|
+
w2 = dequant_mxfp6(
|
|
1853
|
+
w2, w2_scale, quant_dtype="fp6_e2m3", float_dtype=hidden_states.dtype
|
|
1854
|
+
)
|
|
1855
|
+
w2_scale = None
|
|
1856
|
+
else:
|
|
1857
|
+
raise NotImplementedError(f"Unsupported ocp_mx_scheme={ocp_mx_scheme}")
|
|
1858
|
+
|
|
1859
|
+
for chunk in range((num_tokens // CHUNK_SIZE) + 1):
|
|
1860
|
+
begin_chunk_idx, end_chunk_idx = (
|
|
1861
|
+
chunk * CHUNK_SIZE,
|
|
1862
|
+
min((chunk + 1) * CHUNK_SIZE, num_tokens),
|
|
1863
|
+
)
|
|
1864
|
+
curr_hidden_states = hidden_states[begin_chunk_idx:end_chunk_idx]
|
|
1865
|
+
tokens_in_chunk, _ = curr_hidden_states.size()
|
|
1866
|
+
|
|
1867
|
+
if tokens_in_chunk == 0:
|
|
1868
|
+
break
|
|
1869
|
+
|
|
1870
|
+
if tokens_in_chunk < CHUNK_SIZE and chunk > 0:
|
|
1871
|
+
# Adjust the intermediate cache size and config for the last
|
|
1872
|
+
# chunk. Note that in most cases we only have one chunk
|
|
1873
|
+
# so the cache size and config are already set correctly and
|
|
1874
|
+
# do not need to be adjusted.
|
|
1875
|
+
intermediate_cache1 = intermediate_cache1[:tokens_in_chunk]
|
|
1876
|
+
intermediate_cache2 = intermediate_cache2[
|
|
1877
|
+
: tokens_in_chunk * topk_ids.size(1)
|
|
1878
|
+
]
|
|
1879
|
+
intermediate_cache3 = intermediate_cache3[:tokens_in_chunk]
|
|
1880
|
+
config = get_config_func(tokens_in_chunk)
|
|
1881
|
+
|
|
1882
|
+
curr_topk_ids = topk_ids[begin_chunk_idx:end_chunk_idx]
|
|
1883
|
+
curr_topk_weights = topk_weights[begin_chunk_idx:end_chunk_idx]
|
|
1884
|
+
qcurr_hidden_states, a1q_scale = moe_kernel_quantize_input(
|
|
1885
|
+
A=curr_hidden_states,
|
|
1886
|
+
A_scale=a1_scale,
|
|
1887
|
+
quant_dtype=quant_dtype,
|
|
1888
|
+
per_act_token_quant=per_channel_quant,
|
|
1889
|
+
block_shape=block_shape,
|
|
1890
|
+
)
|
|
1891
|
+
|
|
1892
|
+
sorted_token_ids, expert_ids, num_tokens_post_padded = moe_align_block_size(
|
|
1893
|
+
curr_topk_ids, config["BLOCK_SIZE_M"], global_num_experts, expert_map
|
|
1894
|
+
)
|
|
1895
|
+
|
|
1896
|
+
invoke_fused_moe_kernel(
|
|
1897
|
+
qcurr_hidden_states,
|
|
1898
|
+
w1,
|
|
1899
|
+
intermediate_cache1,
|
|
1900
|
+
a1q_scale,
|
|
1901
|
+
w1_scale,
|
|
1902
|
+
w1_zp,
|
|
1903
|
+
curr_topk_weights,
|
|
1904
|
+
sorted_token_ids,
|
|
1905
|
+
expert_ids,
|
|
1906
|
+
num_tokens_post_padded,
|
|
1907
|
+
apply_router_weight_on_input,
|
|
1908
|
+
top_k_num,
|
|
1909
|
+
config,
|
|
1910
|
+
compute_type=compute_type,
|
|
1911
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1912
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1913
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1914
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1915
|
+
per_channel_quant=per_channel_quant,
|
|
1916
|
+
block_shape=block_shape,
|
|
1917
|
+
B_bias=w1_bias,
|
|
1918
|
+
)
|
|
1919
|
+
|
|
1920
|
+
# Activation function with multiplication
|
|
1921
|
+
if activation == "silu":
|
|
1922
|
+
torch.ops._C.silu_and_mul(
|
|
1923
|
+
intermediate_cache2, intermediate_cache1.view(-1, N)
|
|
1924
|
+
)
|
|
1925
|
+
elif activation == "gelu":
|
|
1926
|
+
torch.ops._C.gelu_and_mul(
|
|
1927
|
+
intermediate_cache2, intermediate_cache1.view(-1, N)
|
|
1928
|
+
)
|
|
1929
|
+
elif activation == "swigluoai":
|
|
1930
|
+
# alpha = 1.702, limit = 7.0
|
|
1931
|
+
torch.ops._C.swigluoai_and_mul(
|
|
1932
|
+
intermediate_cache2, intermediate_cache1.view(-1, N)
|
|
1933
|
+
)
|
|
1934
|
+
# Activation function without multiplication
|
|
1935
|
+
elif activation == SILU_NO_MUL:
|
|
1936
|
+
intermediate_cache2 = F.silu(intermediate_cache1.view(-1, N))
|
|
1937
|
+
elif activation == GELU_NO_MUL:
|
|
1938
|
+
intermediate_cache2 = F.gelu(intermediate_cache1.view(-1, N))
|
|
1939
|
+
elif activation == RELU2_NO_MUL:
|
|
1940
|
+
intermediate_cache2 = torch.square(F.relu(intermediate_cache1.view(-1, N)))
|
|
1941
|
+
else:
|
|
1942
|
+
raise ValueError(f"Unsupported FusedMoe activation: {activation}.")
|
|
1943
|
+
|
|
1944
|
+
qintermediate_cache2, a2q_scale = moe_kernel_quantize_input(
|
|
1945
|
+
A=intermediate_cache2,
|
|
1946
|
+
A_scale=a2_scale,
|
|
1947
|
+
quant_dtype=quant_dtype,
|
|
1948
|
+
per_act_token_quant=per_channel_quant,
|
|
1949
|
+
block_shape=block_shape,
|
|
1950
|
+
)
|
|
1951
|
+
|
|
1952
|
+
invoke_fused_moe_kernel(
|
|
1953
|
+
qintermediate_cache2,
|
|
1954
|
+
w2,
|
|
1955
|
+
intermediate_cache3,
|
|
1956
|
+
a2q_scale,
|
|
1957
|
+
w2_scale,
|
|
1958
|
+
w2_zp,
|
|
1959
|
+
curr_topk_weights,
|
|
1960
|
+
sorted_token_ids,
|
|
1961
|
+
expert_ids,
|
|
1962
|
+
num_tokens_post_padded,
|
|
1963
|
+
not apply_router_weight_on_input,
|
|
1964
|
+
1,
|
|
1965
|
+
config,
|
|
1966
|
+
compute_type=compute_type,
|
|
1967
|
+
use_fp8_w8a8=use_fp8_w8a8,
|
|
1968
|
+
use_int8_w8a8=use_int8_w8a8,
|
|
1969
|
+
use_int8_w8a16=use_int8_w8a16,
|
|
1970
|
+
use_int4_w4a16=use_int4_w4a16,
|
|
1971
|
+
per_channel_quant=per_channel_quant,
|
|
1972
|
+
block_shape=block_shape,
|
|
1973
|
+
B_bias=w2_bias,
|
|
1974
|
+
)
|
|
1975
|
+
|
|
1976
|
+
ops.moe_sum(
|
|
1977
|
+
intermediate_cache3.view(*intermediate_cache3.size()),
|
|
1978
|
+
out_hidden_states[begin_chunk_idx:end_chunk_idx],
|
|
1979
|
+
)
|
|
1980
|
+
|
|
1981
|
+
return out_hidden_states
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
class TritonExperts(mk.FusedMoEPermuteExpertsUnpermute):
|
|
1985
|
+
def __init__(
|
|
1986
|
+
self,
|
|
1987
|
+
quant_config: FusedMoEQuantConfig,
|
|
1988
|
+
):
|
|
1989
|
+
super().__init__(quant_config)
|
|
1990
|
+
|
|
1991
|
+
@property
|
|
1992
|
+
def activation_formats(
|
|
1993
|
+
self,
|
|
1994
|
+
) -> tuple[mk.FusedMoEActivationFormat, mk.FusedMoEActivationFormat]:
|
|
1995
|
+
return (
|
|
1996
|
+
mk.FusedMoEActivationFormat.Standard,
|
|
1997
|
+
mk.FusedMoEActivationFormat.Standard,
|
|
1998
|
+
)
|
|
1999
|
+
|
|
2000
|
+
def supports_chunking(self) -> bool:
|
|
2001
|
+
return True
|
|
2002
|
+
|
|
2003
|
+
def supports_expert_map(self) -> bool:
|
|
2004
|
+
return True
|
|
2005
|
+
|
|
2006
|
+
def finalize_weight_and_reduce_impl(self) -> mk.TopKWeightAndReduce:
|
|
2007
|
+
return TopKWeightAndReduceNoOP()
|
|
2008
|
+
|
|
2009
|
+
def workspace_shapes(
|
|
2010
|
+
self,
|
|
2011
|
+
M: int,
|
|
2012
|
+
N: int,
|
|
2013
|
+
K: int,
|
|
2014
|
+
topk: int,
|
|
2015
|
+
global_num_experts: int,
|
|
2016
|
+
local_num_experts: int,
|
|
2017
|
+
expert_tokens_meta: mk.ExpertTokensMetadata | None,
|
|
2018
|
+
) -> tuple[tuple[int, ...], tuple[int, ...], tuple[int, ...]]:
|
|
2019
|
+
workspace1 = (M, topk, max(N // 2, K))
|
|
2020
|
+
workspace2 = (M, topk, max(N, K))
|
|
2021
|
+
output = (M, K)
|
|
2022
|
+
return (workspace1, workspace2, output)
|
|
2023
|
+
|
|
2024
|
+
def apply(
|
|
2025
|
+
self,
|
|
2026
|
+
output: torch.Tensor,
|
|
2027
|
+
hidden_states: torch.Tensor,
|
|
2028
|
+
w1: torch.Tensor,
|
|
2029
|
+
w2: torch.Tensor,
|
|
2030
|
+
topk_weights: torch.Tensor,
|
|
2031
|
+
topk_ids: torch.Tensor,
|
|
2032
|
+
activation: str,
|
|
2033
|
+
global_num_experts: int,
|
|
2034
|
+
expert_map: torch.Tensor | None,
|
|
2035
|
+
a1q_scale: torch.Tensor | None,
|
|
2036
|
+
a2_scale: torch.Tensor | None,
|
|
2037
|
+
workspace13: torch.Tensor,
|
|
2038
|
+
workspace2: torch.Tensor,
|
|
2039
|
+
expert_tokens_meta: mk.ExpertTokensMetadata | None,
|
|
2040
|
+
apply_router_weight_on_input: bool,
|
|
2041
|
+
):
|
|
2042
|
+
# Check constraints.
|
|
2043
|
+
if self.quant_config.use_int4_w4a16:
|
|
2044
|
+
assert hidden_states.size(-1) // 2 == w1.size(2), "Hidden size mismatch"
|
|
2045
|
+
else:
|
|
2046
|
+
assert hidden_states.size(-1) == w1.size(2), (
|
|
2047
|
+
f"Hidden size mismatch {hidden_states.size(-1)} != {w1.size(2)}"
|
|
2048
|
+
)
|
|
2049
|
+
|
|
2050
|
+
assert hidden_states.is_contiguous(), "Hidden_states must be contiguous"
|
|
2051
|
+
assert hidden_states.dim() == 2
|
|
2052
|
+
assert w1.stride(-1) == 1, "Stride of last dimension must be 1"
|
|
2053
|
+
assert w2.stride(-1) == 1, "Stride of last dimension must be 1"
|
|
2054
|
+
assert hidden_states.dtype in [
|
|
2055
|
+
torch.float32,
|
|
2056
|
+
torch.float16,
|
|
2057
|
+
torch.bfloat16,
|
|
2058
|
+
torch.float8_e4m3fn,
|
|
2059
|
+
]
|
|
2060
|
+
|
|
2061
|
+
E, num_tokens, N, K, top_k_num = self.moe_problem_size(
|
|
2062
|
+
hidden_states, w1, w2, topk_ids
|
|
2063
|
+
)
|
|
2064
|
+
|
|
2065
|
+
if global_num_experts == -1:
|
|
2066
|
+
global_num_experts = E
|
|
2067
|
+
|
|
2068
|
+
config = try_get_optimal_moe_config(
|
|
2069
|
+
w1.size(),
|
|
2070
|
+
w2.size(),
|
|
2071
|
+
top_k_num,
|
|
2072
|
+
self.quant_config.config_name(hidden_states.dtype),
|
|
2073
|
+
num_tokens,
|
|
2074
|
+
block_shape=self.block_shape,
|
|
2075
|
+
)
|
|
2076
|
+
|
|
2077
|
+
if hidden_states.dtype == torch.bfloat16:
|
|
2078
|
+
compute_type = tl.bfloat16
|
|
2079
|
+
elif hidden_states.dtype == torch.float16:
|
|
2080
|
+
compute_type = tl.float16
|
|
2081
|
+
elif hidden_states.dtype == torch.float32:
|
|
2082
|
+
compute_type = tl.float32
|
|
2083
|
+
elif hidden_states.dtype == torch.float8_e4m3fn:
|
|
2084
|
+
compute_type = tl.bfloat16
|
|
2085
|
+
else:
|
|
2086
|
+
raise ValueError(f"Unsupported compute_type: {hidden_states.dtype}")
|
|
2087
|
+
|
|
2088
|
+
# Note that the output tensor might be in workspace1
|
|
2089
|
+
intermediate_cache1 = _resize_cache(workspace2, (num_tokens, top_k_num, N))
|
|
2090
|
+
intermediate_cache2 = _resize_cache(
|
|
2091
|
+
workspace13, (num_tokens * top_k_num, N // 2)
|
|
2092
|
+
)
|
|
2093
|
+
intermediate_cache3 = _resize_cache(workspace2, (num_tokens, top_k_num, K))
|
|
2094
|
+
|
|
2095
|
+
sorted_token_ids, expert_ids, num_tokens_post_padded = moe_align_block_size(
|
|
2096
|
+
topk_ids, config["BLOCK_SIZE_M"], global_num_experts, expert_map
|
|
2097
|
+
)
|
|
2098
|
+
|
|
2099
|
+
invoke_fused_moe_kernel(
|
|
2100
|
+
hidden_states,
|
|
2101
|
+
w1,
|
|
2102
|
+
intermediate_cache1,
|
|
2103
|
+
a1q_scale,
|
|
2104
|
+
self.w1_scale,
|
|
2105
|
+
self.w1_zp,
|
|
2106
|
+
None, # topk_weights
|
|
2107
|
+
sorted_token_ids,
|
|
2108
|
+
expert_ids,
|
|
2109
|
+
num_tokens_post_padded,
|
|
2110
|
+
False, # mul_routed_weights
|
|
2111
|
+
top_k_num,
|
|
2112
|
+
config,
|
|
2113
|
+
compute_type=compute_type,
|
|
2114
|
+
use_fp8_w8a8=self.quant_config.use_fp8_w8a8,
|
|
2115
|
+
use_int8_w8a8=self.quant_config.use_int8_w8a8,
|
|
2116
|
+
use_int8_w8a16=self.quant_config.use_int8_w8a16,
|
|
2117
|
+
use_int4_w4a16=self.quant_config.use_int4_w4a16,
|
|
2118
|
+
per_channel_quant=self.per_act_token_quant,
|
|
2119
|
+
block_shape=self.block_shape,
|
|
2120
|
+
B_bias=self.w1_bias,
|
|
2121
|
+
)
|
|
2122
|
+
|
|
2123
|
+
self.activation(
|
|
2124
|
+
activation, intermediate_cache2, intermediate_cache1.view(-1, N)
|
|
2125
|
+
)
|
|
2126
|
+
|
|
2127
|
+
a2q_scale: torch.Tensor | None = None
|
|
2128
|
+
|
|
2129
|
+
qintermediate_cache2, a2q_scale = moe_kernel_quantize_input(
|
|
2130
|
+
intermediate_cache2,
|
|
2131
|
+
a2_scale,
|
|
2132
|
+
self.quant_dtype,
|
|
2133
|
+
self.per_act_token_quant,
|
|
2134
|
+
self.block_shape,
|
|
2135
|
+
)
|
|
2136
|
+
|
|
2137
|
+
invoke_fused_moe_kernel(
|
|
2138
|
+
qintermediate_cache2,
|
|
2139
|
+
w2,
|
|
2140
|
+
intermediate_cache3,
|
|
2141
|
+
a2q_scale,
|
|
2142
|
+
self.w2_scale,
|
|
2143
|
+
self.w2_zp,
|
|
2144
|
+
topk_weights,
|
|
2145
|
+
sorted_token_ids,
|
|
2146
|
+
expert_ids,
|
|
2147
|
+
num_tokens_post_padded,
|
|
2148
|
+
not apply_router_weight_on_input,
|
|
2149
|
+
1,
|
|
2150
|
+
config,
|
|
2151
|
+
compute_type=compute_type,
|
|
2152
|
+
use_fp8_w8a8=self.quant_config.use_fp8_w8a8,
|
|
2153
|
+
use_int8_w8a8=self.quant_config.use_int8_w8a8,
|
|
2154
|
+
use_int8_w8a16=self.quant_config.use_int8_w8a16,
|
|
2155
|
+
use_int4_w4a16=self.quant_config.use_int4_w4a16,
|
|
2156
|
+
per_channel_quant=self.per_act_token_quant,
|
|
2157
|
+
block_shape=self.block_shape,
|
|
2158
|
+
B_bias=self.w2_bias,
|
|
2159
|
+
)
|
|
2160
|
+
|
|
2161
|
+
# separate function is required for MoE + LoRA
|
|
2162
|
+
self.moe_sum(intermediate_cache3, output)
|
|
2163
|
+
|
|
2164
|
+
def moe_sum(self, input: torch.Tensor, output: torch.Tensor) -> None:
|
|
2165
|
+
ops.moe_sum(input, output)
|
|
2166
|
+
|
|
2167
|
+
|
|
2168
|
+
def modular_triton_fused_moe(
|
|
2169
|
+
quant_config: FusedMoEQuantConfig, shared_experts: torch.nn.Module | None = None
|
|
2170
|
+
) -> mk.FusedMoEModularKernel:
|
|
2171
|
+
return mk.FusedMoEModularKernel(
|
|
2172
|
+
MoEPrepareAndFinalizeNoEP(),
|
|
2173
|
+
TritonExperts(quant_config),
|
|
2174
|
+
shared_experts,
|
|
2175
|
+
)
|