[build]: amd for llamafile right now (#1594)

This commit is contained in:
ZiWei Yuan
2025-11-11 18:08:03 +08:00
committed by GitHub
parent bb1a667169
commit a6bb7651f8
2 changed files with 7 additions and 6 deletions

View File

@@ -332,17 +332,17 @@ if(KTRANSFORMERS_CPU_MOE_AMD)
)
if(NOT BLIS_INCLUDE_DIR OR NOT BLIS_LIBRARY)
message(FATAL_ERROR "BLIS not found; set BLIS_ROOT or specify BLIS_INCLUDE_DIR/BLIS_LIBRARY")
message(WARNING "BLIS not found; set BLIS_ROOT or specify BLIS_INCLUDE_DIR/BLIS_LIBRARY")
else()
message(STATUS "Found BLIS include at ${BLIS_INCLUDE_DIR}")
message(STATUS "Found BLIS library ${BLIS_LIBRARY}")
set(_KT_BLIS_INCLUDE_DIR ${BLIS_INCLUDE_DIR})
set(_KT_BLIS_LIBRARY ${BLIS_LIBRARY})
endif()
# The Python extension target (${PROJECT_NAME}) is created later by
# pybind11_add_module(). Calling target_include_directories/target_link_libraries
# here would fail because the target doesn't exist yet. Save the discovered
# BLIS paths and apply them after the module target is created.
set(_KT_BLIS_INCLUDE_DIR ${BLIS_INCLUDE_DIR})
set(_KT_BLIS_LIBRARY ${BLIS_LIBRARY})
endif()

View File

@@ -229,9 +229,10 @@ class CMakeBuild(build_ext):
# Vendor / feature specific toggles
# Enable AMD MoE kernel on AMD by default unless user explicitly set CPUINFER_ENABLE_AMD
if d.get("vendor") == "amd" and os.environ.get("CPUINFER_ENABLE_AMD") is None:
cmake_args.append("-DKTRANSFORMERS_CPU_MOE_AMD=ON")
print("-- Detected AMD CPU; enabling AMD MoE kernel (-DKTRANSFORMERS_CPU_MOE_AMD=ON)")
# temporarily disabled this opt, use llamafile backend for now
# if d.get("vendor") == "amd" and os.environ.get("CPUINFER_ENABLE_AMD") is None:
# cmake_args.append("-DKTRANSFORMERS_CPU_MOE_AMD=ON")
# print("-- Detected AMD CPU; enabling AMD MoE kernel (-DKTRANSFORMERS_CPU_MOE_AMD=ON)")
# On ARM, enable KML by default if not explicitly toggled
if d.get("vendor") == "arm" and os.environ.get("CPUINFER_ENABLE_KML") is None: