Skip to content

Commit

Permalink
3.5 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
haugoug authored Jun 1, 2020
1 parent f04b0ae commit d69bd40
Show file tree
Hide file tree
Showing 370 changed files with 49,200 additions and 9,963 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
3.5

Highlights of this release:

- NNTool
- Added new quantization scheme with scaling factors (tflite quantization-like)
- Support import tflite (1 or 2) quantized graphs (uint8)
- New adjust algorithm to support more general reshape/transpose layers
- Added Autotiler layer for input image formatting (HWC uint8 -> CHW int8/int16)
- Support multi-inputs network execution
- Support for new tensor dumping routines in AutoTiler
- Support for generation of model using SQ8 AutoTiler generators
- Bug fixes

- Autotiler
- New SQ8 kernel set supporting scaled quantization
- Tensor dumping from any memory area
- Several bug fixes

3.4

Highlights of this release:
Expand Down
6 changes: 2 additions & 4 deletions applications/CannyEdgeDetection/CannyDetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,9 @@ void canny_edge_detector()
sprintf(imageName, "../../../%s", Imagefile);
ImageIn_L2 = (unsigned char *) pi_l2_malloc( COL*LINE*sizeof(unsigned char));

unsigned int Wi, Hi;

if ( (ReadImageFromFile(imageName, &Wi, &Hi, ImageIn_L2, LINE*COL*sizeof(unsigned char))==0) || (Wi!=COL) || (Hi!=LINE))
if (ReadImageFromFile(imageName, COL,LINE, 1, ImageIn_L2, LINE*COL*sizeof(unsigned char), 0, 0))
{
printf("Failed to load image %s or dimension mismatch Expects [%dx%d], Got [%dx%d]\n", imageName, COL, LINE, Wi, Hi);
printf("Failed to load image %s\n", imageName);
pmsis_exit(-1);
}

Expand Down
4 changes: 0 additions & 4 deletions applications/CannyEdgeDetection/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ APP_LDFLAGS += -flto -Wl,--gc-sections
# in a clean way.
APP_CFLAGS += -Wall -Werror -Wno-maybe-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wundef

# Should be removed once openocd is the default bridge
export GAP_USE_OPENOCD=1
io=host

clean::
rm -rf img_OUT.ppm

