Merge pull request #895 from kwagyeman/kwabena/cmsis_nn

Update TensorFlow to support cmsis-nn - 4x speed boost
This commit is contained in:
Ibrahim Abd Elkader 2020-09-12 21:51:43 +02:00 committed by GitHub
commit 3c8c1bcf78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 25 additions and 25 deletions

View File

@ -1,5 +1,5 @@
You must link this library to your application with arm-none-eabi-gcc and have implemented putchar().
C Compile Flags: -D __FPU_PRESENT=1 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_DISABLE_X86_NEON -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Wextra -Wvla -Wno-format -Wno-missing-field-initializers -Wno-parentheses -Wno-return-type -Wno-sign-compare -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-write-strings -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fno-builtin -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mfloat-abi=hard -mlittle-endian -mthumb -mno-unaligned-access -nostdlib -Wno-pointer-sign -std=c11 -DARM_CMSIS_NN_M4 -DARM_MATH_CM4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mtune=cortex-m4
C Compile Flags: -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Werror -Warray-bounds -Wextra -Wvla -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fshort-enums -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mabi=aapcs-linux -mfloat-abi=hard -mthumb -nostartfiles -nostdlib -std=c11 -DARM_MATH_CM4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mtune=cortex-m4
CXX Compile Flags: -D __FPU_PRESENT=1 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_DISABLE_X86_NEON -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Wextra -Wvla -Wno-format -Wno-missing-field-initializers -Wno-parentheses -Wno-return-type -Wno-sign-compare -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-write-strings -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fno-builtin -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mfloat-abi=hard -mlittle-endian -mthumb -mno-unaligned-access -nostdlib -std=c++11 -std=gnu++11 -fno-rtti -fpermissive -DARM_CMSIS_NN_M4 -DARM_MATH_CM4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mtune=cortex-m4
CXX Compile Flags: -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Werror -Warray-bounds -Wextra -Wvla -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fshort-enums -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mabi=aapcs-linux -mfloat-abi=hard -mthumb -nostartfiles -nostdlib -std=c++11 -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -DARM_MATH_CM4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mtune=cortex-m4

Binary file not shown.

View File

@ -1,5 +1,5 @@
You must link this library to your application with arm-none-eabi-gcc and have implemented putchar().
C Compile Flags: -D __FPU_PRESENT=1 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_DISABLE_X86_NEON -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Wextra -Wvla -Wno-format -Wno-missing-field-initializers -Wno-parentheses -Wno-return-type -Wno-sign-compare -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-write-strings -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fno-builtin -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mfloat-abi=hard -mlittle-endian -mthumb -mno-unaligned-access -nostdlib -Wno-pointer-sign -std=c11 -DARM_CMSIS_NN_M7 -DARM_MATH_CM7 -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mtune=cortex-m7
C Compile Flags: -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Werror -Warray-bounds -Wextra -Wvla -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fshort-enums -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mabi=aapcs-linux -mfloat-abi=hard -mthumb -nostartfiles -nostdlib -std=c11 -DARM_MATH_CM7 -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mtune=cortex-m7
CXX Compile Flags: -D __FPU_PRESENT=1 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_DISABLE_X86_NEON -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Wextra -Wvla -Wno-format -Wno-missing-field-initializers -Wno-parentheses -Wno-return-type -Wno-sign-compare -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-write-strings -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fno-builtin -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mfloat-abi=hard -mlittle-endian -mthumb -mno-unaligned-access -nostdlib -std=c++11 -std=gnu++11 -fno-rtti -fpermissive -DARM_CMSIS_NN_M7 -DARM_MATH_CM7 -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mtune=cortex-m7
CXX Compile Flags: -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -DNDEBUG -DTF_LITE_MCU_DEBUG_LOG -DTF_LITE_STATIC_MEMORY -MMD -O3 -Wall -Werror -Warray-bounds -Wextra -Wvla -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-type-limits -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -fdata-sections -ffunction-sections -fmessage-length=0 -fomit-frame-pointer -funsigned-char -fshort-enums -fno-delete-null-pointer-checks -fno-exceptions -fno-unwind-tables -mabi=aapcs-linux -mfloat-abi=hard -mthumb -nostartfiles -nostdlib -std=c++11 -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -DARM_MATH_CM7 -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mtune=cortex-m7

Binary file not shown.

View File

@ -57,10 +57,10 @@
#define IMLIB_ENABLE_BILATERAL
// Enable cartoon()
#define IMLIB_ENABLE_CARTOON
// #define IMLIB_ENABLE_CARTOON
// Enable remove_shadows()
#define IMLIB_ENABLE_REMOVE_SHADOWS
// #define IMLIB_ENABLE_REMOVE_SHADOWS
// Enable linpolar()
#define IMLIB_ENABLE_LINPOLAR
@ -69,10 +69,10 @@
#define IMLIB_ENABLE_LOGPOLAR
// Enable chrominvar()
#define IMLIB_ENABLE_CHROMINVAR
// #define IMLIB_ENABLE_CHROMINVAR
// Enable illuminvar()
#define IMLIB_ENABLE_ILLUMINVAR
// #define IMLIB_ENABLE_ILLUMINVAR
// Enable invariant table
//#define IMLIB_ENABLE_INVARIANT_TABLE

View File

