Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ END_TILING_DATA_DEF;
struct AddRmsNormBiasCompileInfo {
uint32_t totalCoreNum = 0;
uint64_t totalUbSize = 0;
platform_ascendc::SocVersion socVersion = platform_ascendc::SocVersion::ASCEND910_95;
platform_ascendc::SocVersion socVersion = platform_ascendc::SocVersion::VLLM_ASCEND_950_SOC_ENUM;
};

REGISTER_TILING_DATA_CLASS(AddRmsNormBias, AddRMSNormBiasTilingData)
Expand Down
47 changes: 47 additions & 0 deletions csrc/cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
########################################################################################################################
Expand Down
2 changes: 2 additions & 0 deletions csrc/cmake/intf_pub.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ target_compile_definitions(intf_pub
INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:_GLIBCXX_USE_CXX11_ABI=0>
$<$<CONFIG:Release>:_FORTIFY_SOURCE=2>
$<$<COMPILE_LANGUAGE:CXX>:VLLM_ASCEND_950_SOC_ENUM=${VLLM_ASCEND_950_SOC_ENUM}>
$<$<COMPILE_LANGUAGE:CXX>:VLLM_ASCEND_950_SOC_CONFIG=\"${VLLM_ASCEND_950_SOC_CONFIG}\">
Comment thread
linfeng-yuan marked this conversation as resolved.
)
target_link_options(intf_pub
INTERFACE
Expand Down
4 changes: 2 additions & 2 deletions csrc/moe_gating_top_k/op_host/moe_gating_top_k_def.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class MoeGatingTopK : public OpDef {
.DynamicRankSupportFlag(true)
.DynamicShapeSupportFlag(true)
.ExtendCfgInfo("opFile.value", "moe_gating_top_k_apt");
this->AICore().AddConfig("ascend910_95", regbaseCfg);
this->AICore().AddConfig(VLLM_ASCEND_950_SOC_CONFIG, regbaseCfg);
}
};

OP_ADD(MoeGatingTopK);
} // namespace ops
} // namespace ops
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define CEIL_DIV(a, b) (((a) + (b) - 1) / (b))
#endif
namespace optiling {
const static uint64_t MOE_GATING_TOP_K_REGBASE_TILING_KEY = 10000;
const static uint64_t MOE_GATING_TOP_K_ASCEND_950_TILING_KEY = 10000;

const static int64_t GROUP_SELECT_MODE_MAX = 0;
const static int64_t GROUP_SELECT_MODE_SUM = 1;
Expand Down Expand Up @@ -79,7 +79,7 @@ class MoeGatingTopKTilingRegbase : public Ops::Transformer::OpTiling::TilingBase
protected:
bool IsCapable() override
{
if (socVersion != platform_ascendc::SocVersion::ASCEND910_95) {
if (socVersion != platform_ascendc::SocVersion::VLLM_ASCEND_950_SOC_ENUM) {
return false;
}
Comment thread
linfeng-yuan marked this conversation as resolved.
return true;
Expand Down Expand Up @@ -508,7 +508,7 @@ ge::graphStatus MoeGatingTopKTilingRegbase::PostTiling()

uint64_t MoeGatingTopKTilingRegbase::GetTilingKey() const
{
return MOE_GATING_TOP_K_REGBASE_TILING_KEY;
return MOE_GATING_TOP_K_ASCEND_950_TILING_KEY;
}

void MoeGatingTopKTilingRegbase::Reset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1263,5 +1263,5 @@ void MoeInitRountingCustomTilingBase::Tiling4GatherOutCompute()
lastCorePerLoopIndicesElements, lastCoreLastLoopIndicesElements);
}

REGISTER_TILING_TEMPLATE("MoeInitRoutingCustom", MoeInitRountingCustomTilingBase, 10000); // If not 910_95, fallback to this.
} // namespace optiling
REGISTER_TILING_TEMPLATE("MoeInitRoutingCustom", MoeInitRountingCustomTilingBase, 10000); // Fallback template for non-Ascend950 SoC.
} // namespace optiling