Fix interpreter not update memory size after call native func (#563)

The native function might call wasm function exported, in which the memory.grow opcode might be executed, and interpreter should update memory size after that, or load/store opcodes may run failed with "out of bounds memory access" exception thrown.

Update tensorflow sample patch, allow tensorflow wasm app to grow memory so as to run more models. And fix some compile issues of littlevgl zephyr sample for latest zephyr source code.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-03-10 15:07:16 +08:00
committed by GitHub
parent a1568825e8
commit e9e75a6b09
9 changed files with 123 additions and 85 deletions

View File

@ -1,5 +1,5 @@
diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile
index c7ddff58440..ed69c452b67 100644
index c7ddff58440..ebfebaead35 100644
--- a/tensorflow/lite/tools/make/Makefile
+++ b/tensorflow/lite/tools/make/Makefile
@@ -48,11 +48,7 @@ INCLUDES += -I/usr/local/include
@ -15,7 +15,7 @@ index c7ddff58440..ed69c452b67 100644
-ldl
# There are no rules for compiling objects for the host system (since we don't
@@ -84,14 +80,21 @@ endif # ifeq ($(HOST_ARCH),$(TARGET_ARCH))
@@ -84,14 +80,24 @@ endif # ifeq ($(HOST_ARCH),$(TARGET_ARCH))
endif # ifeq ($(HOST_OS),$(TARGET))
endif
@ -23,6 +23,9 @@ index c7ddff58440..ed69c452b67 100644
+CXXFLAGS+=-msimd128
+
+LIBFLAGS += -s TOTAL_STACK=1048576 \
+ -s INITIAL_MEMORY=16777216 \
+ -s MAXIMUM_MEMORY=167772160 \
+ -s ALLOW_MEMORY_GROWTH=1 \
+ -Wl,--export=__data_end -Wl,--export=__heap_base \
+ -s ERROR_ON_UNDEFINED_SYMBOLS=0
+
@ -39,7 +42,7 @@ index c7ddff58440..ed69c452b67 100644
# A small example program that shows how to link against the library.
MINIMAL_SRCS := \
@@ -277,12 +280,16 @@ LIB_PATH := $(LIBDIR)$(LIB_NAME)
@@ -277,12 +283,16 @@ LIB_PATH := $(LIBDIR)$(LIB_NAME)
BENCHMARK_LIB := $(LIBDIR)$(BENCHMARK_LIB_NAME)
BENCHMARK_BINARY := $(BINDIR)$(BENCHMARK_BINARY_NAME)
BENCHMARK_PERF_OPTIONS_BINARY := $(BINDIR)$(BENCHMARK_PERF_OPTIONS_BINARY_NAME)