sw:vec-iree: Add LOG_x support for QEMU Linux userspace emulation Use fprintf as the stub for springbok LOG_x. QEMU Linux userspace emulation would have the same print out as springbok simulation ``` $ out/host/qemu/qemu-riscv32 -cpu rv32,x-v=true,vlen=512,elen=32,vext_spec=v1.0 out/springbok_iree/samples/quant_model_embedding/daredevil_embedded_sync Output #0 data length: 527 [[ iree_hal_allocator_t memory statistics ]] HOST_LOCAL: 0B peak / 0B allocated / 0B freed / 0B live DEVICE_LOCAL: 1445663B peak / 1445663B allocated / 1445663B freed / 0B live daredevil_quant finished successfully ``` Change-Id: Iced7b463537a491133add33f838c4c29a78ddfca
diff --git a/CMakeLists.txt b/CMakeLists.txt index e82e6aa..3caaac7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -52,9 +52,10 @@ # Springbok BSP-related setting if(${BUILD_WITH_SPRINGBOK}) include(riscv_springbok) -else() - # Add the LOG_X header file for build compatibility. include_directories($ENV{ROOTDIR}/sw/vec/springbok/include) +else() + # Add the LOG_X springbok macros with fprintf. + include_directories(native_log_include) endif() # Build IREE runtime libraries.
diff --git a/native_log_include/springbok.h b/native_log_include/springbok.h new file mode 100644 index 0000000..d56c2f4 --- /dev/null +++ b/native_log_include/springbok.h
@@ -0,0 +1,13 @@ +// Stub out the LOG implmentations with fprintf +#ifndef SPRINGBOK_H +#define SPRINGBOK_H + +#include <stdio.h> + +#define LOG_NOISY(msg,args...) fprintf(stdout, msg"\n", ##args) +#define LOG_DEBUG(msg,args...) fprintf(stdout, msg"\n", ##args) +#define LOG_INFO(msg,args...) fprintf(stdout, msg"\n", ##args) +#define LOG_WARN(msg,args...) fprintf(stdout, msg"\n", ##args) +#define LOG_ERROR(msg, args...) fprintf(stderr, msg"\n", ##args) + +#endif // SPRINGBOK_H
diff --git a/samples/util/CMakeLists.txt b/samples/util/CMakeLists.txt index b004f46..b700268 100644 --- a/samples/util/CMakeLists.txt +++ b/samples/util/CMakeLists.txt
@@ -1,5 +1,3 @@ -include_directories($ENV{ROOTDIR}/sw/vec/springbok/include) - iree_cc_library( NAME util