Compile error when using wrapping option of memory manager
export_cpp d3afecf7
Problem description
CF the standalone example code wrapping_issue.zip : when not using wrapping option, export works fine.
But when using wrapping cf below :
aidge_core.export_utils.scheduler_export(
s_export,
export_folder,
aidge_export_cpp.ExportLibCpp,
memory_manager=aidge_core.mem_info.generate_optimized_memory_info,
memory_manager_args={"stats_folder": f"{export_folder}/stats", "wrapping": True, "display_names":True } # HERE
)
I get following errors + seg-fault when compiling forward.cpp :
g++ -Wall -Wextra -MMD -fopenmp -O2 -I. -I./dnn -I./dnn/include -I./dnn/layers -I./dnn/parameters -c dnn/src/forward.cpp -o build/./dnn/src/forward.o
In file included from dnn/src/forward.cpp:68:
./dnn/include/kernels/activation.hpp: In instantiation of ‘void activation_forward(const Input_T*, Output_T*, const Rescaling_T&) [with long unsigned int NB_ELTS = 3066; export_cpp::ActivationFunction_T ACTIVATION = export_cpp::Rectifier; long unsigned int INPUT_MEM_CONT_OFFSET = 14896; long unsigned int INPUT_MEM_CONT_SIZE = 12264; long unsigned int INPUT_MEM_WRAP_OFFSET = 14896; long unsigned int INPUT_MEM_WRAP_SIZE = 0; long unsigned int INPUT_MEM_STRIDE = 12264; long unsigned int OUTPUT_MEM_CONT_OFFSET = 27160; long unsigned int OUTPUT_MEM_CONT_SIZE = 0; long unsigned int OUTPUT_MEM_WRAP_OFFSET = 14896; long unsigned int OUTPUT_MEM_WRAP_SIZE = 12264; long unsigned int OUTPUT_MEM_STRIDE = 12264; Sum_T = float; Input_T = float; Output_T = float; Rescaling_T = export_cpp::NoScaling]’:
dnn/src/forward.cpp:529:24: required from here
./dnn/include/kernels/activation.hpp:43:49: warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘4611686018427384838’ to ‘-3066’ [-Woverflow]
42 | outOffset = (OUTPUT_MEM_WRAP_OFFSET - OUTPUT_MEM_CONT_OFFSET
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | - OUTPUT_MEM_CONT_SIZE) / sizeof(Output_T);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
./dnn/include/kernels/activation.hpp: In instantiation of ‘void activation_forward(const Input_T*, Output_T*, const Rescaling_T&) [with long unsigned int NB_ELTS = 3060; export_cpp::ActivationFunction_T ACTIVATION = export_cpp::Rectifier; long unsigned int INPUT_MEM_CONT_OFFSET = 14896; long unsigned int INPUT_MEM_CONT_SIZE = 12240; long unsigned int INPUT_MEM_WRAP_OFFSET = 14896; long unsigned int INPUT_MEM_WRAP_SIZE = 0; long unsigned int INPUT_MEM_STRIDE = 12240; long unsigned int OUTPUT_MEM_CONT_OFFSET = 27136; long unsigned int OUTPUT_MEM_CONT_SIZE = 0; long unsigned int OUTPUT_MEM_WRAP_OFFSET = 14896; long unsigned int OUTPUT_MEM_WRAP_SIZE = 12240; long unsigned int OUTPUT_MEM_STRIDE = 12240; Sum_T = float; Input_T = float; Output_T = float; Rescaling_T = export_cpp::NoScaling]’:
dnn/src/forward.cpp:681:24: required from here
./dnn/include/kernels/activation.hpp:43:49: warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘4611686018427384844’ to ‘-3060’ [-Woverflow]
./dnn/include/kernels/activation.hpp: In instantiation of ‘void activation_forward(const Input_T*, Output_T*, const Rescaling_T&) [with long unsigned int NB_ELTS = 1690; export_cpp::ActivationFunction_T ACTIVATION = export_cpp::Rectifier; long unsigned int INPUT_MEM_CONT_OFFSET = 0; long unsigned int INPUT_MEM_CONT_SIZE = 6760; long unsigned int INPUT_MEM_WRAP_OFFSET = 0; long unsigned int INPUT_MEM_WRAP_SIZE = 0; long unsigned int INPUT_MEM_STRIDE = 6760; long unsigned int OUTPUT_MEM_CONT_OFFSET = 6760; long unsigned int OUTPUT_MEM_CONT_SIZE = 0; long unsigned int OUTPUT_MEM_WRAP_OFFSET = 0; long unsigned int OUTPUT_MEM_WRAP_SIZE = 6760; long unsigned int OUTPUT_MEM_STRIDE = 6760; Sum_T = float; Input_T = float; Output_T = float; Rescaling_T = export_cpp::NoScaling]’:
dnn/src/forward.cpp:985:24: required from here
./dnn/include/kernels/activation.hpp:43:49: warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘4611686018427386214’ to ‘-1690’ [-Woverflow]
./dnn/include/kernels/activation.hpp: In instantiation of ‘void activation_forward(const Input_T*, Output_T*, const Rescaling_T&) [with long unsigned int NB_ELTS = 1680; export_cpp::ActivationFunction_T ACTIVATION = export_cpp::Rectifier; long unsigned int INPUT_MEM_CONT_OFFSET = 0; long unsigned int INPUT_MEM_CONT_SIZE = 6720; long unsigned int INPUT_MEM_WRAP_OFFSET = 0; long unsigned int INPUT_MEM_WRAP_SIZE = 0; long unsigned int INPUT_MEM_STRIDE = 6720; long unsigned int OUTPUT_MEM_CONT_OFFSET = 6720; long unsigned int OUTPUT_MEM_CONT_SIZE = 0; long unsigned int OUTPUT_MEM_WRAP_OFFSET = 0; long unsigned int OUTPUT_MEM_WRAP_SIZE = 6720; long unsigned int OUTPUT_MEM_STRIDE = 6720; Sum_T = float; Input_T = float; Output_T = float; Rescaling_T = export_cpp::NoScaling]’:
dnn/src/forward.cpp:1137:24: required from here
./dnn/include/kernels/activation.hpp:43:49: warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘4611686018427386224’ to ‘-1680’ [-Woverflow]
./dnn/include/kernels/activation.hpp: In instantiation of ‘void activation_forward(const Input_T*, Output_T*, const Rescaling_T&) [with long unsigned int NB_ELTS = 770; export_cpp::ActivationFunction_T ACTIVATION = export_cpp::Rectifier; long unsigned int INPUT_MEM_CONT_OFFSET = 3120; long unsigned int INPUT_MEM_CONT_SIZE = 3080; long unsigned int INPUT_MEM_WRAP_OFFSET = 3120; long unsigned int INPUT_MEM_WRAP_SIZE = 0; long unsigned int INPUT_MEM_STRIDE = 3080; long unsigned int OUTPUT_MEM_CONT_OFFSET = 6200; long unsigned int OUTPUT_MEM_CONT_SIZE = 0; long unsigned int OUTPUT_MEM_WRAP_OFFSET = 3120; long unsigned int OUTPUT_MEM_WRAP_SIZE = 3080; long unsigned int OUTPUT_MEM_STRIDE = 3080; Sum_T = float; Input_T = float; Output_T = float; Rescaling_T = export_cpp::NoScaling]’:
dnn/src/forward.cpp:1441:24: required from here
./dnn/include/kernels/activation.hpp:43:49: warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘4611686018427387134’ to ‘-770’ [-Woverflow]
./dnn/include/kernels/activation.hpp: In instantiation of ‘void activation_forward(const Input_T*, Output_T*, const Rescaling_T&) [with long unsigned int NB_ELTS = 756; export_cpp::ActivationFunction_T ACTIVATION = export_cpp::Rectifier; long unsigned int INPUT_MEM_CONT_OFFSET = 3080; long unsigned int INPUT_MEM_CONT_SIZE = 3024; long unsigned int INPUT_MEM_WRAP_OFFSET = 3080; long unsigned int INPUT_MEM_WRAP_SIZE = 0; long unsigned int INPUT_MEM_STRIDE = 3024; long unsigned int OUTPUT_MEM_CONT_OFFSET = 6104; long unsigned int OUTPUT_MEM_CONT_SIZE = 0; long unsigned int OUTPUT_MEM_WRAP_OFFSET = 3080; long unsigned int OUTPUT_MEM_WRAP_SIZE = 3024; long unsigned int OUTPUT_MEM_STRIDE = 3024; Sum_T = float; Input_T = float; Output_T = float; Rescaling_T = export_cpp::NoScaling]’:
dnn/src/forward.cpp:1593:24: required from here
./dnn/include/kernels/activation.hpp:43:49: warning: overflow in conversion from ‘long unsigned int’ to ‘int’ changes value from ‘4611686018427387148’ to ‘-756’ [-Woverflow]
In file included from dnn/src/forward.cpp:97:
In function ‘void transpose_ND_forward(const T*, T*) [with T = float; long unsigned int NB_DIMS = 3; long unsigned int NB_ELTS = 3066; const size_t* PERMUTE = (& NODE_CONV1D_1__PERMUTE); const size_t* IN_DIMS = (& NODE_CONV1D_1__DIMS); const size_t* OUT_STRIDE = (& NODE_CONV1D_1__OUT_STRIDES)]’,
inlined from ‘void model_forward(const float*, float**)’ at dnn/src/forward.cpp:560:25:
./dnn/include/kernels/cpp/transpose.hpp:49:39: warning: array subscript 6790 is outside array bounds of ‘unsigned char [27160]’ [-Warray-bounds=]
49 | outputs[output_index] = inputs[idx];
| ~~~~~~^
dnn/src/forward.cpp: In function ‘void model_forward(const float*, float**)’:
dnn/src/forward.cpp:106:22: note: at offset 27160 into object ‘mem’ of size 27160
106 | static unsigned char mem[27160];