Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Severe macro-coditioning compilation errors due to enum implementation of binary constants #37

Closed
GiorgosXou opened this issue Jun 11, 2024 · 1 comment
Labels
Arduino Mbed OS Nano Boards bug Something isn't working Solved Solved but not closed until next version

Comments

@GiorgosXou
Copy link
Owner

GiorgosXou commented Jun 11, 2024

Replacing all constant B01... with 0b...-literals should solve the issue for "Arduino Mbed OS Nano Boards" for now. the issue is tracked here: arduino/ArduinoCore-mbed#894 (discord crossref link)

Eg. Compiling the MNIST-example results on every optimization to get enabled:

In file included from /tmp/.arduinoIDE-unsaved2024511-3095-t7tr5u.8y9xh/FeedForward_Individual_MNIST_PROGMEM/FeedForward_Individual_MNIST_PROGMEM.ino:4:0:
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:979:0: warning: ignoring #pragma region NeuralNetwork [-Wunknown-pragmas]
 #pragma region NeuralNetwork.cpp
 
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1647:0: warning: ignoring #pragma endregion NeuralNetwork [-Wunknown-pragmas]
 #pragma endregion NeuralNetwork.cpp
 
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1655:0: warning: ignoring #pragma region Layer [-Wunknown-pragmas]
 #pragma region Layer.cpp
 
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2617:0: warning: ignoring #pragma endregion Layer [-Wunknown-pragmas]
 #pragma endregion Layer.cpp
 
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:699:35: note: #pragma message: 
❤ 𝖀𝖓𝖈𝖔𝖓𝖉𝖎𝖙𝖎𝖔𝖓𝖆𝖑 𝕷𝖔𝖛𝖊 ❤ "VERSION: 2.1.7"
 
⌥▌" [1] B10000000 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Backpropagation is not Allowed with (USE_PROGMEM)." 
⌥▌" [1] B01000000 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Backpropagation is not Allowed with (REDUCE_RAM_DELETE_OUTPUTS)." 
⌥▌" [1] B00010000 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Using (REDUCE_RAM_WEIGHTS_LVL2)." 
⌥▌" [1] B00001000 [ⓘ] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Always Enabled not switchable yet." 
⌥▌" [1] B00000100 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Be careful with multiple NN objects." 
⌥▌" [1] B00000010 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] MSE is disabled (DISABLE_MSE) (DEFAULT_LOSS)" 
⌥▌" [1] B00000001 [⚠] [𝗥𝗲𝗺𝗶𝗻𝗱𝗲𝗿] Not all MCUs support 64bit\8byte double (USE_64_BIT_DOUBLE)." 

 𝗨𝗦𝗜𝗡𝗚 [ƒx] |‣ Sigmoid |⌥|


 #pragma message( STR(INFORMATION) )
                                   ^
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In constructor 'NeuralNetwork::NeuralNetwork(const unsigned int*, const double*, const double*, const unsigned int&, byte*)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1096:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < numberOflayers; i++)
                         ~~^~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'double* NeuralNetwork::FeedForward_Individual(const double&)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1247:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (Individual_Input == layers[0]._numberOfInputs)
             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1283:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = 1; i < numberOflayers; i++)
                             ~~^~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'double* NeuralNetwork::FeedForward(const double*)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1348:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 1; i < numberOflayers; i++)
                         ~~^~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::print()':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1629:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < numberOflayers; i++)
                         ~~^~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::Layer::FdF_Individual_PROGMEM(const double&, const int&)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1900:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i = 0; i < _numberOfOutputs; i++)
                     ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1924:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (j == _numberOfInputs -1){
             ~~^~~~~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1925:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (i = 0; i < _numberOfOutputs; i++)
                         ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::Layer::FeedForward_Individual(const double&, const int&)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1961:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i = 0; i < _numberOfOutputs; i++)
                     ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1985:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (j == _numberOfInputs -1){
             ~~^~~~~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1986:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (i = 0; i < _numberOfOutputs; i++){
                         ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::Layer::FdF_PROGMEM(const double*)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2147:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < _numberOfOutputs; i++)
                         ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2157:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j = 0; j < _numberOfInputs; j++)
                             ~~^~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::Layer::FeedForward(const double*)':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2192:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < _numberOfOutputs; i++)
                         ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2216:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for (int j = 0; j < _numberOfInputs; j++)
                                 ~~^~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::Layer::print()':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2506:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < _numberOfOutputs; i++)
                         ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2514:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j = 0; j < _numberOfInputs; j++)
                             ~~^~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h: In member function 'void NeuralNetwork::Layer::print_PROGMEM()':
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2549:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < _numberOfOutputs; i++)
                         ~~^~~~~~~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:2557:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j = 0; j < _numberOfInputs; j++)
                             ~~^~~~~~~~~~~~~~~~~