Expand Down
12 changes: 6 additions & 6 deletions applications/FaceDetection/FaceDetGenerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void GenerateResize(char *Name, int Wi, int Hi, int Wo, int Ho)
KernelIterSpace(1, IterTiledSpace(KER_ITER_TILE0)),
TILE_HOR,
CArgs(2, TCArg("unsigned char *", "In"), TCArg("unsigned char *", "Out")),
Calls(1, Call("KerResizeBilinear", LOC_INNER_LOOP,
Calls(1, Call("KerResizeBilinear", LOC_LOOP,
Bindings(8, K_Arg("In", KER_ARG_TILE),
K_Arg("In", KER_ARG_W),
K_Arg("In", KER_ARG_H),
Expand Down Expand Up @@ -123,13 +123,13 @@ void GenerateIntegralImage(char *Name,
TCArg("unsigned int * __restrict__", "IntegralImage")
),
Calls(2,
Call("KerIntegralImagePrime", LOC_INNER_LOOP_PROLOG,
Call("KerIntegralImagePrime", LOC_LOOP_PROLOG,
Bindings(2,
K_Arg("KerBuffer",KER_ARG),
K_Arg("KerIn", KER_ARG_TILE_W)
)
),
Call("KerIntegralImageProcess", LOC_INNER_LOOP,
Call("KerIntegralImageProcess", LOC_LOOP,
Bindings(5,
K_Arg("KerIn", KER_ARG_TILE),
K_Arg("KerIn", KER_ARG_TILE_W),
Expand Down Expand Up @@ -162,13 +162,13 @@ void GenerateSquaredIntegralImage(char *Name,
TCArg("unsigned int * __restrict__", "IntegralImage")
),
Calls(2,
Call("KerIntegralImagePrime", LOC_INNER_LOOP_PROLOG,
Call("KerIntegralImagePrime", LOC_LOOP_PROLOG,
Bindings(2,
K_Arg("KerBuffer",KER_ARG),
K_Arg("KerIn", KER_ARG_TILE_W)
)
),
Call("KerSquaredIntegralImageProcess", LOC_INNER_LOOP,
Call("KerSquaredIntegralImageProcess", LOC_LOOP,
Bindings(5,
K_Arg("KerIn", KER_ARG_TILE),
K_Arg("KerIn", KER_ARG_TILE_W),
Expand Down Expand Up @@ -208,7 +208,7 @@ void GenerateCascadeClassifier(char *Name,
),
Calls(1,

Call("KerEvaluateCascade", LOC_INNER_LOOP,
Call("KerEvaluateCascade", LOC_LOOP,
Bindings(8,
K_Arg("KerII", KER_ARG_TILE),
K_Arg("KerIISQ", KER_ARG_TILE),
Expand Down
7 changes: 6 additions & 1 deletion applications/FaceDetection/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ override config_args += --config-opt=camera/image-stream=$(CURDIR)/imgTest0.pgm

APP_SRCS += $(FACE_DET_SRCS)
APP_INC += $(TILER_INC)
APP_CFLAGS += -O3 -g -D__PMSIS__ -DUSE_CAMERA -DUSE_DISPLAY -DNB_FRAMES=$(NB_FRAMES)
APP_CFLAGS += -O3 -g -D__PMSIS__ -DUSE_CAMERA -DNB_FRAMES=$(NB_FRAMES)

display ?= 1
ifeq ($(display), 1)
APP_CFLAGS += -DUSE_DISPLAY
endif

BOARD_NAME ?= gapoc_a
PMSIS_OS ?= freertos
Expand Down
14 changes: 8 additions & 6 deletions applications/FaceDetection/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
#define LCD_HEIGHT 240

static unsigned char *imgBuff0;
#if defined(USE_DISPLAY)
static struct pi_device ili;
static pi_buffer_t buffer;
static pi_buffer_t buffer_out;
#endif /* USE_DISPLAY */
static struct pi_device cam;

L2_MEM unsigned char *ImageOut;
Expand All @@ -70,11 +72,9 @@ ArgCluster_T ClusterCall;
void setCursor(struct pi_device *device,signed short x, signed short y);
void writeFillRect(struct pi_device *device, unsigned short x, unsigned short y, unsigned short w, unsigned short h, unsigned short color);
void writeText(struct pi_device *device,char* str,int fontsize);
#endif /* USE_DISPLAY */

static int open_display(struct pi_device *device)
{
#if defined(USE_DISPLAY)
struct pi_ili9341_conf ili_conf;

pi_ili9341_conf_init(&ili_conf);
Expand All @@ -85,9 +85,9 @@ static int open_display(struct pi_device *device)
{
return -1;
}
#endif
return 0;
}
#endif /* USE_DISPLAY */

#if defined(USE_CAMERA)
#if defined(HIMAX)
Expand Down Expand Up @@ -166,15 +166,17 @@ void test_facedetection(void)
{
printf("Failed to allocate Memory for one or both Integral Images (%d bytes)\n", ImgSize*sizeof(unsigned int));
pmsis_exit(-3);
}
}
printf("malloc done\n");

#if defined(USE_DISPLAY)
if (open_display(&ili))
{
printf("Failed to open display\n");
pmsis_exit(-4);
}
printf("display done\n");
#endif /* USE_DISPLAY */

if (open_camera(&cam))
{
Expand All @@ -183,6 +185,7 @@ void test_facedetection(void)
}
printf("Camera open success\n");

#if defined(USE_DISPLAY)
#if defined(HIMAX)
buffer.data = imgBuff0+CAM_WIDTH*2+2;
buffer.stride = 4;
Expand All @@ -195,14 +198,13 @@ void test_facedetection(void)
pi_buffer_init(&buffer, PI_BUFFER_TYPE_L2, imgBuff0);
#endif /* HIMAX */

#if defined(USE_DISPLAY)
buffer_out.data = ImageOut;
buffer_out.stride = 0;
pi_buffer_init(&buffer_out, PI_BUFFER_TYPE_L2, ImageOut);
pi_buffer_set_stride(&buffer_out, 0);
#endif /* USE_DISPLAY */

pi_buffer_set_format(&buffer, CAM_WIDTH, CAM_HEIGHT, 1, PI_BUFFER_FORMAT_GRAY);
#endif /* USE_DISPLAY */

ClusterCall.ImageIn = imgBuff0;
ClusterCall.Win = W;
Expand Down
4 changes: 2 additions & 2 deletions applications/FaceDetection/testset.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ test = Test(
name = 'face_detection',
commands = [
Shell('clean', 'make clean'),
Shell('build', 'make all NB_FRAMES=5'),
Shell('build', 'make all NB_FRAMES=5 display=0'),
Shell('run', 'make run')
],
timeout=1000000,
)

c['tests'] = [ test ]
3 changes: 3 additions & 0 deletions applications/jpeg_encoder/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Only Pulp-Os for now.
PMSIS_OS=pulpos

APP = test
APP_SRCS += test.c ImgIO.c
APP_CFLAGS += -O3 -g -Werror
Expand Down
7 changes: 5 additions & 2 deletions configs/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export DEP_DIRS=$INSTALL_DIR
export RULES_DIR=$GAP_SDK_HOME/tools/rules

export NNTOOL_DIR=$GAP_SDK_HOME/tools/nntool
export NNTOOL_PATH=$GAP_SDK_HOME/tools/nntool
export NNTOOL_KERNELS_PATH=$NNTOOL_DIR/autotiler/kernels
export NNTOOL_GENERATOR_PATH=$NNTOOL_DIR/autotiler/generators
export PATH="$NNTOOL_DIR":$PATH

# PulpOS 2
Expand Down Expand Up @@ -55,8 +58,8 @@ export TILER_EMU_INC=$TILER_PATH/include
export TILER_GENERATOR_PATH=$TILER_PATH/generators
export TILER_CNN_KERNEL_PATH=$TILER_PATH/generators/CNN
export TILER_CNN_GENERATOR_PATH=$TILER_PATH/generators/CNN
export TILER_CNN_KERNEL_PATH_SQ8=$TILER_PATH/CNN_Libraries_SQ8
export TILER_CNN_GENERATOR_PATH_SQ8=$TILER_PATH/CNN_Generators_SQ8
export TILER_CNN_KERNEL_PATH_SQ8=$TILER_PATH/generators/CNN
export TILER_CNN_GENERATOR_PATH_SQ8=$TILER_PATH/generators/CNN


# OpenOCD
Expand Down
24 changes: 20 additions & 4 deletions examples/autotiler/Cifar10/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@ RM=rm -f
CNN_AT_PATH = $(TILER_GENERATOR_PATH)/CNN

APP = Cifar10

MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_BiasReLULinear_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Pooling_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_MatAlgebra.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_SoftMax.c
MODEL_LIB_POW2 += $(NNTOOL_KERNELS_PATH)/norm_transpose.c
MODEL_LIB_INCLUDE_POW2 = -I$(NNTOOL_KERNELS_PATH) -I$(TILER_CNN_KERNEL_PATH) -I$(NNTOOL_KERNELS_PATH)
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generator_Util.c
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generators.c
MODEL_GEN_POW2 += $(NNTOOL_GENERATOR_PATH)/nntool_extra_generators.c
MODEL_GEN_INCLUDE_POW2 = -I$(TILER_CNN_GENERATOR_PATH) -I$(NNTOOL_GENERATOR_PATH)


APP_SRCS += Cifar10.c Cifar10Kernels.c \
$(CNN_AT_PATH)/CNN_BiasReLULinear_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Conv_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Pooling_BasicKernels.c
$(MODEL_LIB_POW2)

APP_INC += $(TILER_INC) $(CNN_AT_PATH)

COEF_FLAG = -DCOEF_L2
Expand Down Expand Up @@ -57,7 +73,7 @@ all:: model

# Build the code generator
GenTile:
gcc -o GenCifar10 $(COEF_FLAG) -I$(TILER_INC) -I$(CNN_AT_PATH) Cifar10Model.c $(CNN_AT_PATH)/CNN_Generators.c $(TILER_LIB)
gcc -o GenCifar10 $(COEF_FLAG) -I$(TILER_INC) -I$(CNN_AT_PATH) Cifar10Model.c $(MODEL_GEN_POW2) $(TILER_LIB)

# Run the code generator
Cifar10Kernels.c: GenTile
Expand Down
6 changes: 1 addition & 5 deletions examples/autotiler/IntegralImage/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ MODEL_GEN_C = $(addsuffix .c, $(MODEL_GEN))
MODEL_GEN_CLEAN = $(MODEL_GEN_C) $(addsuffix .h, $(MODEL_GEN))
RM=rm -f

APP_SRCS += main.c $(GAP_LIB_PATH)/img_io/ImgIO.c $(MODEL_GEN_C) $(GEN_KER_PATH)/IntegralImgBasicKernels.c
APP_SRCS += main.c $(MODEL_GEN_C) $(GEN_KER_PATH)/IntegralImgBasicKernels.c $(GAP_LIB_PATH)/img_io/ImgIO.c
APP_INC = $(GAP_LIB_PATH)/include

APP_CFLAGS += -O3 -mno-memcpy -fno-tree-loop-distribute-patterns $(JENKINS_FLAGS)
APP_CFLAGS += -I$(TILER_EMU_INC) -I$(TILER_INC) -I$(GEN_KER_PATH)

#moved to new openocd bridge
export GAP_USE_OPENOCD=1
io=host

all:: model

# Build the code generator
Expand Down
2 changes: 1 addition & 1 deletion examples/autotiler/IntegralImage/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void integral_image(int argc, char *argv[])

#ifndef NO_BRIDGE
//Reading Image from Hyperflash
if ((ReadImageFromFile(ImageName, &Wi, &Hi, ImageIn, W*H*sizeof(unsigned char))==0) || (Wi!=W) || (Hi!=H)) {
if (ReadImageFromFile(ImageName, W, H, 1, ImageIn, W*H*sizeof(unsigned char), 0, 0)) {
printf("Failed to load image %s or dimension mismatch Expects [%dx%d], Got [%dx%d]\n", ImageName, W, H, Wi, Hi);
pmsis_exit(-6);
}
Expand Down
21 changes: 17 additions & 4 deletions examples/autotiler/Mnist/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,23 @@ endif

CNN_AT_PATH = $(TILER_GENERATOR_PATH)/CNN

MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_BiasReLULinear_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Pooling_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_MatAlgebra.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_SoftMax.c
MODEL_LIB_POW2 += $(NNTOOL_KERNELS_PATH)/norm_transpose.c
MODEL_LIB_INCLUDE_POW2 = -I$(NNTOOL_KERNELS_PATH) -I$(TILER_CNN_KERNEL_PATH) -I$(NNTOOL_KERNELS_PATH)
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generator_Util.c
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generators.c
MODEL_GEN_POW2 += $(NNTOOL_GENERATOR_PATH)/nntool_extra_generators.c
MODEL_GEN_INCLUDE_POW2 = -I$(TILER_CNN_GENERATOR_PATH) -I$(NNTOOL_GENERATOR_PATH)

APP_SRCS += Mnist.c MnistKernels.c \
$(CNN_AT_PATH)/CNN_BiasReLULinear_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Conv_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Pooling_BasicKernels.c \
$(MODEL_LIB_POW2) \
ImgIO.c

APP_INC += $(TILER_INC) $(CNN_AT_PATH)
Expand All @@ -46,7 +59,7 @@ all:: model

# Build the code generator
GenTile:
gcc -o GenMnist -I$(TILER_INC) -I$(CNN_AT_PATH) MnistModel.c $(CNN_AT_PATH)/CNN_Generators.c $(TILER_LIB)
gcc -o GenMnist -I$(TILER_INC) -I$(CNN_AT_PATH) MnistModel.c $(MODEL_GEN_POW2) $(TILER_LIB)

# Run the code generator
MnistKernels.c: GenTile
Expand Down
26 changes: 19 additions & 7 deletions examples/autotiler/MnistGraph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,29 @@ io=host

CNN_AT_PATH = $(TILER_GENERATOR_PATH)/CNN

MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_BiasReLULinear_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Conv_DW_DP_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_Pooling_BasicKernels.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_MatAlgebra.c
MODEL_LIB_POW2 += $(TILER_CNN_KERNEL_PATH)/CNN_SoftMax.c
MODEL_LIB_POW2 += $(NNTOOL_KERNELS_PATH)/norm_transpose.c
MODEL_LIB_INCLUDE_POW2 = -I$(NNTOOL_KERNELS_PATH) -I$(TILER_CNN_KERNEL_PATH) -I$(NNTOOL_KERNELS_PATH)
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generator_Util.c
MODEL_GEN_POW2 += $(TILER_CNN_GENERATOR_PATH)/CNN_Generators.c
MODEL_GEN_POW2 += $(NNTOOL_GENERATOR_PATH)/nntool_extra_generators.c
MODEL_GEN_INCLUDE_POW2 = -I$(TILER_CNN_GENERATOR_PATH) -I$(NNTOOL_GENERATOR_PATH)


APP_SRCS += Mnist.c MnistKernels.c \
$(CNN_AT_PATH)/CNN_BiasReLULinear_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Conv_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Conv_DP_BasicKernels.c \
$(CNN_AT_PATH)/CNN_Pooling_BasicKernels.c \
$(CNN_AT_PATH)/CNN_SoftMax.c \
$(MODEL_LIB_POW2) \
ImgIO.c

APP_INC += $(TILER_INC) $(CNN_AT_PATH)

APP_CFLAGS += -w -O3 -mno-memcpy -fno-tree-loop-distribute-patterns -fdata-sections -ffunction-sections
APP_CFLAGS += -w -g3 -O3 -mno-memcpy -fno-tree-loop-distribute-patterns -fdata-sections -ffunction-sections
APP_CFLAGS += -Wno-maybe-uninitialized -Wno-unused-but-set-variable
LDFLAGS += -flto -Wl,--gc-sections

Expand All @@ -48,7 +60,7 @@ all:: model

# Build the code generator
GenTile:
gcc -o GenMnist -I$(TILER_INC) -I$(CNN_AT_PATH) MnistModel.c $(CNN_AT_PATH)/CNN_Generators.c $(TILER_LIB)
gcc -o GenMnist -I$(TILER_INC) -I$(CNN_AT_PATH) MnistModel.c $(MODEL_GEN_POW2) $(TILER_LIB)

# Run the code generator
MnistKernels.c: GenTile
Expand Down
4 changes: 1 addition & 3 deletions examples/native/freeRTOS/periph/timer/test_timer.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* PMSIS includes */
#include "pmsis.h"
#if defined(PMSIS_DRIVERS)
#include "pmsis_driver/pmsis_it.h"
#endif /* PMSIS_DRIVERS */
#include "pmsis/implem/drivers/pmsis_it.h"

#define NB_ITER ( 5 )

Expand Down
Loading

0 comments on commit d69bd40

Please sign in to comment.