Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions .github/workflows/ut.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@ on:
branches: [main]
push:
branches: [main]
schedule:
# Nightly full-scope run at 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
test_scope:
description: 'Test scope: full, ci, mini, ondemand:llama, ondemand:deepseek'
required: false
default: 'ci'

permissions:
contents: read

env:
REGISTRY: localhost:5000
# Nightly (schedule) → full scope; manual dispatch → user choice; PR/push → ci scope
XPU_KERNEL_TEST_SCOPE: ${{ github.event_name == 'schedule' && 'full' || github.event.inputs.test_scope || 'ci' }}

jobs:

Expand Down Expand Up @@ -87,8 +98,9 @@ jobs:

- name: test
run: |
ZE_AFFINITY_MASK=0,1 SKIP_HANG_KERNEL=1 SKIP_ACC_ERROR_KERNEL=1 pytest -v -s tests/
VLLM_XPU_FORCE_XE_DEFAULT_KERNEL=1 ZE_AFFINITY_MASK=0,1 pytest -v -s tests/fused_moe/test_grouped_gemm.py::test_grouped_gemm
echo "Running tests with XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }}"
XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }} ZE_AFFINITY_MASK=0,1 SKIP_HANG_KERNEL=1 SKIP_ACC_ERROR_KERNEL=1 pytest -v -s tests/
VLLM_XPU_FORCE_XE_DEFAULT_KERNEL=1 XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }} ZE_AFFINITY_MASK=0,1 pytest -v -s tests/fused_moe/test_grouped_gemm.py::test_grouped_gemm

clean-repo-pvc:
runs-on: self-hosted-pvc
Expand Down Expand Up @@ -129,11 +141,12 @@ jobs:

- name: test
run: |
echo "Running tests with XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }}"
# tests/test_moe_align_block_size.py, tests/test_moe_lora_align_sum.py takes much time than expected. ignore it for now.
ZE_AFFINITY_MASK=0,1 pytest -v -s tests/ --ignore=tests/test_lora_ops.py --ignore=tests/test_fp8_quant.py --ignore=tests/test_moe_align_block_size.py --ignore=tests/test_moe_lora_align_sum.py --ignore=tests/test_cache.py::test_swap_blocks --ignore=tests/test_topk_per_row.py --ignore=tests/test_lora_ops.py
XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }} ZE_AFFINITY_MASK=0,1 pytest -v -s tests/ --ignore=tests/test_lora_ops.py --ignore=tests/test_fp8_quant.py --ignore=tests/test_moe_align_block_size.py --ignore=tests/test_moe_lora_align_sum.py --ignore=tests/test_cache.py::test_swap_blocks --ignore=tests/test_topk_per_row.py --ignore=tests/test_lora_ops.py
# fixme: Running lora UT separately to avoid OOM when running together with other tests.
ZE_AFFINITY_MASK=0,1 pytest -v -s tests/test_lora_ops.py
VLLM_XPU_FORCE_XE_DEFAULT_KERNEL=1 ZE_AFFINITY_MASK=0,1 pytest -v -s tests/fused_moe/test_grouped_gemm.py::test_grouped_gemm
XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }} ZE_AFFINITY_MASK=0,1 pytest -v -s tests/test_lora_ops.py
VLLM_XPU_FORCE_XE_DEFAULT_KERNEL=1 XPU_KERNEL_TEST_SCOPE=${{ env.XPU_KERNEL_TEST_SCOPE }} ZE_AFFINITY_MASK=0,1 pytest -v -s tests/fused_moe/test_grouped_gemm.py::test_grouped_gemm

clean-repo-bmg:
runs-on: self-hosted-bmg
Expand Down
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ default_stages:
- manual # Run in CI
exclude: 'vllm/third_party/.*'
repos:
- repo: https://github.com/google/yapf
rev: v0.43.0
hooks:
- id: yapf
args: [--in-place, --verbose]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.7
hooks:
Expand Down
94 changes: 72 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,35 @@ set(BUILD_SYCL_TLA_KERNELS
ON
CACHE BOOL "Build SYCL-TLA based kernels for XPU")
# ARCHITECTURE OPTIONS
set(VLLM_XPU_ENABLE_XE2 ON)
set(VLLM_XPU_ENABLE_XE_DEFAULT ON)