/tmp/.arduinoIDE-unsaved2024511-3095-t7tr5u.8y9xh/FeedForward_Individual_MNIST_PROGMEM/FeedForward_Individual_MNIST_PROGMEM.ino: In function 'void setup()':
/tmp/.arduinoIDE-unsaved2024511-3095-t7tr5u.8y9xh/FeedForward_Individual_MNIST_PROGMEM/FeedForward_Individual_MNIST_PROGMEM.ino:102:61: error: no matching function for call to 'NeuralNetwork::NeuralNetwork(const unsigned int [4], const float [5560], const float [3], unsigned int)'
   NeuralNetwork NN(layers, weights, biases, NumberOf(layers)); // Creating a NeuralNetwork with pretrained Weights and Biases
                                                             ^
In file included from /tmp/.arduinoIDE-unsaved2024511-3095-t7tr5u.8y9xh/FeedForward_Individual_MNIST_PROGMEM/FeedForward_Individual_MNIST_PROGMEM.ino:4:0:
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1070:9: note: candidate: NeuralNetwork::NeuralNetwork(const unsigned int*, const double*, const double*, const unsigned int&, byte*)
         NeuralNetwork::NeuralNetwork(const unsigned int *layer_, IS_CONST DFLOAT *default_Weights, IS_CONST DFLOAT *default_Bias, const unsigned int &NumberOflayers, byte *_ActFunctionPerLayer)
         ^~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:1070:9: note:   no known conversion for argument 2 from 'const float [5560]' to 'const double*'
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:980:5: note: candidate: NeuralNetwork::NeuralNetwork()
     NeuralNetwork::NeuralNetwork() {
     ^~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:980:5: note:   candidate expects 0 arguments, 4 provided
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:702:7: note: candidate: constexpr NeuralNetwork::NeuralNetwork(const NeuralNetwork&)
 class NeuralNetwork
       ^~~~~~~~~~~~~
/home/xou/Arduino/libraries/NeuralNetwork/src/NeuralNetwork.h:702:7: note:   candidate expects 1 argument, 4 provided
/tmp/.arduinoIDE-unsaved2024511-3095-t7tr5u.8y9xh/FeedForward_Individual_MNIST_PROGMEM/FeedForward_Individual_MNIST_PROGMEM.ino:110:85: error: cannot convert 'double*' to 'float*' in assignment
       output = NN.FeedForward_Individual(pgm_read_byte(&NumbersInPixels[i][j])/255.0);
                                                                                     ^

exit status 1

Compilation error: no matching function for call to 'NeuralNetwork::NeuralNetwork(const unsigned int [4], const float [5560], const float [3], unsigned int)'
@GiorgosXou
Copy link
Owner Author

GiorgosXou commented Jun 11, 2024

I could test if detecting predifined B00000000 exists at all and then if not, fallback somehow to literal-ones by appending a 0 to the _X_OPTIMIZE value (so it becomes 0B...) and then add conditions for 0B..s too or something....

@GiorgosXou GiorgosXou changed the title Binary constants - enum implementation, leading to severe macro-coditioning compilation errors Severe macro-coditioning compilation errors due to enum implementation of binary constants Jun 11, 2024
@GiorgosXou GiorgosXou added Solved Solved but not closed until next version and removed Partially Solved labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arduino Mbed OS Nano Boards bug Something isn't working Solved Solved but not closed until next version
Projects
None yet
Development

No branches or pull requests

1 participant