Skip to content

Commit 74e1360

Browse files
author
Robert Muchsel
authored
Move backend state into module; simple greedy kernel memory allocator; unload/verify optimization; README updates and other improvements (#135)
* Move backend state into module * Add simple greedy kernel memory allocator * Allow MAXIM_PATH to be relative * Change --log to on by default, add --no-log * Add --no-unload * README updates * Clear SLEEPDEEP before entering CNN loop * Apply --no-wfi to ARM wrapper code * Warn if KAT generates all zeros anywhere in the network * Warn when specifying unneeded 'flatten' * Print error when activating a passthrough layer * Collect and display per-layer statistics * Streaming improvements * Optimize cnn_unload() * Optimize check_output() * Add --no-kat * Add --sample-numpy-filename * Check that processors are ordered correctly in 'in_sequences' for cat, and are identical for eltwise * Round non-quantized checkpoints in backwards-compatible manner
1 parent 50dd782 commit 74e1360

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5188
-4691
lines changed

README.md

Lines changed: 207 additions & 247 deletions
Large diffs are not rendered by default.

README.pdf

37.7 KB
Binary file not shown.

assets/embedded-ai84/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif
5858
ifeq "$(MAXIM_PATH)" ""
5959
LIBS_DIR=../../../Libraries
6060
else
61-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
61+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
6262
endif
6363
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6464

assets/embedded-ai85/templateMakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif
5858
ifeq "$(MAXIM_PATH)" ""
5959
LIBS_DIR=../../../../Libraries
6060
else
61-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
61+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
6262
endif
6363
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6464

assets/embedded-ai87/templateMakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif
5858
ifeq "$(MAXIM_PATH)" ""
5959
LIBS_DIR=../../../../Libraries
6060
else
61-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
61+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
6262
endif
6363
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6464

assets/embedded-riscv-ai85/templateMakefile.ARM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endif
5757
ifeq "$(MAXIM_PATH)" ""
5858
LIBS_DIR=../../../../Libraries
5959
else
60-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
60+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
6161
endif
6262
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6363

assets/embedded-riscv-ai85/templateMakefile.RISCV

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export RISCV_CORE
6060
ifeq "$(MAXIM_PATH)" ""
6161
LIBS_DIR=../../../../Libraries
6262
else
63-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
63+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
6464
endif
6565
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6666

assets/embedded-riscv-ai87/templateMakefile.ARM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endif
5757
ifeq "$(MAXIM_PATH)" ""
5858
LIBS_DIR=../../../../Libraries
5959
else
60-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
60+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
6161
endif
6262
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6363

assets/embedded-riscv-ai87/templateMakefile.RISCV

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export RISCV_CORE
6060
ifeq "$(MAXIM_PATH)" ""
6161
LIBS_DIR=../../../../Libraries
6262
else
63-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
63+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Libraries)
6464
endif
6565
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
6666

assets/rtlsim-ai85/Makefile.ARM_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $(info Info: -------------------------------------------------------------)
6666
ifeq "$(MAXIM_PATH)" ""
6767
LIBS_DIR=$(REF_ROOT)/support/cmsis/Libraries
6868
else
69-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
69+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7070
endif
7171
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7272

assets/rtlsim-ai87/Makefile.ARM_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $(info Info: -------------------------------------------------------------)
6868
ifeq "$(MAXIM_PATH)" ""
6969
LIBS_DIR=$(PROJECT_ROOT)/support/cmsis/Libraries
7070
else
71-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
71+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7272
endif
7373
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7474
export CMSIS_ROOT

assets/rtlsim-riscv-ai85/Makefile.RISCV_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $(info Info: -------------------------------------------------------------)
6666
ifeq "$(MAXIM_PATH)" ""
6767
LIBS_DIR=$(REF_ROOT)/support/cmsis/Libraries
6868
else
69-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
69+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7070
endif
7171
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7272

assets/rtlsim-riscv-ai87/Makefile.RISCV_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $(info Info: -------------------------------------------------------------)
6868
ifeq "$(MAXIM_PATH)" ""
6969
LIBS_DIR=$(PROJECT_ROOT)/support/cmsis/Libraries
7070
else
71-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
71+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7272
endif
7373
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7474
export CMSIS_ROOT

assets/rtlsim-riscv-cache-ai85/Makefile.RISCV_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $(info Info: -------------------------------------------------------------)
6666
ifeq "$(MAXIM_PATH)" ""
6767
LIBS_DIR=$(REF_ROOT)/support/cmsis/Libraries
6868
else
69-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
69+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7070
endif
7171
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7272

assets/rtlsim-riscv-cache-ai87/Makefile.RISCV_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $(info Info: -------------------------------------------------------------)
6868
ifeq "$(MAXIM_PATH)" ""
6969
LIBS_DIR=$(PROJECT_ROOT)/support/cmsis/Libraries
7070
else
71-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
71+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7272
endif
7373
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7474
export CMSIS_ROOT

assets/rtlsim-riscv-flash-ai85/Makefile.RISCV_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $(info Info: -------------------------------------------------------------)
6666
ifeq "$(MAXIM_PATH)" ""
6767
LIBS_DIR=$(REF_ROOT)/support/cmsis/Libraries
6868
else
69-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
69+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7070
endif
7171
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7272

