sglang 0.4.6.post5__py3-none-any.whl → 0.4.7.post1__py3-none-any.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 (359) hide show
  1. sglang/__init__.py +2 -0
  2. sglang/api.py +7 -0
  3. sglang/bench_offline_throughput.py +10 -4
  4. sglang/bench_one_batch_server.py +67 -11
  5. sglang/bench_serving.py +86 -75
  6. sglang/lang/backend/runtime_endpoint.py +24 -1
  7. sglang/lang/interpreter.py +40 -1
  8. sglang/lang/ir.py +27 -0
  9. sglang/math_utils.py +8 -0
  10. sglang/profiler.py +167 -0
  11. sglang/srt/_custom_ops.py +34 -0
  12. sglang/srt/configs/internvl.py +8 -12
  13. sglang/srt/configs/model_config.py +33 -1
  14. sglang/srt/constrained/base_grammar_backend.py +5 -2
  15. sglang/srt/constrained/llguidance_backend.py +9 -8
  16. sglang/srt/constrained/outlines_backend.py +5 -4
  17. sglang/srt/constrained/xgrammar_backend.py +18 -18
  18. sglang/srt/conversation.py +52 -8
  19. sglang/srt/custom_op.py +38 -3
  20. sglang/srt/debug_utils.py +74 -0
  21. sglang/srt/disaggregation/base/__init__.py +1 -1
  22. sglang/srt/disaggregation/base/conn.py +25 -11
  23. sglang/srt/disaggregation/common/__init__.py +5 -0
  24. sglang/srt/disaggregation/common/conn.py +407 -0
  25. sglang/srt/disaggregation/common/utils.py +42 -0
  26. sglang/srt/disaggregation/decode.py +261 -52
  27. sglang/srt/disaggregation/fake/__init__.py +1 -1
  28. sglang/srt/disaggregation/fake/conn.py +16 -9
  29. sglang/srt/disaggregation/kv_events.py +60 -5
  30. sglang/srt/disaggregation/launch_lb.py +140 -0
  31. sglang/srt/disaggregation/mini_lb.py +29 -48
  32. sglang/srt/disaggregation/mooncake/__init__.py +1 -1
  33. sglang/srt/disaggregation/mooncake/conn.py +446 -149
  34. sglang/srt/disaggregation/mooncake/transfer_engine.py +32 -16
  35. sglang/srt/disaggregation/nixl/__init__.py +6 -1
  36. sglang/srt/disaggregation/nixl/conn.py +134 -437
  37. sglang/srt/disaggregation/prefill.py +130 -43
  38. sglang/srt/disaggregation/utils.py +127 -86
  39. sglang/srt/distributed/device_communicators/pymscclpp.py +315 -0
  40. sglang/srt/distributed/parallel_state.py +52 -5
  41. sglang/srt/entrypoints/EngineBase.py +6 -0
  42. sglang/srt/entrypoints/engine.py +116 -5
  43. sglang/srt/entrypoints/http_server.py +28 -4
  44. sglang/srt/eplb_simulator/__init__.py +1 -0
  45. sglang/srt/eplb_simulator/reader.py +51 -0
  46. sglang/srt/function_call/base_format_detector.py +138 -86
  47. sglang/srt/function_call/deepseekv3_detector.py +54 -6
  48. sglang/srt/function_call/ebnf_composer.py +33 -19
  49. sglang/srt/function_call/function_call_parser.py +27 -0
  50. sglang/srt/function_call/llama32_detector.py +33 -14
  51. sglang/srt/function_call/mistral_detector.py +73 -26
  52. sglang/srt/function_call/pythonic_detector.py +86 -20
  53. sglang/srt/function_call/qwen25_detector.py +64 -10
  54. sglang/srt/function_call/utils.py +17 -0
  55. sglang/srt/hf_transformers_utils.py +4 -0
  56. sglang/srt/layers/activation.py +19 -0
  57. sglang/srt/layers/attention/aiter_backend.py +503 -125
  58. sglang/srt/layers/attention/base_attn_backend.py +4 -0
  59. sglang/srt/layers/attention/cutlass_mla_backend.py +40 -34
  60. sglang/srt/layers/attention/flashattention_backend.py +137 -63
  61. sglang/srt/layers/attention/flashinfer_backend.py +46 -3
  62. sglang/srt/layers/attention/flashinfer_mla_backend.py +59 -25
  63. sglang/srt/layers/attention/flashmla_backend.py +2 -10
  64. sglang/srt/layers/attention/intel_amx_backend.py +128 -0
  65. sglang/srt/layers/attention/tbo_backend.py +232 -0
  66. sglang/srt/layers/attention/torch_native_backend.py +3 -0
  67. sglang/srt/layers/attention/triton_backend.py +304 -65
  68. sglang/srt/layers/attention/triton_ops/decode_attention.py +2 -7
  69. sglang/srt/layers/attention/triton_ops/extend_attention.py +12 -4
  70. sglang/srt/layers/attention/vision.py +51 -24
  71. sglang/srt/layers/communicator.py +281 -197
  72. sglang/srt/layers/dp_attention.py +6 -5
  73. sglang/srt/layers/layernorm.py +30 -19
  74. sglang/srt/layers/linear.py +0 -4
  75. sglang/srt/layers/logits_processor.py +0 -12
  76. sglang/srt/layers/moe/cutlass_moe.py +170 -7
  77. sglang/srt/layers/moe/cutlass_moe_params.py +169 -0
  78. sglang/srt/layers/moe/ep_moe/kernels.py +33 -11
  79. sglang/srt/layers/moe/ep_moe/layer.py +136 -72
  80. sglang/srt/layers/moe/ep_moe/token_dispatcher.py +24 -45
  81. sglang/srt/layers/moe/fused_moe_native.py +4 -0
  82. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
  83. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
  84. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
  85. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
  86. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=257,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
  87. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_2_0/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  88. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_3_1/E=257,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json +146 -0
  89. sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_3_1/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json +146 -0
  90. sglang/srt/layers/moe/fused_moe_triton/fused_moe.py +221 -29
  91. sglang/srt/layers/moe/fused_moe_triton/layer.py +34 -4
  92. sglang/srt/layers/moe/topk.py +60 -26
  93. sglang/srt/layers/multimodal.py +3 -3
  94. sglang/srt/layers/pooler.py +56 -0
  95. sglang/srt/layers/quantization/__init__.py +3 -2
  96. sglang/srt/layers/quantization/blockwise_int8.py +3 -0
  97. sglang/srt/layers/quantization/compressed_tensors/compressed_tensors_moe.py +5 -0
  98. sglang/srt/layers/quantization/deep_gemm_wrapper/__init__.py +1 -0
  99. sglang/srt/layers/quantization/{deep_gemm.py → deep_gemm_wrapper/compile_utils.py} +69 -127
  100. sglang/srt/layers/quantization/deep_gemm_wrapper/configurer.py +32 -0
  101. sglang/srt/layers/quantization/deep_gemm_wrapper/entrypoint.py +110 -0
  102. sglang/srt/layers/quantization/fp8.py +28 -23
  103. sglang/srt/layers/quantization/fp8_kernel.py +156 -75
  104. sglang/srt/layers/quantization/fp8_utils.py +250 -69
  105. sglang/srt/layers/quantization/modelopt_quant.py +334 -7
  106. sglang/srt/layers/quantization/moe_wna16.py +3 -0
  107. sglang/srt/layers/quantization/w8a8_fp8.py +3 -0
  108. sglang/srt/layers/quantization/w8a8_int8.py +3 -0
  109. sglang/srt/layers/radix_attention.py +2 -3
  110. sglang/srt/layers/rotary_embedding.py +6 -12
  111. sglang/srt/layers/sampler.py +80 -79
  112. sglang/srt/layers/utils.py +6 -0
  113. sglang/srt/lora/layers.py +12 -15
  114. sglang/srt/lora/lora.py +49 -5
  115. sglang/srt/lora/lora_manager.py +98 -39
  116. sglang/srt/lora/mem_pool.py +28 -21
  117. sglang/srt/lora/utils.py +17 -13
  118. sglang/srt/managers/cache_controller.py +2 -1
  119. sglang/srt/managers/data_parallel_controller.py +13 -5
  120. sglang/srt/managers/eplb_algorithms/__init__.py +63 -0
  121. sglang/srt/managers/eplb_algorithms/deepseek.py +223 -0
  122. sglang/srt/managers/{deepseek_eplb.py → eplb_algorithms/deepseek_vec.py} +5 -7
  123. sglang/srt/managers/eplb_manager.py +55 -14
  124. sglang/srt/managers/expert_distribution.py +220 -46
  125. sglang/srt/managers/expert_location.py +110 -56
  126. sglang/srt/managers/expert_location_dispatch.py +23 -6
  127. sglang/srt/managers/io_struct.py +43 -8
  128. sglang/srt/managers/mm_utils.py +88 -38
  129. sglang/srt/managers/multimodal_processors/base_processor.py +190 -18
  130. sglang/srt/managers/multimodal_processors/gemma3.py +4 -31
  131. sglang/srt/managers/multimodal_processors/internvl.py +4 -0
  132. sglang/srt/managers/multimodal_processors/kimi_vl.py +15 -34
  133. sglang/srt/managers/multimodal_processors/minicpm.py +2 -1
  134. sglang/srt/managers/multimodal_processors/phi4mm.py +87 -0
  135. sglang/srt/managers/multimodal_processors/qwen_vl.py +22 -64
  136. sglang/srt/managers/multimodal_processors/vila.py +85 -0
  137. sglang/srt/managers/schedule_batch.py +173 -38
  138. sglang/srt/managers/scheduler.py +376 -127
  139. sglang/srt/managers/tokenizer_manager.py +163 -19
  140. sglang/srt/managers/utils.py +0 -4
  141. sglang/srt/mem_cache/chunk_cache.py +1 -0
  142. sglang/srt/mem_cache/hiradix_cache.py +4 -2
  143. sglang/srt/mem_cache/memory_pool.py +111 -407
  144. sglang/srt/mem_cache/memory_pool_host.py +380 -0
  145. sglang/srt/mem_cache/radix_cache.py +36 -12
  146. sglang/srt/metrics/collector.py +9 -0
  147. sglang/srt/model_executor/cuda_graph_runner.py +191 -113
  148. sglang/srt/model_executor/expert_location_updater.py +157 -22
  149. sglang/srt/model_executor/forward_batch_info.py +52 -22
  150. sglang/srt/model_executor/model_runner.py +102 -62
  151. sglang/srt/model_loader/loader.py +8 -1
  152. sglang/srt/model_loader/utils.py +67 -1
  153. sglang/srt/models/bert.py +113 -13
  154. sglang/srt/models/deepseek_nextn.py +1 -1
  155. sglang/srt/models/deepseek_v2.py +623 -290
  156. sglang/srt/models/gemma3_causal.py +7 -0
  157. sglang/srt/models/gemma3_mm.py +19 -14
  158. sglang/srt/models/idefics2.py +342 -0
  159. sglang/srt/models/internvl.py +46 -102
  160. sglang/srt/models/kimi_vl.py +4 -4
  161. sglang/srt/models/llama.py +1 -1
  162. sglang/srt/models/minicpmo.py +2 -5
  163. sglang/srt/models/minicpmv.py +3 -295
  164. sglang/srt/models/phi4mm.py +512 -0
  165. sglang/srt/models/qwen2.py +38 -9
  166. sglang/srt/models/qwen2_5_vl.py +3 -9
  167. sglang/srt/models/qwen2_eagle.py +4 -1
  168. sglang/srt/models/qwen2_moe.py +58 -191
  169. sglang/srt/models/qwen2_vl.py +3 -9
  170. sglang/srt/models/qwen3.py +41 -10
  171. sglang/srt/models/qwen3_moe.py +230 -191
  172. sglang/srt/models/registry.py +9 -1
  173. sglang/srt/models/roberta.py +117 -9
  174. sglang/srt/models/transformers.py +291 -0
  175. sglang/srt/models/vila.py +305 -0
  176. sglang/srt/openai_api/adapter.py +248 -28
  177. sglang/srt/openai_api/protocol.py +68 -3
  178. sglang/srt/openai_api/utils.py +172 -0
  179. sglang/srt/operations.py +37 -2
  180. sglang/srt/operations_strategy.py +200 -24
  181. sglang/srt/sampling/sampling_batch_info.py +37 -1
  182. sglang/srt/sampling/sampling_params.py +4 -1
  183. sglang/srt/server_args.py +381 -209
  184. sglang/srt/speculative/build_eagle_tree.py +9 -9
  185. sglang/srt/speculative/eagle_draft_cuda_graph_runner.py +12 -14
  186. sglang/srt/speculative/eagle_draft_extend_cuda_graph_runner.py +256 -0
  187. sglang/srt/speculative/eagle_utils.py +440 -200
  188. sglang/srt/speculative/eagle_worker.py +234 -63
  189. sglang/srt/two_batch_overlap.py +637 -0
  190. sglang/srt/utils.py +187 -7
  191. sglang/test/attention/test_prefix_chunk_info.py +2 -0
  192. sglang/test/runners.py +54 -10
  193. sglang/test/send_one.py +4 -0
  194. sglang/test/test_block_fp8.py +1 -0
  195. sglang/test/test_block_fp8_deep_gemm_blackwell.py +252 -0
  196. sglang/test/test_block_fp8_ep.py +1 -0
  197. sglang/test/test_cutlass_moe.py +3 -3
  198. sglang/test/test_fp4_moe.py +248 -0
  199. sglang/test/test_utils.py +82 -7
  200. sglang/utils.py +9 -0
  201. sglang/version.py +1 -1
  202. {sglang-0.4.6.post5.dist-info → sglang-0.4.7.post1.dist-info}/METADATA +17 -14
  203. {sglang-0.4.6.post5.dist-info → sglang-0.4.7.post1.dist-info}/RECORD +359 -321
  204. {sglang-0.4.6.post5.dist-info → sglang-0.4.7.post1.dist-info}/WHEEL +1 -1
  205. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  206. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  207. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  208. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  209. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  210. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json} +0 -0
  211. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=1,N=3072,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  212. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  213. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  214. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  215. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=1,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  216. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=144,N=512,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=144,N=512,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  217. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  218. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1024,device_name=NVIDIA_H200.json → triton_3_1_0/E=16,N=1024,device_name=NVIDIA_H200.json} +0 -0
  219. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json → triton_3_1_0/E=16,N=1344,device_name=NVIDIA_A100-SXM4-40GB.json} +0 -0
  220. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=1344,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  221. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=1344,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  222. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  223. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=14336,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  224. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  225. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  226. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  227. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=2688,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  228. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=16,N=2688,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  229. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=3072,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  230. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=3072,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json} +0 -0
  231. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=16,N=3200,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  232. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  233. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  234. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=16,N=6400,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  235. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a16.json} +0 -0
  236. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=16,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  237. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json → triton_3_1_0/E=16,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=int8_w8a16.json} +0 -0
  238. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=16,N=800,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  239. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=160,N=192,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  240. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=20,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=20,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  241. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=24,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=24,N=1024,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  242. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json} +0 -0
  243. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A100-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
  244. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8,block_shape=[128, 128].json} +0 -0
  245. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
  246. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  247. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_H20,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_H20,block_shape=[128, 128].json} +0 -0
  248. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  249. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=128,device_name=NVIDIA_L20Y,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  250. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  251. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  252. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  253. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  254. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=NVIDIA_H20,dtype=int8_w8a8,block_shape=[128, 128].json} +0 -0
  255. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=256,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  256. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=256,N=64,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  257. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=64,device_name=NVIDIA_L20,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=64,device_name=NVIDIA_L20,dtype=int8_w8a8.json} +0 -0
  258. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=256,N=64,device_name=NVIDIA_L40S,dtype=int8_w8a8.json → triton_3_1_0/E=256,N=64,device_name=NVIDIA_L40S,dtype=int8_w8a8.json} +0 -0
  259. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=64,N=1024,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  260. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  261. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  262. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  263. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  264. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  265. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=1280,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=1280,device_name=NVIDIA_H200.json} +0 -0
  266. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=2560,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  267. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=2560,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  268. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=2560,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=2560,device_name=NVIDIA_H200.json} +0 -0
  269. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  270. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  271. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  272. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=320,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=320,device_name=NVIDIA_H200.json} +0 -0
  273. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_1_0/E=64,N=512,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  274. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  275. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  276. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json} +0 -0
  277. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  278. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  279. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  280. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=64,N=640,device_name=NVIDIA_H200.json → triton_3_1_0/E=64,N=640,device_name=NVIDIA_H200.json} +0 -0
  281. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=14336,device_name=AMD_Instinct_MI300X.json} +0 -0
  282. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=14336,device_name=AMD_Instinct_MI325X.json} +0 -0
  283. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=14336,device_name=AMD_Radeon_Graphics.json} +0 -0
  284. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=14336,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  285. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=14336,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  286. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=14336,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=14336,device_name=NVIDIA_H200.json} +0 -0
  287. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=1792,device_name=AMD_Instinct_MI300X.json} +0 -0
  288. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=1792,device_name=AMD_Instinct_MI325X.json} +0 -0
  289. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=1792,device_name=AMD_Radeon_Graphics.json} +0 -0
  290. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_A100-SXM4-40GB.json} +0 -0
  291. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  292. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  293. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  294. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=1792,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=1792,device_name=NVIDIA_H200.json} +0 -0
  295. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  296. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  297. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  298. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  299. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=2048,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=2048,device_name=NVIDIA_H200.json} +0 -0
  300. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=3584,device_name=AMD_Instinct_MI300X.json} +0 -0
  301. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=3584,device_name=AMD_Instinct_MI325X.json} +0 -0
  302. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=3584,device_name=AMD_Radeon_Graphics.json} +0 -0
  303. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json} +0 -0
  304. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  305. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_GeForce_RTX_4090,dtype=fp8_w8a8.json} +0 -0
  306. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  307. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  308. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  309. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_H200.json} +0 -0
  310. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=3584,device_name=NVIDIA_L40S.json → triton_3_1_0/E=8,N=3584,device_name=NVIDIA_L40S.json} +0 -0
  311. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json} +0 -0
  312. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json} +0 -0
  313. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json} +0 -0
  314. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  315. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  316. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  317. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  318. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=4096,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=4096,device_name=NVIDIA_H200.json} +0 -0
  319. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=AMD_Instinct_MI300X.json → triton_3_1_0/E=8,N=7168,device_name=AMD_Instinct_MI300X.json} +0 -0
  320. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=AMD_Instinct_MI325X.json → triton_3_1_0/E=8,N=7168,device_name=AMD_Instinct_MI325X.json} +0 -0
  321. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=AMD_Radeon_Graphics.json → triton_3_1_0/E=8,N=7168,device_name=AMD_Radeon_Graphics.json} +0 -0
  322. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_A100-SXM4-80GB.json} +0 -0
  323. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  324. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  325. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  326. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=7168,device_name=NVIDIA_H200.json → triton_3_1_0/E=8,N=7168,device_name=NVIDIA_H200.json} +0 -0
  327. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json} +0 -0
  328. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=AMD_Instinct_MI325X,dtype=fp8_w8a8.json} +0 -0
  329. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=AMD_Radeon_Graphics,dtype=fp8_w8a8.json} +0 -0
  330. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json} +0 -0
  331. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json → triton_3_1_0/E=8,N=8192,device_name=NVIDIA_H200,dtype=fp8_w8a8.json} +0 -0
  332. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  333. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  334. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_H20.json} +0 -0
  335. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=192,device_name=NVIDIA_H200.json → triton_3_2_0/E=128,N=192,device_name=NVIDIA_H200.json} +0 -0
  336. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  337. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  338. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H20.json} +0 -0
  339. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  340. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=384,device_name=NVIDIA_H200.json → triton_3_2_0/E=128,N=384,device_name=NVIDIA_H200.json} +0 -0
  341. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=512,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  342. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  343. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H100_80GB_HBM3.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H100_80GB_HBM3.json} +0 -0
  344. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  345. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H20.json} +0 -0
  346. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  347. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=768,device_name=NVIDIA_H200.json → triton_3_2_0/E=128,N=768,device_name=NVIDIA_H200.json} +0 -0
  348. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=128,N=96,device_name=NVIDIA_H20.json → triton_3_2_0/E=128,N=96,device_name=NVIDIA_H20.json} +0 -0
  349. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json → triton_3_2_0/E=264,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
  350. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=264,N=256,device_name=NVIDIA_B200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  351. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=264,N=256,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  352. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=264,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=264,N=256,device_name=NVIDIA_H200,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  353. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json → triton_3_2_0/E=272,N=128,device_name=NVIDIA_A800-SXM4-80GB,dtype=int8_w8a8.json} +0 -0
  354. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=272,N=128,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  355. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json → triton_3_2_0/E=272,N=128,device_name=NVIDIA_H20,dtype=fp8_w8a8,block_shape=[128, 128].json} +0 -0
  356. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=272,N=64,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=272,N=64,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  357. /sglang/srt/layers/moe/fused_moe_triton/configs/{E=288,N=64,device_name=NVIDIA_A800-SXM4-80GB.json → triton_3_2_0/E=288,N=64,device_name=NVIDIA_A800-SXM4-80GB.json} +0 -0
  358. {sglang-0.4.6.post5.dist-info → sglang-0.4.7.post1.dist-info}/licenses/LICENSE +0 -0
  359. {sglang-0.4.6.post5.dist-info → sglang-0.4.7.post1.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,8 @@
14
14
 
15
15
  from dataclasses import dataclass
16
16
  from enum import Enum, auto
17
- from typing import Dict, Optional, Tuple
17
+ from functools import partial
18
+ from typing import Dict, Optional
18
19
 
19
20
  import torch.distributed
20
21
 
@@ -36,10 +37,23 @@ from sglang.srt.model_executor.forward_batch_info import ForwardBatch
36
37
 
37
38
 
38
39
  class ScatterMode(Enum):
40
+ """
41
+ Suppose we have TP=4, DP=2, enable-dp-attention, and the system handles seq a,b,c,d
42
+ Model input/output: [ab, ab, cd, cd] for four ranks respectively
43
+ SCATTERED: [a, b, c, d]
44
+ TP_ATTN_FULL: [ab, ab, cd, cd], i.e. all ranks inside a TP attn group have full data of the group
45
+ FULL: [abcd, abcd, abcd, abcd]
46
+ """
47
+
39
48
  SCATTERED = auto()
40
49
  TP_ATTN_FULL = auto()
41
50
  FULL = auto()
42
51
 
52
+ @staticmethod
53
+ def model_input_output():
54
+ """The scatter mode for model forward pass input and output data"""
55
+ return ScatterMode.TP_ATTN_FULL
56
+
43
57
 
44
58
  @dataclass
45
59
  class _LayerModeComputationContext:
@@ -81,7 +95,7 @@ class LayerScatterModes:
81
95
  @classmethod
82
96
  def _compute_layer_input_mode(cls, context: _LayerModeComputationContext):
83
97
  if context.layer_id == 0:
84
- return ScatterMode.TP_ATTN_FULL
98
+ return ScatterMode.model_input_output()
85
99
  return cls._compute_layer_output_mode(context.previous_layer())
86
100
 
87
101
  @classmethod
@@ -112,7 +126,7 @@ class LayerScatterModes:
112
126
  def _compute_layer_output_mode(cls, context: _LayerModeComputationContext):
113
127
  mlp_mode = cls._compute_mlp_mode(context)
114
128
  if context.layer_id == context.num_layers - 1:
115
- return ScatterMode.TP_ATTN_FULL
129
+ return ScatterMode.model_input_output()
116
130
  if mlp_mode == ScatterMode.SCATTERED:
117
131
  return ScatterMode.SCATTERED
118
132
  if mlp_mode == ScatterMode.FULL:
@@ -135,15 +149,29 @@ class LayerCommunicator:
135
149
  self.input_layernorm = input_layernorm
136
150
  self.post_attention_layernorm = post_attention_layernorm
137
151
 
138
- self.attn_tp_rank = get_attention_tp_rank()
139
- self.attn_tp_size = get_attention_tp_size()
140
- self.local_attn_dp_size = get_local_attention_dp_size()
141
- self.tp_size = get_tensor_model_parallel_world_size()
142
- self.process_group_sizes = {
143
- ScatterMode.SCATTERED: 1,
144
- ScatterMode.TP_ATTN_FULL: self.attn_tp_size,
145
- ScatterMode.FULL: self.tp_size,
146
- }
152
+ self._context = CommunicateContext.init_new()
153
+ self._communicate_simple_fn = CommunicateSimpleFn.get_fn(
154
+ input_mode=self.layer_scatter_modes.layer_input_mode,
155
+ output_mode=self.layer_scatter_modes.attn_mode,
156
+ context=self._context,
157
+ )
158
+ self._communicate_with_all_reduce_and_layer_norm_fn = (
159
+ CommunicateWithAllReduceAndLayerNormFn.get_fn(
160
+ hidden_states_input_mode=self.layer_scatter_modes.attn_mode,
161
+ residual_input_mode=self.layer_scatter_modes.layer_input_mode,
162
+ hidden_states_output_mode=self.layer_scatter_modes.mlp_mode,
163
+ residual_output_mode=self.layer_scatter_modes.middle_residual_mode,
164
+ context=self._context,
165
+ )
166
+ )
167
+ self._communicate_summable_tensor_pair_fn = (
168
+ CommunicateSummableTensorPairFn.get_fn(
169
+ hidden_states_input_mode=self.layer_scatter_modes.mlp_mode,
170
+ residual_input_mode=self.layer_scatter_modes.middle_residual_mode,
171
+ output_mode=self.layer_scatter_modes.layer_output_mode,
172
+ context=self._context,
173
+ )
174
+ )
147
175
 
148
176
  def prepare_attn(
149
177
  self,
@@ -160,12 +188,10 @@ class LayerCommunicator:
160
188
  else:
161
189
  hidden_states, residual = self.input_layernorm(hidden_states, residual)
162
190
 
163
- hidden_states = _communicate_simple(
191
+ hidden_states = self._communicate_simple_fn(
164
192
  hidden_states=hidden_states,
165
193
  forward_batch=forward_batch,
166
- input_mode=self.layer_scatter_modes.layer_input_mode,
167
- output_mode=self.layer_scatter_modes.attn_mode,
168
- context=self._compute_context(forward_batch),
194
+ context=self._context,
169
195
  )
170
196
 
171
197
  return hidden_states, residual
@@ -176,16 +202,12 @@ class LayerCommunicator:
176
202
  residual: torch.Tensor,
177
203
  forward_batch: ForwardBatch,
178
204
  ):
179
- return _communicate_with_all_reduce_and_layer_norm(
205
+ return self._communicate_with_all_reduce_and_layer_norm_fn(
180
206
  hidden_states=hidden_states,
181
207
  residual=residual,
182
208
  forward_batch=forward_batch,
183
- hidden_states_input_mode=self.layer_scatter_modes.attn_mode,
184
- residual_input_mode=self.layer_scatter_modes.layer_input_mode,
185
- hidden_states_output_mode=self.layer_scatter_modes.mlp_mode,
186
- residual_output_mode=self.layer_scatter_modes.middle_residual_mode,
187
209
  layernorm=self.post_attention_layernorm,
188
- context=self._compute_context(forward_batch),
210
+ context=self._context,
189
211
  )
190
212
 
191
213
  def postprocess_layer(
@@ -194,136 +216,102 @@ class LayerCommunicator:
194
216
  residual: torch.Tensor,
195
217
  forward_batch: ForwardBatch,
196
218
  ):
197
- return _communicate_summable_tensor_pair(
219
+ return self._communicate_summable_tensor_pair_fn(
198
220
  hidden_states=hidden_states,
199
221
  residual=residual,
200
222
  forward_batch=forward_batch,
201
- hidden_states_input_mode=self.layer_scatter_modes.mlp_mode,
202
- residual_input_mode=self.layer_scatter_modes.middle_residual_mode,
203
- output_mode=self.layer_scatter_modes.layer_output_mode,
204
- context=self._compute_context(forward_batch),
205
- )
206
-
207
- def _compute_context(self, forward_batch: ForwardBatch):
208
- return _Context(
209
- num_tokens_of_mode=_compute_num_tokens_of_mode(
210
- forward_batch,
211
- attn_tp_rank=self.attn_tp_rank,
212
- attn_tp_size=self.attn_tp_size,
213
- ),
214
- process_group_sizes=self.process_group_sizes,
215
- attn_tp_rank=self.attn_tp_rank,
216
- attn_tp_size=self.attn_tp_size,
217
- local_attn_dp_size=self.local_attn_dp_size,
218
- tp_size=self.tp_size,
223
+ context=self._context,
219
224
  )
220
225
 
221
226
 
222
- def _compute_num_tokens_of_mode(
223
- forward_batch: ForwardBatch, attn_tp_rank: int, attn_tp_size: int
224
- ):
225
- tp_attn_full_num_tokens = forward_batch.input_ids.shape[0]
226
- return {
227
- ScatterMode.SCATTERED: _torch_tensor_split_len(
228
- tp_attn_full_num_tokens, attn_tp_size, attn_tp_rank
229
- ),
230
- ScatterMode.TP_ATTN_FULL: tp_attn_full_num_tokens,
231
- ScatterMode.FULL: (
232
- forward_batch.gathered_buffer.shape[0]
233
- if global_server_args_dict["enable_dp_attention"]
234
- else forward_batch.input_ids.shape[0]
235
- ),
236
- }
237
-
238
-
239
- def _torch_tensor_split_len(tensor_len: int, n: int, output_index: int):
240
- if output_index < int(tensor_len % n):
241
- return int(tensor_len / n) + 1
242
- else:
243
- return int(tensor_len / n)
244
-
245
-
246
227
  @dataclass
247
- class _Context:
248
- num_tokens_of_mode: Dict["ScatterMode", int]
249
- process_group_sizes: Dict["ScatterMode", int]
228
+ class CommunicateContext:
229
+ process_group_sizes: Dict[ScatterMode, int]
250
230
  attn_tp_rank: int
251
231
  attn_tp_size: int
252
232
  local_attn_dp_size: int
253
233
  tp_size: int
254
234
 
255
- def is_same_group_size(self, a: "ScatterMode", b: "ScatterMode"):
235
+ def is_same_group_size(self, a: ScatterMode, b: ScatterMode):
256
236
  return self.process_group_sizes[a] == self.process_group_sizes[b]
257
237
 
258
- def check_shape(self, x: torch.Tensor, mode: ScatterMode):
259
- if x is None:
260
- return
261
-
262
- actual_num_tokens = x.shape[0]
263
- expect_num_tokens = self.num_tokens_of_mode[mode]
264
- assert (
265
- actual_num_tokens == expect_num_tokens
266
- ), f"{actual_num_tokens=} {expect_num_tokens=} {mode=} {x.shape=} {self.num_tokens_of_mode=} {self.process_group_sizes=}"
267
- return x
268
-
269
- def check_shapes(
270
- self, xs: Tuple[torch.Tensor, ...], modes: Tuple[ScatterMode, ...]
271
- ) -> Tuple[torch.Tensor, ...]:
272
- return tuple(
273
- [self.check_shape(x, mode) for x, mode in zip(xs, modes, strict=True)]
238
+ @classmethod
239
+ def init_new(cls):
240
+ attn_tp_rank = get_attention_tp_rank()
241
+ attn_tp_size = get_attention_tp_size()
242
+ local_attn_dp_size = get_local_attention_dp_size()
243
+ tp_size = get_tensor_model_parallel_world_size()
244
+ process_group_sizes = {
245
+ ScatterMode.SCATTERED: 1,
246
+ ScatterMode.TP_ATTN_FULL: attn_tp_size,
247
+ # TODO: support --moe-dense-tp-size > 1
248
+ ScatterMode.FULL: tp_size,
249
+ }
250
+ return cls(
251
+ process_group_sizes=process_group_sizes,
252
+ attn_tp_rank=attn_tp_rank,
253
+ attn_tp_size=attn_tp_size,
254
+ local_attn_dp_size=local_attn_dp_size,
255
+ tp_size=tp_size,
274
256
  )
275
257
 
276
258
 
277
- def _communicate_simple(
278
- hidden_states: torch.Tensor,
279
- forward_batch: ForwardBatch,
280
- input_mode: ScatterMode,
281
- output_mode: ScatterMode,
282
- context: _Context,
283
- ) -> torch.Tensor:
284
- def _inner():
285
- nonlocal hidden_states
286
-
259
+ class CommunicateSimpleFn:
260
+ @staticmethod
261
+ def get_fn(
262
+ input_mode: ScatterMode,
263
+ output_mode: ScatterMode,
264
+ context: CommunicateContext,
265
+ ):
287
266
  if context.is_same_group_size(input_mode, output_mode):
288
- return hidden_states
267
+ return CommunicateSimpleFn._trivial
289
268
 
290
269
  if (input_mode == ScatterMode.SCATTERED) and (
291
270
  output_mode == ScatterMode.TP_ATTN_FULL
292
271
  ):
293
- hidden_states, local_hidden_states = (
294
- forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
295
- hidden_states,
296
- )
297
- attn_tp_all_gather(
298
- list(hidden_states.tensor_split(context.attn_tp_size)),
299
- local_hidden_states,
300
- )
301
- return hidden_states
272
+ return CommunicateSimpleFn._scattered_to_tp_attn_full
302
273
 
303
274
  raise NotImplementedError(f"{input_mode=} {output_mode=}")
304
275
 
305
- context.check_shape(hidden_states, input_mode)
306
- return context.check_shape(_inner(), output_mode)
307
-
308
-
309
- def _communicate_with_all_reduce_and_layer_norm(
310
- hidden_states: torch.Tensor,
311
- residual: torch.Tensor,
312
- hidden_states_input_mode: ScatterMode,
313
- residual_input_mode: ScatterMode,
314
- hidden_states_output_mode: ScatterMode,
315
- residual_output_mode: ScatterMode,
316
- forward_batch: ForwardBatch,
317
- layernorm: torch.nn.Module,
318
- context: _Context,
319
- ):
276
+ @staticmethod
277
+ def _trivial(
278
+ hidden_states: torch.Tensor,
279
+ forward_batch: ForwardBatch,
280
+ context: CommunicateContext,
281
+ ) -> torch.Tensor:
282
+ return hidden_states
283
+
284
+ @staticmethod
285
+ def _scattered_to_tp_attn_full(
286
+ hidden_states: torch.Tensor,
287
+ forward_batch: ForwardBatch,
288
+ context: CommunicateContext,
289
+ ) -> torch.Tensor:
290
+ hidden_states, local_hidden_states = (
291
+ forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
292
+ hidden_states,
293
+ )
294
+ attn_tp_all_gather(
295
+ list(hidden_states.tensor_split(context.attn_tp_size)),
296
+ local_hidden_states,
297
+ )
298
+ return hidden_states
299
+
300
+
301
+ class CommunicateWithAllReduceAndLayerNormFn:
320
302
  """Besides communication, needs to
321
303
  1. All reduce in tp_attn_group on hidden_states
322
304
  2. Apply layer norm
323
305
  """
324
306
 
325
- def _inner():
326
- nonlocal hidden_states, residual
307
+ @staticmethod
308
+ def get_fn(
309
+ hidden_states_input_mode: ScatterMode,
310
+ residual_input_mode: ScatterMode,
311
+ hidden_states_output_mode: ScatterMode,
312
+ residual_output_mode: ScatterMode,
313
+ context: CommunicateContext,
314
+ ):
327
315
 
328
316
  if (
329
317
  context.is_same_group_size(
@@ -332,32 +320,20 @@ def _communicate_with_all_reduce_and_layer_norm(
332
320
  and context.is_same_group_size(residual_input_mode, residual_output_mode)
333
321
  and context.attn_tp_size == 1
334
322
  ):
335
- # TODO move these `if shape != 0` into LayerNorm itself
336
- if hidden_states.shape[0] != 0:
337
- hidden_states, residual = layernorm(hidden_states, residual)
338
- return hidden_states, residual
323
+ return CommunicateWithAllReduceAndLayerNormFn._simple
339
324
 
340
325
  if (
341
326
  (hidden_states_input_mode == ScatterMode.TP_ATTN_FULL)
342
- and (residual_input_mode == ScatterMode.TP_ATTN_FULL)
327
+ and (
328
+ residual_input_mode in [ScatterMode.SCATTERED, ScatterMode.TP_ATTN_FULL]
329
+ )
343
330
  and (hidden_states_output_mode == ScatterMode.FULL)
344
331
  and (residual_output_mode == ScatterMode.TP_ATTN_FULL)
345
332
  ):
346
- if context.local_attn_dp_size != 1:
347
- if context.attn_tp_rank == 0:
348
- hidden_states += residual
349
- hidden_states, local_hidden_states = (
350
- forward_batch.gathered_buffer,
351
- hidden_states,
352
- )
353
- dp_gather_partial(hidden_states, local_hidden_states, forward_batch)
354
- dp_scatter(residual, hidden_states, forward_batch)
355
- if hidden_states.shape[0] != 0:
356
- hidden_states = layernorm(hidden_states)
357
- else:
358
- hidden_states = tensor_model_parallel_all_reduce(hidden_states)
359
- hidden_states, residual = layernorm(hidden_states, residual)
360
- return hidden_states, residual
333
+ return partial(
334
+ CommunicateWithAllReduceAndLayerNormFn._gather_hidden_states_and_residual,
335
+ residual_input_mode=residual_input_mode,
336
+ )
361
337
 
362
338
  if (
363
339
  (hidden_states_input_mode == ScatterMode.TP_ATTN_FULL)
@@ -367,85 +343,193 @@ def _communicate_with_all_reduce_and_layer_norm(
367
343
  and (hidden_states_output_mode == ScatterMode.SCATTERED)
368
344
  and (residual_output_mode == ScatterMode.SCATTERED)
369
345
  ):
370
- tensor_list = list(hidden_states.tensor_split(context.attn_tp_size))
371
- hidden_states = tensor_list[context.attn_tp_rank]
372
- attn_tp_reduce_scatter(hidden_states, tensor_list)
373
- if residual_input_mode == ScatterMode.TP_ATTN_FULL:
374
- residual = residual.tensor_split(context.attn_tp_size)[
375
- context.attn_tp_rank
376
- ]
377
- if hidden_states.shape[0] != 0:
378
- hidden_states, residual = layernorm(hidden_states, residual)
379
- return hidden_states, residual
346
+ return partial(
347
+ CommunicateWithAllReduceAndLayerNormFn._scatter_hidden_states_and_residual,
348
+ residual_input_mode=residual_input_mode,
349
+ )
380
350
 
381
351
  raise NotImplementedError(
382
352
  f"{hidden_states_input_mode=} {residual_input_mode=} {residual_output_mode=} {residual_output_mode=}"
383
353
  )
384
354
 
385
- context.check_shapes(
386
- (hidden_states, residual), (hidden_states_input_mode, residual_input_mode)
387
- )
388
- return context.check_shapes(
389
- _inner(), (hidden_states_output_mode, residual_output_mode)
390
- )
391
-
392
-
393
- def _communicate_summable_tensor_pair(
394
- hidden_states: torch.Tensor,
395
- residual: torch.Tensor,
396
- forward_batch: ForwardBatch,
397
- hidden_states_input_mode: ScatterMode,
398
- residual_input_mode: ScatterMode,
399
- output_mode: ScatterMode,
400
- context: _Context,
401
- ):
402
- """It is allowed to make (hidden_states, residual) := (hidden_states + residual, None) if needed."""
355
+ @staticmethod
356
+ def _simple(
357
+ hidden_states: torch.Tensor,
358
+ residual: torch.Tensor,
359
+ forward_batch: ForwardBatch,
360
+ layernorm: torch.nn.Module,
361
+ context: CommunicateContext,
362
+ ):
363
+ # TODO move these `if shape != 0` into LayerNorm itself
364
+ if hidden_states.shape[0] != 0:
365
+ hidden_states, residual = layernorm(hidden_states, residual)
366
+ return hidden_states, residual
367
+
368
+ @staticmethod
369
+ def _gather_hidden_states_and_residual(
370
+ hidden_states: torch.Tensor,
371
+ residual: torch.Tensor,
372
+ forward_batch: ForwardBatch,
373
+ layernorm: torch.nn.Module,
374
+ context: CommunicateContext,
375
+ *,
376
+ residual_input_mode,
377
+ ):
378
+ if residual_input_mode == ScatterMode.SCATTERED and context.attn_tp_size > 1:
379
+ residual, local_residual = (
380
+ forward_batch.gathered_buffer[
381
+ : forward_batch.input_ids.shape[0]
382
+ ].clone(),
383
+ residual,
384
+ )
385
+ attn_tp_all_gather(
386
+ list(residual.tensor_split(context.attn_tp_size)), local_residual
387
+ )
388
+ if context.local_attn_dp_size != 1:
389
+ if context.attn_tp_rank == 0:
390
+ hidden_states += residual
391
+ hidden_states, local_hidden_states = (
392
+ forward_batch.gathered_buffer,
393
+ hidden_states,
394
+ )
395
+ dp_gather_partial(hidden_states, local_hidden_states, forward_batch)
396
+ dp_scatter(residual, hidden_states, forward_batch)
397
+ if hidden_states.shape[0] != 0:
398
+ hidden_states = layernorm(hidden_states)
399
+ else:
400
+ hidden_states = tensor_model_parallel_all_reduce(hidden_states)
401
+ hidden_states, residual = layernorm(hidden_states, residual)
402
+ return hidden_states, residual
403
403
 
404
- def _inner():
405
- nonlocal hidden_states, residual
404
+ @staticmethod
405
+ def _scatter_hidden_states_and_residual(
406
+ hidden_states: torch.Tensor,
407
+ residual: torch.Tensor,
408
+ forward_batch: ForwardBatch,
409
+ layernorm: torch.nn.Module,
410
+ context: CommunicateContext,
411
+ *,
412
+ residual_input_mode,
413
+ ):
414
+ tensor_list = list(hidden_states.tensor_split(context.attn_tp_size))
415
+ hidden_states = tensor_list[context.attn_tp_rank]
416
+ attn_tp_reduce_scatter(hidden_states, tensor_list)
417
+ if residual_input_mode == ScatterMode.TP_ATTN_FULL:
418
+ residual = residual.tensor_split(context.attn_tp_size)[context.attn_tp_rank]
419
+ if hidden_states.shape[0] != 0:
420
+ hidden_states, residual = layernorm(hidden_states, residual)
421
+ return hidden_states, residual
422
+
423
+
424
+ class CommunicateSummableTensorPairFn:
425
+ """It is allowed to make (hidden_states, residual) := (hidden_states + residual, None) if needed."""
406
426
 
427
+ @classmethod
428
+ def execute(
429
+ cls,
430
+ hidden_states_input_mode,
431
+ residual_input_mode,
432
+ output_mode,
433
+ context,
434
+ **kwargs,
435
+ ):
436
+ return cls.get_fn(
437
+ hidden_states_input_mode=hidden_states_input_mode,
438
+ residual_input_mode=residual_input_mode,
439
+ output_mode=output_mode,
440
+ context=context,
441
+ )(context=context, **kwargs)
442
+
443
+ @staticmethod
444
+ def get_fn(
445
+ hidden_states_input_mode: ScatterMode,
446
+ residual_input_mode: ScatterMode,
447
+ output_mode: ScatterMode,
448
+ context: CommunicateContext,
449
+ ):
407
450
  if context.is_same_group_size(
408
451
  hidden_states_input_mode, output_mode
409
452
  ) and context.is_same_group_size(residual_input_mode, output_mode):
410
- return hidden_states, residual
453
+ return CommunicateSummableTensorPairFn._trivial
411
454
 
412
455
  if (
413
456
  (hidden_states_input_mode == ScatterMode.FULL)
414
457
  and (residual_input_mode == ScatterMode.TP_ATTN_FULL)
415
458
  and (output_mode == ScatterMode.TP_ATTN_FULL)
416
459
  ):
417
- # TODO(ch-wan): use reduce-scatter in MLP to avoid this scatter
418
- # important: forward batch.gathered_buffer is used both after scatter and after gather.
419
- # be careful about this!
420
- hidden_states, global_hidden_states = (
421
- forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
422
- hidden_states,
423
- )
424
- dp_scatter(hidden_states, global_hidden_states, forward_batch)
425
- return hidden_states, residual
460
+ return CommunicateSummableTensorPairFn._scatter_hidden_states
426
461
 
427
462
  if (
428
463
  (hidden_states_input_mode == ScatterMode.SCATTERED)
429
464
  and (residual_input_mode == ScatterMode.SCATTERED)
430
465
  and (output_mode == ScatterMode.TP_ATTN_FULL)
431
466
  ):
432
- hidden_states += residual
433
- residual = None
434
- hidden_states, local_hidden_states = (
435
- forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
436
- hidden_states,
437
- )
438
- attn_tp_all_gather(
439
- list(hidden_states.tensor_split(context.attn_tp_size)),
440
- local_hidden_states,
441
- )
442
- return hidden_states, residual
467
+ return CommunicateSummableTensorPairFn._gather
468
+
469
+ if (
470
+ (hidden_states_input_mode == ScatterMode.TP_ATTN_FULL)
471
+ and (residual_input_mode == ScatterMode.TP_ATTN_FULL)
472
+ and (output_mode == ScatterMode.SCATTERED)
473
+ ):
474
+ return CommunicateSummableTensorPairFn._scatter
443
475
 
444
476
  raise NotImplementedError(
445
477
  f"{hidden_states_input_mode=} {residual_input_mode=} {output_mode=}"
446
478
  )
447
479
 
448
- context.check_shapes(
449
- (hidden_states, residual), (hidden_states_input_mode, residual_input_mode)
450
- )
451
- return context.check_shapes(_inner(), (output_mode, output_mode))
480
+ @staticmethod
481
+ def _trivial(
482
+ hidden_states: torch.Tensor,
483
+ residual: torch.Tensor,
484
+ forward_batch: ForwardBatch,
485
+ context: CommunicateContext,
486
+ ):
487
+ return hidden_states, residual
488
+
489
+ @staticmethod
490
+ def _scatter_hidden_states(
491
+ hidden_states: torch.Tensor,
492
+ residual: torch.Tensor,
493
+ forward_batch: ForwardBatch,
494
+ context: CommunicateContext,
495
+ ):
496
+ # TODO(ch-wan): use reduce-scatter in MLP to avoid this scatter
497
+ # important: forward batch.gathered_buffer is used both after scatter and after gather.
498
+ # be careful about this!
499
+ hidden_states, global_hidden_states = (
500
+ forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
501
+ hidden_states,
502
+ )
503
+ dp_scatter(hidden_states, global_hidden_states, forward_batch)
504
+ return hidden_states, residual
505
+
506
+ @staticmethod
507
+ def _gather(
508
+ hidden_states: torch.Tensor,
509
+ residual: torch.Tensor,
510
+ forward_batch: ForwardBatch,
511
+ context: CommunicateContext,
512
+ ):
513
+ hidden_states += residual
514
+ residual = None
515
+ hidden_states, local_hidden_states = (
516
+ forward_batch.gathered_buffer[: forward_batch.input_ids.shape[0]],
517
+ hidden_states,
518
+ )
519
+ attn_tp_all_gather(
520
+ list(hidden_states.tensor_split(context.attn_tp_size)),
521
+ local_hidden_states,
522
+ )
523
+ return hidden_states, residual
524
+
525
+ @staticmethod
526
+ def _scatter(
527
+ hidden_states: torch.Tensor,
528
+ residual: torch.Tensor,
529
+ forward_batch: ForwardBatch,
530
+ context: CommunicateContext,
531
+ ):
532
+ assert residual is None, "not yet handled residual!=None"
533
+ tensor_list = list(hidden_states.tensor_split(context.attn_tp_size))
534
+ hidden_states = tensor_list[context.attn_tp_rank]
535
+ return hidden_states, residual
@@ -98,11 +98,12 @@ def initialize_dp_attention(
98
98
  ],
99
99
  local_rank,
100
100
  torch.distributed.get_backend(tp_group.device_group),
101
- SYNC_TOKEN_IDS_ACROSS_TP,
102
- False,
103
- False,
104
- False,
105
- False,
101
+ use_pynccl=SYNC_TOKEN_IDS_ACROSS_TP,
102
+ use_pymscclpp=False,
103
+ use_custom_allreduce=False,
104
+ use_hpu_communicator=False,
105
+ use_xpu_communicator=False,
106
+ use_npu_communicator=False,
106
107
  group_name="attention_tp",
107
108
  )
108
109