Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma4_12b/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma4_12b/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/test/gemma4_12b/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<gemma4_12b_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

int main(int argc, char* argv[]) {
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma4e_flash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma4e_flash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/test/gemma4e_flash/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<gemma4e_npu>());
registry.register_backend("gemma4e-flash", kFlmBackendId, flm_factory<gemma4e_flash>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

int main(int argc, char* argv[]) {
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma4e_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma4e_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/test/gemma4e_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<gemma4e_npu>());
registry.register_backend("gemma4e-flash", kFlmBackendId, flm_factory<gemma4e_flash>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

int main(int argc, char* argv[]) {
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/test/gemma_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<gemma_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

int main(int argc, char* argv[]) {
Expand Down
1 change: 1 addition & 0 deletions src/test/gemma_text_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
1 change: 1 addition & 0 deletions src/test/gemma_text_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/test/gemma_text_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<gemma_text_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;
// Model-specific factory function for Gemma3 Text family only
inline std::pair<std::string, std::unique_ptr<AutoModel>> get_gemma_text_model(const std::string& model_tag, flm_rt::device* npu_device_inst) {
Expand Down
1 change: 1 addition & 0 deletions src/test/gpt_oss_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
1 change: 1 addition & 0 deletions src/test/gpt_oss_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/test/gpt_oss_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<gpt_oss_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;


Expand Down
1 change: 1 addition & 0 deletions src/test/hunyuan_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
1 change: 1 addition & 0 deletions src/test/hunyuan_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/test/hunyuan_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<hunyuan_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

/// \brief the fixed translator instruction, installed as the system prompt
Expand Down
1 change: 1 addition & 0 deletions src/test/lfm2_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
1 change: 1 addition & 0 deletions src/test/lfm2_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/test/lfm2_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<lfm2_npu>());
registry.register_backend("lfm2.5-tk", kFlmBackendId, flm_factory<lfm2_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

// Model-specific factory function for Llama family and DeepSeek_r1_8b
Expand Down
1 change: 1 addition & 0 deletions src/test/llama_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
1 change: 1 addition & 0 deletions src/test/llama_npu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/test/llama_npu/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<llama_npu>());
registry.register_backend("deepseek-r1", kFlmBackendId, flm_factory<llama_npu>());
}
} // namespace flm::backend

flm_rt::device npu_device_global;

int main(int argc, char* argv[]) {
Expand Down
37 changes: 37 additions & 0 deletions src/test/minicpm_v_4_7_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<$<CXX_COMPILER_ID:MSVC>:/openmp>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-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
Expand Down
1 change: 1 addition & 0 deletions src/test/nanbeige_npu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
Loading
Loading