@ -91,7 +91,7 @@
#define OMV_FB_SIZE (300K) // FB memory: header + VGA/GS image
#define OMV_FB_ALLOC_SIZE (84K) // minimum fb alloc size
#define OMV_STACK_SIZE (16K)
#define OMV_HEAP_SIZE (58K)
#define OMV_HEAP_SIZE (56K)
#define OMV_LINE_BUF_SIZE (3 * 1024) // Image line buffer round(640 * 2BPP * 2 buffers).
#define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data

View File

@ -57,10 +57,10 @@
#define IMLIB_ENABLE_BILATERAL
// Enable cartoon()
#define IMLIB_ENABLE_CARTOON
// #define IMLIB_ENABLE_CARTOON
// Enable remove_shadows()
#define IMLIB_ENABLE_REMOVE_SHADOWS
// #define IMLIB_ENABLE_REMOVE_SHADOWS
// Enable linpolar()
#define IMLIB_ENABLE_LINPOLAR
@ -69,10 +69,10 @@
#define IMLIB_ENABLE_LOGPOLAR
// Enable chrominvar()
#define IMLIB_ENABLE_CHROMINVAR
// #define IMLIB_ENABLE_CHROMINVAR
// Enable illuminvar()
#define IMLIB_ENABLE_ILLUMINVAR
// #define IMLIB_ENABLE_ILLUMINVAR
// Enable invariant table
//#define IMLIB_ENABLE_INVARIANT_TABLE

View File

@ -124,7 +124,7 @@
#define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image
#define OMV_FB_ALLOC_SIZE (96K) // minimum fb alloc size
#define OMV_STACK_SIZE (64K)
#define OMV_HEAP_SIZE (246K)
#define OMV_HEAP_SIZE (244K)
#define OMV_LINE_BUF_SIZE (3 * 1024) // Image line buffer round(640 * 2BPP * 2 buffers).
#define OMV_MSC_BUF_SIZE (12K) // USB MSC bot data

View File

@ -57,10 +57,10 @@
#define IMLIB_ENABLE_BILATERAL
// Enable cartoon()
#define IMLIB_ENABLE_CARTOON
// #define IMLIB_ENABLE_CARTOON
// Enable remove_shadows()
#define IMLIB_ENABLE_REMOVE_SHADOWS
// #define IMLIB_ENABLE_REMOVE_SHADOWS
// Enable linpolar()
#define IMLIB_ENABLE_LINPOLAR
@ -69,10 +69,10 @@
#define IMLIB_ENABLE_LOGPOLAR
// Enable chrominvar()
#define IMLIB_ENABLE_CHROMINVAR
// #define IMLIB_ENABLE_CHROMINVAR
// Enable illuminvar()
#define IMLIB_ENABLE_ILLUMINVAR
// #define IMLIB_ENABLE_ILLUMINVAR
// Enable invariant table
//#define IMLIB_ENABLE_INVARIANT_TABLE

View File

@ -131,7 +131,7 @@
#define OMV_FB_SIZE (20M) // FB memory: header + VGA/GS image
#define OMV_FB_ALLOC_SIZE (11M) // minimum fb alloc size
#define OMV_STACK_SIZE (64K)
#define OMV_HEAP_SIZE (246K)
#define OMV_HEAP_SIZE (244K)
#define OMV_SDRAM_SIZE (32 * 1024 * 1024) // This needs to be here for UVC firmware.
#define OMV_SDRAM_TEST (0)

View File

@ -57,10 +57,10 @@
#define IMLIB_ENABLE_BILATERAL
// Enable cartoon()
#define IMLIB_ENABLE_CARTOON
// #define IMLIB_ENABLE_CARTOON
// Enable remove_shadows()
#define IMLIB_ENABLE_REMOVE_SHADOWS
// #define IMLIB_ENABLE_REMOVE_SHADOWS
// Enable linpolar()
#define IMLIB_ENABLE_LINPOLAR
@ -69,10 +69,10 @@
#define IMLIB_ENABLE_LOGPOLAR
// Enable chrominvar()
#define IMLIB_ENABLE_CHROMINVAR
// #define IMLIB_ENABLE_CHROMINVAR
// Enable illuminvar()
#define IMLIB_ENABLE_ILLUMINVAR
// #define IMLIB_ENABLE_ILLUMINVAR
// Enable invariant table
//#define IMLIB_ENABLE_INVARIANT_TABLE

View File

@ -128,7 +128,7 @@
#define OMV_FB_SIZE (4M) // FB memory: header + VGA/GS image
#define OMV_FB_ALLOC_SIZE (3M) // minimum fb alloc size
#define OMV_STACK_SIZE (15K)
#define OMV_HEAP_SIZE (226K)
#define OMV_HEAP_SIZE (224K)
#define OMV_SDRAM_SIZE (8 * 1024 * 1024) // This needs to be here for UVC firmware.
#define OMV_SDRAM_TEST (0)

View File

@ -149,7 +149,7 @@ STATIC mp_obj_t int_py_tf_load(mp_obj_t path_obj, bool alloc_mode, bool helper_m
file_read_open(&fp, path);
tf_model->model_data_len = f_size(&fp);
tf_model->model_data = alloc_mode
? fb_alloc(tf_model->model_data_len, FB_ALLOC_NO_HINT)
? fb_alloc(tf_model->model_data_len, FB_ALLOC_PREFER_SIZE)
: xalloc(tf_model->model_data_len);
read_data(&fp, tf_model->model_data, tf_model->model_data_len);
file_close(&fp);