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