From 7ebd90c671b644e659720329316d2b5ab1b6a012 Mon Sep 17 00:00:00 2001 From: zaneni6 Date: Wed, 14 Oct 2026 17:20:21 -0700 Subject: [PATCH] Register each test harness's engines with the backend registry automodel.cpp builds engines through the backend registry, so every harness that compiles it has to compile model_backend.cpp and define register_builtin_backends; only the MiniCPM-V and rai harnesses did. The others now register the families of the engine libraries they link (none for Qwen3.5-Omni, which builds its engine itself). Whisper's Makefile drops automodel.cpp, which it never used; its CMake build already did without. Also link the harnesses from lib/xrt, where the engine libs moved with the HRX split, and give the MiniCPM-V harness the image sources its Makefile has. Co-Authored-By: Claude --- src/test/CMakeLists.txt | 3 +- src/test/gemma4_12b/CMakeLists.txt | 1 + src/test/gemma4_12b/Makefile | 1 + src/test/gemma4_12b/test.cpp | 9 ++++++ src/test/gemma4e_flash/CMakeLists.txt | 1 + src/test/gemma4e_flash/Makefile | 1 + src/test/gemma4e_flash/test.cpp | 10 ++++++ src/test/gemma4e_npu/CMakeLists.txt | 1 + src/test/gemma4e_npu/Makefile | 1 + src/test/gemma4e_npu/test.cpp | 10 ++++++ src/test/gemma_npu/CMakeLists.txt | 1 + src/test/gemma_npu/Makefile | 1 + src/test/gemma_npu/test.cpp | 9 ++++++ src/test/gemma_text_npu/CMakeLists.txt | 1 + src/test/gemma_text_npu/Makefile | 1 + src/test/gemma_text_npu/test.cpp | 9 ++++++ src/test/gpt_oss_npu/CMakeLists.txt | 1 + src/test/gpt_oss_npu/Makefile | 1 + src/test/gpt_oss_npu/test.cpp | 9 ++++++ src/test/hunyuan_npu/CMakeLists.txt | 1 + src/test/hunyuan_npu/Makefile | 1 + src/test/hunyuan_npu/test.cpp | 9 ++++++ src/test/lfm2_npu/CMakeLists.txt | 1 + src/test/lfm2_npu/Makefile | 1 + src/test/lfm2_npu/test.cpp | 10 ++++++ src/test/llama_npu/CMakeLists.txt | 1 + src/test/llama_npu/Makefile | 1 + src/test/llama_npu/test.cpp | 10 ++++++ src/test/minicpm_v_4_7_npu/CMakeLists.txt | 37 +++++++++++++++++++++++ src/test/nanbeige_npu/CMakeLists.txt | 1 + src/test/nanbeige_npu/Makefile | 1 + src/test/nanbeige_npu/test.cpp | 9 ++++++ src/test/phi4_npu/CMakeLists.txt | 1 + src/test/phi4_npu/Makefile | 1 + src/test/phi4_npu/test.cpp | 9 ++++++ src/test/qwen2_npu/CMakeLists.txt | 1 + src/test/qwen2_npu/Makefile | 1 + src/test/qwen2_npu/test.cpp | 9 ++++++ src/test/qwen2vl_npu/CMakeLists.txt | 1 + src/test/qwen2vl_npu/Makefile | 1 + src/test/qwen2vl_npu/test.cpp | 9 ++++++ src/test/qwen3_5_omni_npu/CMakeLists.txt | 1 + src/test/qwen3_5_omni_npu/Makefile | 1 + src/test/qwen3_5_omni_npu/test.cpp | 8 +++++ src/test/qwen3_5vl_npu/CMakeLists.txt | 1 + src/test/qwen3_5vl_npu/Makefile | 1 + src/test/qwen3_5vl_npu/test.cpp | 9 ++++++ src/test/qwen3_6_moe_npu/CMakeLists.txt | 1 + src/test/qwen3_6_moe_npu/Makefile | 1 + src/test/qwen3_6_moe_npu/test.cpp | 9 ++++++ src/test/qwen3_8mtp_npu/CMakeLists.txt | 1 + src/test/qwen3_8mtp_npu/Makefile | 1 + src/test/qwen3_8mtp_npu/test.cpp | 9 ++++++ src/test/qwen3_npu/CMakeLists.txt | 1 + src/test/qwen3_npu/Makefile | 1 + src/test/qwen3_npu/test.cpp | 12 ++++++++ src/test/qwen3vl_flash/CMakeLists.txt | 1 + src/test/qwen3vl_flash/Makefile | 1 + src/test/qwen3vl_flash/test.cpp | 10 ++++++ src/test/qwen3vl_npu/CMakeLists.txt | 1 + src/test/qwen3vl_npu/Makefile | 1 + src/test/qwen3vl_npu/test.cpp | 10 ++++++ src/test/whisper_npu/Makefile | 1 - 63 files changed, 267 insertions(+), 2 deletions(-) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 8d9258555..cf43aa28d 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -95,7 +95,8 @@ function(add_npu_test TARGET_NAME OUTPUT_SUBDIR) # Basic link settings for test target_link_directories(${TARGET_NAME} PUBLIC - ${CMAKE_SOURCE_DIR}/../../lib + # the XRT-built engine libs; the HRX ones sit beside them in lib/hrx + ${CMAKE_SOURCE_DIR}/../../lib/xrt ${XRT_LIB_DIR} ${CMAKE_SOURCE_DIR}/../../build/tokenizer/lib C:/dev/boost_1_88_0/stage/lib diff --git a/src/test/gemma4_12b/CMakeLists.txt b/src/test/gemma4_12b/CMakeLists.txt index 80a5d8acf..118a2ae00 100644 --- a/src/test/gemma4_12b/CMakeLists.txt +++ b/src/test/gemma4_12b/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4_12b.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4_12b_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4_12b_audio.cpp" diff --git a/src/test/gemma4_12b/Makefile b/src/test/gemma4_12b/Makefile index 522cf5c5a..ce1dae0dc 100644 --- a/src/test/gemma4_12b/Makefile +++ b/src/test/gemma4_12b/Makefile @@ -19,6 +19,7 @@ TYPE ?= 3 SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_gemma4_12b.cpp SOURCES += ../../common/AutoModel/modeling_gemma4_12b_image.cpp diff --git a/src/test/gemma4_12b/test.cpp b/src/test/gemma4_12b/test.cpp index 9ff81cbf7..92cdd7a8b 100644 --- a/src/test/gemma4_12b/test.cpp +++ b/src/test/gemma4_12b/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_gemma4_12b.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("gemma4-12b", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/gemma4e_flash/CMakeLists.txt b/src/test/gemma4e_flash/CMakeLists.txt index 7fcd57deb..c566e8a0e 100644 --- a/src/test/gemma4e_flash/CMakeLists.txt +++ b/src/test/gemma4e_flash/CMakeLists.txt @@ -20,6 +20,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4e.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4e_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4e_audio.cpp" diff --git a/src/test/gemma4e_flash/Makefile b/src/test/gemma4e_flash/Makefile index a67fd2f10..6cbfb884c 100644 --- a/src/test/gemma4e_flash/Makefile +++ b/src/test/gemma4e_flash/Makefile @@ -17,6 +17,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_gemma4e.cpp SOURCES += ../../common/AutoModel/modeling_gemma4e_image.cpp diff --git a/src/test/gemma4e_flash/test.cpp b/src/test/gemma4e_flash/test.cpp index 16e70474b..1e512ed06 100644 --- a/src/test/gemma4e_flash/test.cpp +++ b/src/test/gemma4e_flash/test.cpp @@ -3,8 +3,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_gemma4e.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("gemma4e", kFlmBackendId, flm_factory()); + registry.register_backend("gemma4e-flash", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/gemma4e_npu/CMakeLists.txt b/src/test/gemma4e_npu/CMakeLists.txt index 87f870791..ab94d95a0 100644 --- a/src/test/gemma4e_npu/CMakeLists.txt +++ b/src/test/gemma4e_npu/CMakeLists.txt @@ -20,6 +20,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4e.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4e_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma4e_audio.cpp" diff --git a/src/test/gemma4e_npu/Makefile b/src/test/gemma4e_npu/Makefile index 47190eb7a..bff55f621 100644 --- a/src/test/gemma4e_npu/Makefile +++ b/src/test/gemma4e_npu/Makefile @@ -17,6 +17,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_gemma4e.cpp SOURCES += ../../common/AutoModel/modeling_gemma4e_image.cpp diff --git a/src/test/gemma4e_npu/test.cpp b/src/test/gemma4e_npu/test.cpp index 79a73c070..715eed196 100644 --- a/src/test/gemma4e_npu/test.cpp +++ b/src/test/gemma4e_npu/test.cpp @@ -3,8 +3,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_gemma4e.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("gemma4e", kFlmBackendId, flm_factory()); + registry.register_backend("gemma4e-flash", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/gemma_npu/CMakeLists.txt b/src/test/gemma_npu/CMakeLists.txt index 8f98b39f6..528d3a1cd 100644 --- a/src/test/gemma_npu/CMakeLists.txt +++ b/src/test/gemma_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma3.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma3_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/image/image_reader.cpp" diff --git a/src/test/gemma_npu/Makefile b/src/test/gemma_npu/Makefile index 0065c7a3b..28ad2ed33 100644 --- a/src/test/gemma_npu/Makefile +++ b/src/test/gemma_npu/Makefile @@ -18,6 +18,7 @@ -include ../common.mk SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_gemma3.cpp SOURCES += ../../common/AutoModel/modeling_gemma3_image.cpp diff --git a/src/test/gemma_npu/test.cpp b/src/test/gemma_npu/test.cpp index 9e5cef6b3..3dd7a5a56 100644 --- a/src/test/gemma_npu/test.cpp +++ b/src/test/gemma_npu/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_gemma3.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("gemma3", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/gemma_text_npu/CMakeLists.txt b/src/test/gemma_text_npu/CMakeLists.txt index dedd5aac0..2ef31820c 100644 --- a/src/test/gemma_text_npu/CMakeLists.txt +++ b/src/test/gemma_text_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gemma3_text.cpp" ) diff --git a/src/test/gemma_text_npu/Makefile b/src/test/gemma_text_npu/Makefile index bc7b4e26a..70febaea8 100644 --- a/src/test/gemma_text_npu/Makefile +++ b/src/test/gemma_text_npu/Makefile @@ -15,6 +15,7 @@ # ============================================================================= -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_gemma3_text.cpp) SOURCES += $(wildcard ../../common/tokenizer/tokenizer.cpp) diff --git a/src/test/gemma_text_npu/test.cpp b/src/test/gemma_text_npu/test.cpp index a6cee06a5..297294fc2 100644 --- a/src/test/gemma_text_npu/test.cpp +++ b/src/test/gemma_text_npu/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_gemma3_text.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("gemma3-text", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; // Model-specific factory function for Gemma3 Text family only inline std::pair> get_gemma_text_model(const std::string& model_tag, flm_rt::device* npu_device_inst) { diff --git a/src/test/gpt_oss_npu/CMakeLists.txt b/src/test/gpt_oss_npu/CMakeLists.txt index a0c1d478e..7f7b37b96 100644 --- a/src/test/gpt_oss_npu/CMakeLists.txt +++ b/src/test/gpt_oss_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_gpt_oss.cpp" ) diff --git a/src/test/gpt_oss_npu/Makefile b/src/test/gpt_oss_npu/Makefile index 59b5d035a..0db84fc2a 100644 --- a/src/test/gpt_oss_npu/Makefile +++ b/src/test/gpt_oss_npu/Makefile @@ -16,6 +16,7 @@ -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_gpt_oss.cpp) SOURCES += $(wildcard ../../include/AutoModel/automodel.hpp) diff --git a/src/test/gpt_oss_npu/test.cpp b/src/test/gpt_oss_npu/test.cpp index c29d0b251..b17b9f1be 100644 --- a/src/test/gpt_oss_npu/test.cpp +++ b/src/test/gpt_oss_npu/test.cpp @@ -7,9 +7,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_gpt_oss.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "utils/vm_args.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("gpt-oss", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; diff --git a/src/test/hunyuan_npu/CMakeLists.txt b/src/test/hunyuan_npu/CMakeLists.txt index 76a637a49..1328e9995 100644 --- a/src/test/hunyuan_npu/CMakeLists.txt +++ b/src/test/hunyuan_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_hunyuan.cpp" ) diff --git a/src/test/hunyuan_npu/Makefile b/src/test/hunyuan_npu/Makefile index 089111767..64f453eeb 100644 --- a/src/test/hunyuan_npu/Makefile +++ b/src/test/hunyuan_npu/Makefile @@ -36,6 +36,7 @@ endif SOURCES += test.cpp SOURCES += bench_prefill.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_hunyuan.cpp SOURCES += ../../common/tokenizer/tokenizer.cpp diff --git a/src/test/hunyuan_npu/test.cpp b/src/test/hunyuan_npu/test.cpp index 4d52f3d61..7b9819c28 100644 --- a/src/test/hunyuan_npu/test.cpp +++ b/src/test/hunyuan_npu/test.cpp @@ -25,9 +25,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_hunyuan.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "bench_samples.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("hunyuan", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; /// \brief the fixed translator instruction, installed as the system prompt diff --git a/src/test/lfm2_npu/CMakeLists.txt b/src/test/lfm2_npu/CMakeLists.txt index f819a5c2e..6ea7e9483 100644 --- a/src/test/lfm2_npu/CMakeLists.txt +++ b/src/test/lfm2_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_lfm2.cpp" ) diff --git a/src/test/lfm2_npu/Makefile b/src/test/lfm2_npu/Makefile index b578ff628..ce0ef54a9 100644 --- a/src/test/lfm2_npu/Makefile +++ b/src/test/lfm2_npu/Makefile @@ -16,6 +16,7 @@ -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_lfm2.cpp) SOURCES += $(wildcard ../../include/AutoModel/automodel.hpp) diff --git a/src/test/lfm2_npu/test.cpp b/src/test/lfm2_npu/test.cpp index cbc33ac2b..be7a7a3a2 100644 --- a/src/test/lfm2_npu/test.cpp +++ b/src/test/lfm2_npu/test.cpp @@ -4,10 +4,20 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_lfm2.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "utils/vm_args.hpp" #include "metrices.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("lfm2", kFlmBackendId, flm_factory()); + registry.register_backend("lfm2.5-tk", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; // Model-specific factory function for Llama family and DeepSeek_r1_8b diff --git a/src/test/llama_npu/CMakeLists.txt b/src/test/llama_npu/CMakeLists.txt index fe277a2d6..5f1f3731f 100644 --- a/src/test/llama_npu/CMakeLists.txt +++ b/src/test/llama_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_llama3.cpp" ) diff --git a/src/test/llama_npu/Makefile b/src/test/llama_npu/Makefile index b2fbe0689..ce74279af 100644 --- a/src/test/llama_npu/Makefile +++ b/src/test/llama_npu/Makefile @@ -16,6 +16,7 @@ -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_llama3.cpp) SOURCES += $(wildcard ../../common/tokenizer/tokenizer.cpp) diff --git a/src/test/llama_npu/test.cpp b/src/test/llama_npu/test.cpp index cf2959baa..26cb87e99 100644 --- a/src/test/llama_npu/test.cpp +++ b/src/test/llama_npu/test.cpp @@ -7,9 +7,19 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_llama3.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "utils/vm_args.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("llama3", kFlmBackendId, flm_factory()); + registry.register_backend("deepseek-r1", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/minicpm_v_4_7_npu/CMakeLists.txt b/src/test/minicpm_v_4_7_npu/CMakeLists.txt index 90cd5338c..25cdade33 100644 --- a/src/test/minicpm_v_4_7_npu/CMakeLists.txt +++ b/src/test/minicpm_v_4_7_npu/CMakeLists.txt @@ -4,22 +4,59 @@ project(minicpm_v_4_7_npu VERSION 1.0.0 LANGUAGES CXX) include(${CMAKE_CURRENT_LIST_DIR}/../CMakeLists.txt) npu_test_setup() +# Find and enable OpenMP for multi-threading +find_package(OpenMP) +if(OpenMP_CXX_FOUND) + message(STATUS "OpenMP found - enabling multi-threading support for test") +else() + message(WARNING "OpenMP not found - some optimizations will run single-threaded") +endif() + +# Same image sources as the Makefile: see the note there on why imageproc.cpp is +# linked although MiniCPM resizes with its own PIL-exact code. add_npu_test( test_minicpm_v_4_7_npu test/minicpm_v_4_7_npu USE_AUTOMODEL USE_TOKENIZER USE_SAMPLER + USE_AVX512 SOURCES "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_minicpm_v.cpp" + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_minicpm_v_image.cpp" + "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageproc.cpp" + "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageprocAVX512.cpp" + "${CMAKE_SOURCE_DIR}/../../common/image/image_reader.cpp" +) + +target_compile_definitions(test_minicpm_v_4_7_npu PUBLIC + USEAVX512=1 ) +# Add OpenMP compiler flags if available +if(OpenMP_CXX_FOUND) + target_compile_options(test_minicpm_v_4_7_npu PUBLIC + $<$:/openmp> + $<$>:-fopenmp> + ) +endif() + target_link_libraries(test_minicpm_v_4_7_npu PUBLIC minicpm_v_4_7_npu xrt_coreutil + avformat + avcodec + avutil + swscale + zlib ) +# Link OpenMP if available +if(OpenMP_CXX_FOUND) + target_link_libraries(test_minicpm_v_4_7_npu PUBLIC OpenMP::OpenMP_CXX) +endif() + # Add test target add_custom_target(test_minicpm_v_4_7_npu_target DEPENDS test_minicpm_v_4_7_npu diff --git a/src/test/nanbeige_npu/CMakeLists.txt b/src/test/nanbeige_npu/CMakeLists.txt index 9ca96ed63..9294a20e5 100644 --- a/src/test/nanbeige_npu/CMakeLists.txt +++ b/src/test/nanbeige_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_nanbeige.cpp" ) diff --git a/src/test/nanbeige_npu/Makefile b/src/test/nanbeige_npu/Makefile index 0a2059614..f5f2802fd 100644 --- a/src/test/nanbeige_npu/Makefile +++ b/src/test/nanbeige_npu/Makefile @@ -16,6 +16,7 @@ -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_nanbeige.cpp) SOURCES += $(wildcard ../../common/tokenizer/tokenizer.cpp) diff --git a/src/test/nanbeige_npu/test.cpp b/src/test/nanbeige_npu/test.cpp index e2a5e46fb..0831ce94c 100644 --- a/src/test/nanbeige_npu/test.cpp +++ b/src/test/nanbeige_npu/test.cpp @@ -7,9 +7,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_nanbeige.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "utils/vm_args.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("nanbeige", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/phi4_npu/CMakeLists.txt b/src/test/phi4_npu/CMakeLists.txt index 7749cccb7..575dc2ed9 100644 --- a/src/test/phi4_npu/CMakeLists.txt +++ b/src/test/phi4_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_phi4.cpp" ) diff --git a/src/test/phi4_npu/Makefile b/src/test/phi4_npu/Makefile index 641f9c83a..39a6c026d 100644 --- a/src/test/phi4_npu/Makefile +++ b/src/test/phi4_npu/Makefile @@ -15,6 +15,7 @@ # ============================================================================= -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_phi4.cpp) SOURCES += $(wildcard ../../include/AutoModel/automodel.hpp) diff --git a/src/test/phi4_npu/test.cpp b/src/test/phi4_npu/test.cpp index e7e76d2ed..3503d6577 100644 --- a/src/test/phi4_npu/test.cpp +++ b/src/test/phi4_npu/test.cpp @@ -7,10 +7,19 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_phi4.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "utils/vm_args.hpp" #include "metrices.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("phi4", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; diff --git a/src/test/qwen2_npu/CMakeLists.txt b/src/test/qwen2_npu/CMakeLists.txt index 79fc82f60..a4d680a50 100644 --- a/src/test/qwen2_npu/CMakeLists.txt +++ b/src/test/qwen2_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen2.cpp" ) diff --git a/src/test/qwen2_npu/Makefile b/src/test/qwen2_npu/Makefile index 3e24221f6..916817617 100644 --- a/src/test/qwen2_npu/Makefile +++ b/src/test/qwen2_npu/Makefile @@ -15,6 +15,7 @@ # ============================================================================= -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_qwen2.cpp) SOURCES += $(wildcard ../../common/tokenizer/tokenizer.cpp) diff --git a/src/test/qwen2_npu/test.cpp b/src/test/qwen2_npu/test.cpp index 68f4b3e05..b637ca853 100644 --- a/src/test/qwen2_npu/test.cpp +++ b/src/test/qwen2_npu/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen2.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen2", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/qwen2vl_npu/CMakeLists.txt b/src/test/qwen2vl_npu/CMakeLists.txt index 5362163bc..03480a36b 100644 --- a/src/test/qwen2vl_npu/CMakeLists.txt +++ b/src/test/qwen2vl_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen2vl.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen2vl_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageproc.cpp" diff --git a/src/test/qwen2vl_npu/Makefile b/src/test/qwen2vl_npu/Makefile index 8dc49765f..506265561 100644 --- a/src/test/qwen2vl_npu/Makefile +++ b/src/test/qwen2vl_npu/Makefile @@ -17,6 +17,7 @@ -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_qwen2vl.cpp SOURCES += ../../common/AutoModel/modeling_qwen2vl_image.cpp diff --git a/src/test/qwen2vl_npu/test.cpp b/src/test/qwen2vl_npu/test.cpp index f0f600147..b661b2c9a 100644 --- a/src/test/qwen2vl_npu/test.cpp +++ b/src/test/qwen2vl_npu/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen2vl.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen2vl", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; diff --git a/src/test/qwen3_5_omni_npu/CMakeLists.txt b/src/test/qwen3_5_omni_npu/CMakeLists.txt index 23b6c92ac..f4d298bba 100644 --- a/src/test/qwen3_5_omni_npu/CMakeLists.txt +++ b/src/test/qwen3_5_omni_npu/CMakeLists.txt @@ -24,6 +24,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" ${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_5_omni.cpp ${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_5_omni_image.cpp ${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_5_omni_audio.cpp diff --git a/src/test/qwen3_5_omni_npu/Makefile b/src/test/qwen3_5_omni_npu/Makefile index 1453e2764..d7d911c5e 100644 --- a/src/test/qwen3_5_omni_npu/Makefile +++ b/src/test/qwen3_5_omni_npu/Makefile @@ -19,6 +19,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_qwen3_5_omni.cpp SOURCES += ../../common/AutoModel/modeling_qwen3_5_omni_image.cpp diff --git a/src/test/qwen3_5_omni_npu/test.cpp b/src/test/qwen3_5_omni_npu/test.cpp index a445d1022..321d26fb6 100644 --- a/src/test/qwen3_5_omni_npu/test.cpp +++ b/src/test/qwen3_5_omni_npu/test.cpp @@ -7,8 +7,16 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3_5_omni.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note automodel.cpp reaches engines through the backend registry, but +/// this model builds its engine itself: there is nothing to register. +namespace flm::backend { +void register_builtin_backends(BackendRegistry&) { +} +} // namespace flm::backend + xrt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/qwen3_5vl_npu/CMakeLists.txt b/src/test/qwen3_5vl_npu/CMakeLists.txt index 399d243ee..152f85725 100644 --- a/src/test/qwen3_5vl_npu/CMakeLists.txt +++ b/src/test/qwen3_5vl_npu/CMakeLists.txt @@ -20,6 +20,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_5vl.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_5vl_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageproc.cpp" diff --git a/src/test/qwen3_5vl_npu/Makefile b/src/test/qwen3_5vl_npu/Makefile index a5045fd2a..9d3795f30 100644 --- a/src/test/qwen3_5vl_npu/Makefile +++ b/src/test/qwen3_5vl_npu/Makefile @@ -17,6 +17,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_qwen3_5vl.cpp SOURCES += ../../common/AutoModel/modeling_qwen3_5vl_image.cpp diff --git a/src/test/qwen3_5vl_npu/test.cpp b/src/test/qwen3_5vl_npu/test.cpp index 011f05007..6d020394a 100644 --- a/src/test/qwen3_5vl_npu/test.cpp +++ b/src/test/qwen3_5vl_npu/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3_5vl.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen3.5", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; // Model-specific factory function for Qwen family and DeepSeek_r1_0528_8b diff --git a/src/test/qwen3_6_moe_npu/CMakeLists.txt b/src/test/qwen3_6_moe_npu/CMakeLists.txt index 3f747da5a..71ac4c099 100644 --- a/src/test/qwen3_6_moe_npu/CMakeLists.txt +++ b/src/test/qwen3_6_moe_npu/CMakeLists.txt @@ -20,6 +20,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_6_moe.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_6_moe_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageproc.cpp" diff --git a/src/test/qwen3_6_moe_npu/Makefile b/src/test/qwen3_6_moe_npu/Makefile index 1c50e0cf2..03e61cc8f 100644 --- a/src/test/qwen3_6_moe_npu/Makefile +++ b/src/test/qwen3_6_moe_npu/Makefile @@ -13,6 +13,7 @@ -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_qwen3_6_moe.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_qwen3_6_moe_image.cpp) diff --git a/src/test/qwen3_6_moe_npu/test.cpp b/src/test/qwen3_6_moe_npu/test.cpp index 17d961bef..8f31be5e0 100644 --- a/src/test/qwen3_6_moe_npu/test.cpp +++ b/src/test/qwen3_6_moe_npu/test.cpp @@ -7,9 +7,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3_6_moe.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" #include "utils/vm_args.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen3.6-moe", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/qwen3_8mtp_npu/CMakeLists.txt b/src/test/qwen3_8mtp_npu/CMakeLists.txt index e2927e9f7..462c98819 100644 --- a/src/test/qwen3_8mtp_npu/CMakeLists.txt +++ b/src/test/qwen3_8mtp_npu/CMakeLists.txt @@ -19,6 +19,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3_8mtp.cpp" ) diff --git a/src/test/qwen3_8mtp_npu/Makefile b/src/test/qwen3_8mtp_npu/Makefile index 7ac6fa856..cffe2624a 100644 --- a/src/test/qwen3_8mtp_npu/Makefile +++ b/src/test/qwen3_8mtp_npu/Makefile @@ -14,6 +14,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_qwen3_8mtp.cpp SOURCES += ../../common/AutoModel/modeling_qwen3_8mtp_image.cpp diff --git a/src/test/qwen3_8mtp_npu/test.cpp b/src/test/qwen3_8mtp_npu/test.cpp index 60b1b491e..6d42081d7 100644 --- a/src/test/qwen3_8mtp_npu/test.cpp +++ b/src/test/qwen3_8mtp_npu/test.cpp @@ -3,8 +3,17 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3_8mtp.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen3.8-mtp", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; int main(int argc, char* argv[]) { diff --git a/src/test/qwen3_npu/CMakeLists.txt b/src/test/qwen3_npu/CMakeLists.txt index c2d7d3269..b3209851d 100644 --- a/src/test/qwen3_npu/CMakeLists.txt +++ b/src/test/qwen3_npu/CMakeLists.txt @@ -11,6 +11,7 @@ add_npu_test( USE_TOKENIZER USE_SAMPLER SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3.cpp" ) diff --git a/src/test/qwen3_npu/Makefile b/src/test/qwen3_npu/Makefile index 39ab56c25..b7cf17dda 100644 --- a/src/test/qwen3_npu/Makefile +++ b/src/test/qwen3_npu/Makefile @@ -15,6 +15,7 @@ # ============================================================================= -include ../common.mk +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += $(wildcard ../../common/AutoModel/automodel.cpp) SOURCES += $(wildcard ../../common/AutoModel/modeling_qwen3.cpp) SOURCES += $(wildcard ../../common/tokenizer/tokenizer.cpp) diff --git a/src/test/qwen3_npu/test.cpp b/src/test/qwen3_npu/test.cpp index 9270abcc5..7a806c1d9 100644 --- a/src/test/qwen3_npu/test.cpp +++ b/src/test/qwen3_npu/test.cpp @@ -3,8 +3,20 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen3", kFlmBackendId, flm_factory()); + registry.register_backend("qwen3-it", kFlmBackendId, flm_factory()); + registry.register_backend("qwen3-tk", kFlmBackendId, flm_factory()); + registry.register_backend("deepseek-r1-0528", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; // Model-specific factory function for Qwen family and DeepSeek_r1_0528_8b diff --git a/src/test/qwen3vl_flash/CMakeLists.txt b/src/test/qwen3vl_flash/CMakeLists.txt index 82c8fe9a9..1e9bf87db 100644 --- a/src/test/qwen3vl_flash/CMakeLists.txt +++ b/src/test/qwen3vl_flash/CMakeLists.txt @@ -20,6 +20,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3vl.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3vl_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageproc.cpp" diff --git a/src/test/qwen3vl_flash/Makefile b/src/test/qwen3vl_flash/Makefile index faf9f7ebd..ad4dd4321 100644 --- a/src/test/qwen3vl_flash/Makefile +++ b/src/test/qwen3vl_flash/Makefile @@ -17,6 +17,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_qwen3vl.cpp SOURCES += ../../common/AutoModel/modeling_qwen3vl_image.cpp diff --git a/src/test/qwen3vl_flash/test.cpp b/src/test/qwen3vl_flash/test.cpp index d80fd8147..0c3bb5e1a 100644 --- a/src/test/qwen3vl_flash/test.cpp +++ b/src/test/qwen3vl_flash/test.cpp @@ -3,8 +3,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3vl.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen3vl", kFlmBackendId, flm_factory()); + registry.register_backend("qwen3vl-flash", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; // Model-specific factory function for Qwen family and DeepSeek_r1_0528_8b diff --git a/src/test/qwen3vl_npu/CMakeLists.txt b/src/test/qwen3vl_npu/CMakeLists.txt index 44bc954a4..023fb8c5f 100644 --- a/src/test/qwen3vl_npu/CMakeLists.txt +++ b/src/test/qwen3vl_npu/CMakeLists.txt @@ -20,6 +20,7 @@ add_npu_test( USE_SAMPLER USE_AVX512 SOURCES + "${CMAKE_SOURCE_DIR}/../../common/AutoModel/model_backend.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3vl.cpp" "${CMAKE_SOURCE_DIR}/../../common/AutoModel/modeling_qwen3vl_image.cpp" "${CMAKE_SOURCE_DIR}/../../common/image_process_utils/imageproc.cpp" diff --git a/src/test/qwen3vl_npu/Makefile b/src/test/qwen3vl_npu/Makefile index 4603dc369..cf8fb8091 100644 --- a/src/test/qwen3vl_npu/Makefile +++ b/src/test/qwen3vl_npu/Makefile @@ -17,6 +17,7 @@ SOURCES += test.cpp +SOURCES += ../../common/AutoModel/model_backend.cpp SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/AutoModel/modeling_qwen3vl.cpp SOURCES += ../../common/AutoModel/modeling_qwen3vl_image.cpp diff --git a/src/test/qwen3vl_npu/test.cpp b/src/test/qwen3vl_npu/test.cpp index 9f62e7fc9..1b6b282a8 100644 --- a/src/test/qwen3vl_npu/test.cpp +++ b/src/test/qwen3vl_npu/test.cpp @@ -3,8 +3,18 @@ #include "utils/utils.hpp" #include "utils/vm_args.hpp" #include "AutoModel/modeling_qwen3vl.hpp" +#include "AutoModel/flm_backend.hpp" #include "model_list.hpp" +/// \note builtin_backends.cpp names every engine and so links every prebuilt +/// library; this harness registers just the ones it drives. +namespace flm::backend { +void register_builtin_backends(BackendRegistry& registry) { + registry.register_backend("qwen3vl", kFlmBackendId, flm_factory()); + registry.register_backend("qwen3vl-flash", kFlmBackendId, flm_factory()); +} +} // namespace flm::backend + flm_rt::device npu_device_global; // Model-specific factory function for Qwen family and DeepSeek_r1_0528_8b diff --git a/src/test/whisper_npu/Makefile b/src/test/whisper_npu/Makefile index 442ce414c..3c2868732 100644 --- a/src/test/whisper_npu/Makefile +++ b/src/test/whisper_npu/Makefile @@ -17,7 +17,6 @@ -include ../common.mk SOURCES += test.cpp -SOURCES += ../../common/AutoModel/automodel.cpp SOURCES += ../../common/modules/sampler.cpp SOURCES += ../../common/tokenizer/tokenizer.cpp SOURCES += ../../common/whisper/modeling_whisper_audio.cpp