set(BASIC_KERNELS_ENABLED ON)
set(FA2_KERNELS_ENABLED ON)
set(GND_KERNELS_ENABLED ON)
set(MOE_KERNELS_ENABLED ON)
set(XPU_SPECIFIC_KERNELS_ENABLED ON)
option(VLLM_XPU_ENABLE_XE2 "Enable XE2 architecture kernels" ON)
option(VLLM_XPU_ENABLE_XE_DEFAULT "Enable XE Default architecture kernels" ON)

# KERNEL OPTIONS — each controls whether the corresponding Python extension is
# built. Override from the command line with -D<NAME>=OFF or via the
# identically-named environment variable (read by setup.py).
option(BASIC_KERNELS_ENABLED "Build basic kernels (_C extension)" ON)
option(FA2_KERNELS_ENABLED
"Build Flash Attention 2 kernels (_vllm_fa2_C extension)" ON)
option(MOE_KERNELS_ENABLED
"Build MoE kernels (_moe_C extension + grouped_gemm TLA)" ON)
option(GDN_KERNELS_ENABLED "Build GDN attention kernels (gdn_attn TLA)" ON)
option(XPU_SPECIFIC_KERNELS_ENABLED
"Build XPU-specific kernels (_xpu_C extension)" ON)
option(XPUMEM_ALLOCATOR_ENABLED "Build xpumem_allocator extension" ON)

message(STATUS "")
message(STATUS "Kernel build configuration:")
message(STATUS " BUILD_SYCL_TLA_KERNELS = ${BUILD_SYCL_TLA_KERNELS}")
message(STATUS " VLLM_XPU_ENABLE_XE2 = ${VLLM_XPU_ENABLE_XE2}")
message(STATUS " VLLM_XPU_ENABLE_XE_DEFAULT = ${VLLM_XPU_ENABLE_XE_DEFAULT}")
message(STATUS " BASIC_KERNELS_ENABLED = ${BASIC_KERNELS_ENABLED}")
message(STATUS " FA2_KERNELS_ENABLED = ${FA2_KERNELS_ENABLED}")
message(STATUS " MOE_KERNELS_ENABLED = ${MOE_KERNELS_ENABLED}")
message(STATUS " GDN_KERNELS_ENABLED = ${GDN_KERNELS_ENABLED}")
message(
STATUS " XPU_SPECIFIC_KERNELS_ENABLED = ${XPU_SPECIFIC_KERNELS_ENABLED}")
message(STATUS " XPUMEM_ALLOCATOR_ENABLED = ${XPUMEM_ALLOCATOR_ENABLED}")
message(STATUS "")

