Skip to content

Commit 12ef1e0

Browse files
Added testing and performance benchmarking support for the FP kernels (#2)
* added fp kernels testing and performance benchmarking files and introduced changes in the cmake files to build these test files * fixed signature mismatch for the validate fns * fixed signature mismatch for the validate fns --------- Co-authored-by: Rehan Qasim <rehanbhatti0317@gmail.com>
1 parent 96a181a commit 12ef1e0

4 files changed

Lines changed: 866 additions & 0 deletions

File tree

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,9 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
663663
target_sources(${GGML_CPU_NAME} PRIVATE ${GGML_CPU_SOURCES})
664664
target_compile_options(${GGML_CPU_NAME} PRIVATE ${ARCH_FLAGS})
665665
target_compile_definitions(${GGML_CPU_NAME} PRIVATE ${ARCH_DEFINITIONS})
666+
#Exporting the arch flags and options to access them in tests/CMakelists.txt
667+
set(GLOBAL_GGML_CPU_ARCH_FLAGS "${ARCH_FLAGS}" CACHE INTERNAL "Compiler flags for the default GGML CPU backend." FORCE)
668+
set(GLOBAL_GGML_CPU_ARCH_DEFINITIONS "${ARCH_DEFINITIONS}" CACHE INTERNAL "Compiler definitions for the default GGML CPU backend." FORCE)
666669

667670
if (EMSCRIPTEN)
668671
set_target_properties(${GGML_CPU_NAME} PROPERTIES COMPILE_FLAGS "-msimd128")

tests/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,34 @@ if (NOT GGML_BACKEND_DL)
228228
llama_build_and_test(test-quantize-fns.cpp)
229229
llama_build_and_test(test-quantize-perf.cpp)
230230
llama_build_and_test(test-rope.cpp)
231+
llama_build_and_test(test-float-fns.cpp)
232+
llama_build_and_test(test-float-perf.cpp)
233+
target_include_directories(
234+
test-float-fns PRIVATE
235+
${CMAKE_SOURCE_DIR}/ggml/src/ggml-cpu
236+
${CMAKE_SOURCE_DIR}/ggml/src
237+
)
238+
target_include_directories(
239+
test-float-perf PRIVATE
240+
${CMAKE_SOURCE_DIR}/ggml/src/ggml-cpu
241+
${CMAKE_SOURCE_DIR}/ggml/src
242+
)
243+
target_compile_options(
244+
test-float-perf PRIVATE
245+
${GLOBAL_GGML_CPU_ARCH_FLAGS}
246+
)
247+
target_compile_definitions(
248+
test-float-perf PRIVATE
249+
${GLOBAL_GGML_CPU_ARCH_DEFINITIONS}
250+
)
251+
target_compile_options(
252+
test-float-fns PRIVATE
253+
${GLOBAL_GGML_CPU_ARCH_FLAGS}
254+
)
255+
target_compile_definitions(
256+
test-float-fns PRIVATE
257+
${GLOBAL_GGML_CPU_ARCH_DEFINITIONS}
258+
)
231259
endif()
232260

233261
# libmtmd

0 commit comments

Comments
 (0)