assets/rtlsim-riscv-flash-ai87/Makefile.RISCV_PROG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $(info Info: -------------------------------------------------------------)
6868
ifeq "$(MAXIM_PATH)" ""
6969
LIBS_DIR=$(PROJECT_ROOT)/support/cmsis/Libraries
7070
else
71-
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
71+
LIBS_DIR=$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
7272
endif
7373
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
7474
export CMSIS_ROOT

gen-demos-max78000.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/bin/sh
22
DEVICE="MAX78000"
33
TARGET="sdk/Examples/$DEVICE/CNN"
4-
COMMON_ARGS="--device $DEVICE --compact-data --mexpress --timer 0 --display-checkpoint"
4+
COMMON_ARGS="--device $DEVICE --compact-data --mexpress --timer 0 --display-checkpoint --verbose"
55

6-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix mnist --checkpoint-file trained/ai85-mnist-qat8-q.pth.tar --config-file networks/mnist-chw-ai85.yaml --softmax $COMMON_ARGS "$@"
7-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix mnist-riscv --checkpoint-file trained/ai85-mnist-qat8-q.pth.tar --config-file networks/mnist-chw-ai85.yaml --softmax $COMMON_ARGS --riscv --riscv-debug "$@"
8-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix cifar-10 --checkpoint-file trained/ai85-cifar10-qat8-q.pth.tar --config-file networks/cifar10-nas.yaml --sample-input tests/sample_cifar-10.npy --softmax $COMMON_ARGS "$@"
9-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix cifar-100 --checkpoint-file trained/ai85-cifar100-qat8-q.pth.tar --config-file networks/cifar100-nas.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
10-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix cifar-100-mixed --checkpoint-file trained/ai85-cifar100-qat-mixed-q.pth.tar --config-file networks/cifar100-simple.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
11-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix cifar-100-simplewide2x-mixed --checkpoint-file trained/ai85-cifar100-simplenetwide2x-qat-mixed-q.pth.tar --config-file networks/cifar100-simplewide2x.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
12-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix cifar-100-residual --checkpoint-file trained/ai85-cifar100-residual-qat8-q.pth.tar --config-file networks/cifar100-ressimplenet.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
13-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix kws20_v3 --checkpoint-file trained/ai85-kws20_v3-qat8-q.pth.tar --config-file networks/kws20-v3-hwc.yaml --softmax $COMMON_ARGS "$@"
14-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix faceid --checkpoint-file trained/ai85-faceid-qat8-q.pth.tar --config-file networks/faceid.yaml --fifo $COMMON_ARGS "$@"
15-
./ai8xize.py --verbose --log --test-dir $TARGET --prefix cats-dogs --checkpoint-file trained/ai85-catsdogs-qat8-q.pth.tar --config-file networks/cats-dogs-chw.yaml --softmax $COMMON_ARGS "$@"
6+
./ai8xize.py --test-dir $TARGET --prefix mnist --checkpoint-file trained/ai85-mnist-qat8-q.pth.tar --config-file networks/mnist-chw-ai85.yaml --softmax $COMMON_ARGS "$@"
7+
./ai8xize.py --test-dir $TARGET --prefix mnist-riscv --checkpoint-file trained/ai85-mnist-qat8-q.pth.tar --config-file networks/mnist-chw-ai85.yaml --softmax $COMMON_ARGS --riscv --riscv-debug "$@"
8+
./ai8xize.py --test-dir $TARGET --prefix cifar-10 --checkpoint-file trained/ai85-cifar10-qat8-q.pth.tar --config-file networks/cifar10-nas.yaml --sample-input tests/sample_cifar-10.npy --softmax $COMMON_ARGS "$@"
9+
./ai8xize.py --test-dir $TARGET --prefix cifar-100 --checkpoint-file trained/ai85-cifar100-qat8-q.pth.tar --config-file networks/cifar100-nas.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
10+
./ai8xize.py --test-dir $TARGET --prefix cifar-100-mixed --checkpoint-file trained/ai85-cifar100-qat-mixed-q.pth.tar --config-file networks/cifar100-simple.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
11+
./ai8xize.py --test-dir $TARGET --prefix cifar-100-simplewide2x-mixed --checkpoint-file trained/ai85-cifar100-simplenetwide2x-qat-mixed-q.pth.tar --config-file networks/cifar100-simplewide2x.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
12+
./ai8xize.py --test-dir $TARGET --prefix cifar-100-residual --checkpoint-file trained/ai85-cifar100-residual-qat8-q.pth.tar --config-file networks/cifar100-ressimplenet.yaml --softmax $COMMON_ARGS --boost 2.5 "$@"
13+
./ai8xize.py --test-dir $TARGET --prefix kws20_v3 --checkpoint-file trained/ai85-kws20_v3-qat8-q.pth.tar --config-file networks/kws20-v3-hwc.yaml --softmax $COMMON_ARGS "$@"
14+
./ai8xize.py --test-dir $TARGET --prefix faceid --checkpoint-file trained/ai85-faceid-qat8-q.pth.tar --config-file networks/faceid.yaml --fifo $COMMON_ARGS "$@"
15+
./ai8xize.py --test-dir $TARGET --prefix cats-dogs --checkpoint-file trained/ai85-catsdogs-qat8-q.pth.tar --config-file networks/cats-dogs-chw.yaml --softmax $COMMON_ARGS "$@"

0 commit comments

Comments
 (0)