#
# Try to find python package with an executable that exactly matches
Expand Down Expand Up @@ -313,23 +334,40 @@ if(BUILD_SYCL_TLA_KERNELS)
# extensions shared library
set(SYCL_TLA_COMPILE_OPTIONS "")
if(VLLM_XPU_ENABLE_XE_DEFAULT)
add_subdirectory(csrc/xpu/grouped_gemm/xe_default)
list(APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_default")
if(MOE_KERNELS_ENABLED)
add_subdirectory(csrc/xpu/grouped_gemm/xe_default)
list(APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_default")
endif()
list(APPEND SYCL_TLA_COMPILE_OPTIONS -DVLLM_XPU_ENABLE_XE_DEFAULT)
endif()
if(VLLM_XPU_ENABLE_XE2)
add_subdirectory(csrc/xpu/grouped_gemm/xe_2)
add_subdirectory(csrc/xpu/attn/xe_2)
add_subdirectory(csrc/xpu/gdn_attn/xe_2)
list(APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_2")
list(APPEND ATTN_KERNEL_LIB_NAME "attn_kernels_xe_2")
list(APPEND GDN_ATTN_LIB_NAME "gdn_attn_kernels_xe_2")
if(MOE_KERNELS_ENABLED)
add_subdirectory(csrc/xpu/grouped_gemm/xe_2)
list(APPEND GROUPED_GEMM_LIB_NAME "grouped_gemm_xe_2")
endif()
if(FA2_KERNELS_ENABLED)
add_subdirectory(csrc/xpu/attn/xe_2)
list(APPEND ATTN_KERNEL_LIB_NAME "attn_kernels_xe_2")
endif()
if(GDN_KERNELS_ENABLED)
add_subdirectory(csrc/xpu/gdn_attn/xe_2)
list(APPEND GDN_ATTN_LIB_NAME "gdn_attn_kernels_xe_2")
endif()
list(APPEND SYCL_TLA_COMPILE_OPTIONS -DVLLM_XPU_ENABLE_XE2)
endif()
list(APPEND VLLM_GPU_COMPILE_FLAGS ${SYCL_TLA_COMPILE_OPTIONS})

endif()

# Feature compile defines — these guard op registrations and interface code so
# that disabled features don't pull in unbuilt TLA library symbols.
if(MOE_KERNELS_ENABLED)
list(APPEND VLLM_GPU_COMPILE_FLAGS -DVLLM_MOE_ENABLED)
endif()
if(GDN_KERNELS_ENABLED)
list(APPEND VLLM_GPU_COMPILE_FLAGS -DVLLM_GDN_ENABLED)
endif()

# define vLLM XPU cmake variables

set(VLLM_XPU_INCLUDE_DIR "")
Expand All @@ -352,9 +390,6 @@ list(
#
# xpumem_allocator extension - XPU memory allocator with Python callbacks
#
set(XPUMEM_ALLOCATOR_ENABLED
ON
CACHE BOOL "Build xpumem_allocator extension")
if(XPUMEM_ALLOCATOR_ENABLED)
message(STATUS "Enabling xpumem_allocator extension.")

Expand Down Expand Up @@ -404,8 +439,10 @@ if(BASIC_KERNELS_ENABLED)
set(VLLM_EXT_SRC
"csrc/cache.cpp"
"csrc/layernorm.cpp"
"csrc/layernorm_quant.cpp"
"csrc/activation.cpp"
"csrc/pos_encoding_kernels.cpp"
"csrc/fused_qknorm_rope.cpp"
"csrc/torch_bindings.cpp"
"csrc/quantization/fp8/fp8_quant.cpp"
"csrc/quantization/fp4/mxfp4_quant.cpp"
Expand Down Expand Up @@ -441,6 +478,14 @@ endif()
#
# flash attention _C extension
#
if(FA2_KERNELS_ENABLED AND NOT ATTN_KERNEL_LIB_NAME)
message(
WARNING
"FA2_KERNELS_ENABLED is ON but no attention kernel libraries are available. "
"The _vllm_fa2_C extension will be built without kernel libraries and may "
"fail at runtime. Enable BUILD_SYCL_TLA_KERNELS and VLLM_XPU_ENABLE_XE2 "
"for full FA2 functionality.")
endif()
if(FA2_KERNELS_ENABLED)
message(STATUS "Enabling fa2 extension.")
file(GLOB FA2_GEN_SRCS "csrc/flash_attn/*.cpp"
Expand Down Expand Up @@ -482,9 +527,14 @@ if(XPU_SPECIFIC_KERNELS_ENABLED)
"csrc/xpu/sampler/topk_topp_sampler.cpp"
"csrc/xpu/sycl/deepseek_scaling_rope.cpp"
"csrc/xpu/rand/exponential.cpp"
"csrc/xpu/grouped_gemm/grouped_gemm_interface.cpp"
"csrc/xpu/utils.cpp"
"csrc/xpu/gdn_attn/gdn_attn_interface.cpp")
"csrc/xpu/utils.cpp")
if(MOE_KERNELS_ENABLED)
list(APPEND VLLM_EXT_XPU_SRC
"csrc/xpu/grouped_gemm/grouped_gemm_interface.cpp")
endif()
if(GDN_KERNELS_ENABLED)
list(APPEND VLLM_EXT_XPU_SRC "csrc/xpu/gdn_attn/gdn_attn_interface.cpp")
endif()
include_directories("/usr/include")
# TODO: check if we need this flags list(APPEND VLLM_GPU_FLAGS
# "-gline-tables-only")
Expand Down
Loading
Loading