@@ -59,7 +59,9 @@ option(VLLM_XPU_ENABLE_XE_DEFAULT "Enable XE Default architecture kernels" ON)
5959option (BASIC_KERNELS_ENABLED "Build basic kernels (_C extension)" ON )
6060option (FA2_KERNELS_ENABLED
6161 "Build Flash Attention 2 kernels (_vllm_fa2_C extension)" ON )
62- option (MOE_KERNELS_ENABLED "Build MoE kernels (_moe_C extension)" ON )
62+ option (MOE_KERNELS_ENABLED
63+ "Build MoE kernels (_moe_C extension + grouped_gemm TLA)" ON )
64+ option (GDN_KERNELS_ENABLED "Build GDN attention kernels (gdn_attn TLA)" ON )
6365option (XPU_SPECIFIC_KERNELS_ENABLED
6466 "Build XPU-specific kernels (_xpu_C extension)" ON )
6567option (XPUMEM_ALLOCATOR_ENABLED "Build xpumem_allocator extension" ON )
@@ -72,6 +74,7 @@ message(STATUS " VLLM_XPU_ENABLE_XE_DEFAULT = ${VLLM_XPU_ENABLE_XE_DEFAULT}")
7274message (STATUS " BASIC_KERNELS_ENABLED = ${BASIC_KERNELS_ENABLED} " )
7375message (STATUS " FA2_KERNELS_ENABLED = ${FA2_KERNELS_ENABLED} " )
7476message (STATUS " MOE_KERNELS_ENABLED = ${MOE_KERNELS_ENABLED} " )
77+ message (STATUS " GDN_KERNELS_ENABLED = ${GDN_KERNELS_ENABLED} " )
7578message (
7679 STATUS " XPU_SPECIFIC_KERNELS_ENABLED = ${XPU_SPECIFIC_KERNELS_ENABLED} " )
7780message (STATUS " XPUMEM_ALLOCATOR_ENABLED = ${XPUMEM_ALLOCATOR_ENABLED} " )
@@ -331,23 +334,40 @@ if(BUILD_SYCL_TLA_KERNELS)
331334 # extensions shared library
332335 set (SYCL_TLA_COMPILE_OPTIONS "" )
333336 if (VLLM_XPU_ENABLE_XE_DEFAULT)
334- add_subdirectory (csrc/xpu/grouped_gemm/xe_default )
335- list (APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_default" )
337+ if (MOE_KERNELS_ENABLED)
338+ add_subdirectory (csrc/xpu/grouped_gemm/xe_default )
339+ list (APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_default" )
340+ endif ()
336341 list (APPEND SYCL_TLA_COMPILE_OPTIONS -DVLLM_XPU_ENABLE_XE_DEFAULT)
337342 endif ()
338343 if (VLLM_XPU_ENABLE_XE2)
339- add_subdirectory (csrc/xpu/grouped_gemm/xe_2 )
340- add_subdirectory (csrc/xpu/attn/xe_2 )
341- add_subdirectory (csrc/xpu/gdn_attn/xe_2 )
342- list (APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_2" )
343- list (APPEND ATTN_KERNEL_LIB_NAME "attn_kernels_xe_2" )
344- list (APPEND GDN_ATTN_LIB_NAME "gdn_attn_kernels_xe_2" )
344+ if (MOE_KERNELS_ENABLED)
345+ add_subdirectory (csrc/xpu/grouped_gemm/xe_2 )
346+ list (APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_2" )
347+ endif ()
348+ if (FA2_KERNELS_ENABLED)
349+ add_subdirectory (csrc/xpu/attn/xe_2 )
350+ list (APPEND ATTN_KERNEL_LIB_NAME "attn_kernels_xe_2" )
351+ endif ()
352+ if (GDN_KERNELS_ENABLED)
353+ add_subdirectory (csrc/xpu/gdn_attn/xe_2 )
354+ list (APPEND GDN_ATTN_LIB_NAME "gdn_attn_kernels_xe_2" )
355+ endif ()
345356 list (APPEND SYCL_TLA_COMPILE_OPTIONS -DVLLM_XPU_ENABLE_XE2)
346357 endif ()
347358 list (APPEND VLLM_GPU_COMPILE_FLAGS ${SYCL_TLA_COMPILE_OPTIONS} )
348359
349360endif ()
350361
362+ # Feature compile defines — these guard op registrations and interface code so
363+ # that disabled features don't pull in unbuilt TLA library symbols.
364+ if (MOE_KERNELS_ENABLED)
365+ list (APPEND VLLM_GPU_COMPILE_FLAGS -DVLLM_MOE_ENABLED)
366+ endif ()
367+ if (GDN_KERNELS_ENABLED)
368+ list (APPEND VLLM_GPU_COMPILE_FLAGS -DVLLM_GDN_ENABLED)
369+ endif ()
370+
351371# define vLLM XPU cmake variables
352372
353373set (VLLM_XPU_INCLUDE_DIR "" )
@@ -505,9 +525,14 @@ if(XPU_SPECIFIC_KERNELS_ENABLED)
505525 "csrc/xpu/sampler/topk_topp_sampler.cpp"
506526 "csrc/xpu/sycl/deepseek_scaling_rope.cpp"
507527 "csrc/xpu/rand/exponential.cpp"
508- "csrc/xpu/grouped_gemm/grouped_gemm_interface.cpp"
509- "csrc/xpu/utils.cpp"
510- "csrc/xpu/gdn_attn/gdn_attn_interface.cpp" )
528+ "csrc/xpu/utils.cpp" )
529+ if (MOE_KERNELS_ENABLED)
530+ list (APPEND VLLM_EXT_XPU_SRC
531+ "csrc/xpu/grouped_gemm/grouped_gemm_interface.cpp" )
532+ endif ()
533+ if (GDN_KERNELS_ENABLED)
534+ list (APPEND VLLM_EXT_XPU_SRC "csrc/xpu/gdn_attn/gdn_attn_interface.cpp" )
535+ endif ()
511536 include_directories ("/usr/include" )
512537 # TODO: check if we need this flags list(APPEND VLLM_GPU_FLAGS
513538 # "-gline-tables-only")
0 commit comments