Skip to content
Closed
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
5 changes: 5 additions & 0 deletions ggml/src/ggml-spacemit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ if (GGML_BUILD_PROFILE)
target_compile_definitions(${TARGET_NAME} PRIVATE GGML_BUILD_PROFILE)
endif()

option(GGML_SPACEMIT_FA_IME2 "ggml-spacemit: flash attention on the IME2 fp16 engine (experimental)" OFF)
if (GGML_SPACEMIT_FA_IME2)
target_compile_definitions(${TARGET_NAME} PRIVATE GGML_SPACEMIT_FA_IME2)
endif()

# Pass the full march string to the backend target.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv")
set(SPACEMIT_MARCH "-march=rv64gcv_zfh_zvfh_zba_zbb_zbs_zicbop_zihintpause_zawrs_zicond_zvbb")
Expand Down
5 changes: 5 additions & 0 deletions ggml/src/ggml-spacemit/ime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,11 @@ class tensor_traits_common : public ggml::spacemit::tensor_traits_base {
const int64_t ir1 = MIN(ir0 + dr, nr);

if (use_tiled) {
#ifdef GGML_SPACEMIT_FA_IME2
if (spacemit_kernels::rvv::flash_attn_ext_f16_tiled_ime2_supported(dst)) {
spacemit_kernels::rvv::forward_flash_attn_ext_f16_tiled_ime2(ctx, dst, ir0, ir1);
} else
#endif
spacemit_kernels::rvv::forward_flash_attn_ext_f16_tiled_vlen1024_vf16(
ctx, dst, ir0, ir1);
} else {
Expand Down
Loading