tf_lite.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile
  2. index c7ddff58440..ed69c452b67 100644
  3. --- a/tensorflow/lite/tools/make/Makefile
  4. +++ b/tensorflow/lite/tools/make/Makefile
  5. @@ -48,11 +48,7 @@ INCLUDES += -I/usr/local/include
  6. # These are the default libraries needed, but they can be added to or
  7. # overridden by the platform-specific settings in target makefiles.
  8. -LIBS := \
  9. --lstdc++ \
  10. --lpthread \
  11. --lm \
  12. --lz \
  13. +LIBS := -lm \
  14. -ldl
  15. # There are no rules for compiling objects for the host system (since we don't
  16. @@ -84,14 +80,21 @@ endif # ifeq ($(HOST_ARCH),$(TARGET_ARCH))
  17. endif # ifeq ($(HOST_OS),$(TARGET))
  18. endif
  19. +CFLAGS+=-msimd128
  20. +CXXFLAGS+=-msimd128
  21. +
  22. +LIBFLAGS += -s TOTAL_STACK=1048576 \
  23. + -Wl,--export=__data_end -Wl,--export=__heap_base \
  24. + -s ERROR_ON_UNDEFINED_SYMBOLS=0
  25. +
  26. # This library is the main target for this makefile. It will contain a minimal
  27. # runtime that can be linked in to other programs.
  28. LIB_NAME := libtensorflow-lite.a
  29. # Benchmark static library and binary
  30. BENCHMARK_LIB_NAME := benchmark-lib.a
  31. -BENCHMARK_BINARY_NAME := benchmark_model
  32. -BENCHMARK_PERF_OPTIONS_BINARY_NAME := benchmark_model_performance_options
  33. +BENCHMARK_BINARY_NAME := benchmark_model.wasm
  34. +BENCHMARK_PERF_OPTIONS_BINARY_NAME := benchmark_model_performance_options.wasm
  35. # A small example program that shows how to link against the library.
  36. MINIMAL_SRCS := \
  37. @@ -277,12 +280,16 @@ LIB_PATH := $(LIBDIR)$(LIB_NAME)
  38. BENCHMARK_LIB := $(LIBDIR)$(BENCHMARK_LIB_NAME)
  39. BENCHMARK_BINARY := $(BINDIR)$(BENCHMARK_BINARY_NAME)
  40. BENCHMARK_PERF_OPTIONS_BINARY := $(BINDIR)$(BENCHMARK_PERF_OPTIONS_BINARY_NAME)
  41. -MINIMAL_BINARY := $(BINDIR)minimal
  42. +MINIMAL_BINARY := $(BINDIR)minimal.wasm
  43. LABEL_IMAGE_BINARY := $(BINDIR)label_image
  44. -CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
  45. -CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
  46. -AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
  47. +# CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
  48. +# CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
  49. +# AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
  50. +
  51. +CXX := em++
  52. +CC := emcc
  53. +AR := emar
  54. MINIMAL_OBJS := $(addprefix $(OBJDIR), \
  55. $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(MINIMAL_SRCS))))
  56. diff --git a/tensorflow/lite/tools/make/targets/linux_makefile.inc b/tensorflow/lite/tools/make/targets/linux_makefile.inc
  57. index 222cef9e5ff..eea89a38f01 100644
  58. --- a/tensorflow/lite/tools/make/targets/linux_makefile.inc
  59. +++ b/tensorflow/lite/tools/make/targets/linux_makefile.inc
  60. @@ -2,12 +2,10 @@
  61. ifeq ($(TARGET), linux)
  62. CXXFLAGS += \
  63. -fPIC \
  64. - -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
  65. - -pthread
  66. + -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
  67. CFLAGS += \
  68. -fPIC \
  69. - -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
  70. - -pthread
  71. + -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
  72. # TODO(petewarden): In the future we may want to add architecture-specific
  73. # flags like -msse4.2
  74. LIBS += -ldl