[csrc][bugfix] Add compile-time Ascend950/910_95 compatibility for custom ops between CANN8.5 and 9.0 (#6936)
### What this PR does / why we need it?
Remove hardcoded ASCEND910_95 usage in csrc custom-op host/tiling code
and
select the SoC target at CMake configure time.
- Probe CANN headers with check_cxx_source_compiles:
prefer platform_ascendc::SocVersion::ASCEND950, fallback to
ASCEND910_95.
- Export the selected enum/config string via shared compile definitions
(VLLM_ASCEND_950_SOC_ENUM / VLLM_ASCEND_950_SOC_CONFIG).
- Apply the shared macros to affected paths (moe_gating_top_k,
add_rms_norm_bias) to avoid per-file hardcoding.
- Keep behavior unchanged; this is an internal build-compatibility fix
for CANN 8.5 and 9.x.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
- vLLM version: v0.16.0
- vLLM main:
15d76f74e2
---------
Signed-off-by: linfeng-yuan <1102311262@qq.com>
This commit is contained in:
@@ -17,6 +17,7 @@ if ((NOT Python3_FOUND) OR (${Python3_EXECUTABLE} STREQUAL ""))
|
||||
message(FATAL_ERROR "Can't find python3.")
|
||||
endif ()
|
||||
set(HI_PYTHON "${Python3_EXECUTABLE}" CACHE STRING "python executor")
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# Get the base CANN path
|
||||
if (CUSTOM_ASCEND_CANN_PACKAGE_PATH)
|
||||
@@ -30,6 +31,52 @@ else()
|
||||
endif ()
|
||||
message(STATUS "ASCEND_CANN_PACKAGE_PATH=${ASCEND_CANN_PACKAGE_PATH}")
|
||||
|
||||
# Detect A5-compatible SoC enum support from the CANN headers we are compiling against.
|
||||
set(_saved_CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES}")
|
||||
set(CMAKE_REQUIRED_INCLUDES
|
||||
${ASCEND_CANN_PACKAGE_PATH}/include
|
||||
${ASCEND_CANN_PACKAGE_PATH}/include/external
|
||||
${ASCEND_CANN_PACKAGE_PATH}/include/experiment/platform
|
||||
${ASCEND_CANN_PACKAGE_PATH}/include/experiment/runtime
|
||||
)
|
||||
|
||||
check_cxx_source_compiles([[
|
||||
#include "tiling/platform/platform_ascendc.h"
|
||||
int main()
|
||||
{
|
||||
auto soc = platform_ascendc::SocVersion::ASCEND950;
|
||||
(void)soc;
|
||||
return 0;
|
||||
}
|
||||
]] VLLM_ASCEND_HAS_SOC_ASCEND950)
|
||||
|
||||
check_cxx_source_compiles([[
|
||||
#include "tiling/platform/platform_ascendc.h"
|
||||
int main()
|
||||
{
|
||||
auto soc = platform_ascendc::SocVersion::ASCEND910_95;
|
||||
(void)soc;
|
||||
return 0;
|
||||
}
|
||||
]] VLLM_ASCEND_HAS_SOC_ASCEND910_95)
|
||||
|
||||
if (VLLM_ASCEND_HAS_SOC_ASCEND950)
|
||||
set(VLLM_ASCEND_950_SOC_ENUM "ASCEND950")
|
||||
set(VLLM_ASCEND_950_SOC_CONFIG "ascend950")
|
||||
elseif (VLLM_ASCEND_HAS_SOC_ASCEND910_95)
|
||||
set(VLLM_ASCEND_950_SOC_ENUM "ASCEND910_95")
|
||||
set(VLLM_ASCEND_950_SOC_CONFIG "ascend910_95")
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"Neither platform_ascendc::SocVersion::ASCEND950 nor ASCEND910_95 is available in CANN headers.")
|
||||
endif ()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES "${_saved_CMAKE_REQUIRED_INCLUDES}")
|
||||
unset(_saved_CMAKE_REQUIRED_INCLUDES)
|
||||
|
||||
message(STATUS "VLLM_ASCEND_950_SOC_ENUM=${VLLM_ASCEND_950_SOC_ENUM}, "
|
||||
"VLLM_ASCEND_950_SOC_CONFIG=${VLLM_ASCEND_950_SOC_CONFIG}")
|
||||
|
||||
########################################################################################################################
|
||||
# Common Configuration
|
||||
########################################################################################################################
|
||||
|
||||
Reference in New Issue
Block a user