Add support for MicroKernel for VMVX regular HAL Enable microkernel for VMVX regular (non-inline) HAL Also add the microkernel target for microbenchmark. Change-Id: Idf11bf22e6898ccf9b4b6623f9ca5a92515644d5
diff --git a/cmake/springbok_vmvx_module.cmake b/cmake/springbok_vmvx_module.cmake index 479fad6..e63b583 100644 --- a/cmake/springbok_vmvx_module.cmake +++ b/cmake/springbok_vmvx_module.cmake
@@ -75,6 +75,7 @@ list(APPEND _COMPILER_ARGS "--iree-hal-target-backends=vmvx-inline") else() list(APPEND _COMPILER_ARGS "--iree-hal-target-backends=vmvx") + list(APPEND _COMPILER_ARGS "--iree-vmvx-enable-microkernels") endif() if(_RULE_EMITC)
diff --git a/samples/microbenchmarks/CMakeLists.txt b/samples/microbenchmarks/CMakeLists.txt index ee7135a..68ff7d0 100644 --- a/samples/microbenchmarks/CMakeLists.txt +++ b/samples/microbenchmarks/CMakeLists.txt
@@ -17,6 +17,34 @@ PUBLIC ) +springbok_vmvx_module( + NAME + conv1x1_test_vmvx + SRC + "conv1x1_test.mlir" + FLAGS + "-iree-input-type=tosa" + "-riscv-v-vector-bits-min=512" + "-riscv-v-fixed-length-vector-lmul-max=8" + EMITC + VMVX + PUBLIC +) + +iree_cc_binary( + NAME + conv1x1_test_emitc_vmvx + SRCS + "conv1x1_test.c" + DEPS + ::conv1x1_test_vmvx_emitc + model_util::util_vmvx + LINKOPTS + "LINKER:--defsym=__stack_size__=64k" + COPTS + "-DBUILD_VMVX" +) + springbok_test( NAME conv1x1_test_emitc_static @@ -28,8 +56,6 @@ model_util::util_static LINKOPTS "LINKER:--defsym=__stack_size__=64k" - COPTS - "-DBUILD_EMITC_STATIC" TESTFILES "conv1x1_test.run" )
diff --git a/samples/microbenchmarks/conv1x1_test.c b/samples/microbenchmarks/conv1x1_test.c index 8e88743..1bd5bfa 100644 --- a/samples/microbenchmarks/conv1x1_test.c +++ b/samples/microbenchmarks/conv1x1_test.c
@@ -3,8 +3,12 @@ #include "iree/base/api.h" #include "iree/hal/api.h" #include "model_util/util.h" +#if defined(BUILD_VMVX) +#include "samples/microbenchmarks/conv1x1_test_vmvx_emitc.h" +#else #include "samples/microbenchmarks/conv1x1_test_c.h" #include "samples/microbenchmarks/conv1x1_test_emitc.h" +#endif const MlModel kModel = { .num_input = 1, @@ -25,9 +29,11 @@ return module_create(instance, iree_allocator_system(), module); } +#if !defined(BUILD_VMVX) iree_hal_executable_library_query_fn_t library_query(void) { return conv1x1_test_linked_llvm_cpu_library_query; } +#endif iree_status_t load_input_data(const MlModel *model, void **buffer, iree_const_byte_span_t **byte_span) {
diff --git a/samples/microbenchmarks/conv1x1_test.run b/samples/microbenchmarks/conv1x1_test.run index 2aa9a92..cc653cf 100644 --- a/samples/microbenchmarks/conv1x1_test.run +++ b/samples/microbenchmarks/conv1x1_test.run
@@ -1 +1,2 @@ // RUN: ${TEST_RUNNER_CMD} %S/conv1x1_test_emitc_static +// RUN: ${TEST_RUNNER_CMD} %S/conv1x1_test_emitc_vmvx