Support for: SIMD #16
Replies: 3 comments 3 replies
-
Esp32-S3 supports SIMD as it has vector instructions, not so sure about the plain old esp32 though. I think cadence holds some IP as the layers and functions avail are limited such as no LSTM or Leaky Relu... Would be great to have a full SIMD support on this microcontroller. |
Beta Was this translation helpful? Give feedback.
-
here's some references and a minimal example for anyone confushed by the limited documentation: A basic example of code using "dsps_add_f32"#include <esp_dsp.h>
#define VECTOR_SIZE 16
void printv(float * v){
Serial.print("Vector: ");
for (int i = 0; i < VECTOR_SIZE; i++) {
Serial.print(v[i]);
Serial.print(" ");
}
Serial.println();
}
void setup() {
Serial.begin(115200);
float a[VECTOR_SIZE];
float b[VECTOR_SIZE];
float result[VECTOR_SIZE];
// Initialize the arrays with some data
for (int i = 0; i < VECTOR_SIZE; i++) {
a[i] = i;
b[i] = VECTOR_SIZE - i;
}
printv(a);
printv(b);
dsps_add_f32(a, b, result, VECTOR_SIZE, 1, 1, 1); // Works just fine on any ESP-32 because a macro translates it to dsps_add_f32_ansi if it doesn't support SIMD instructions
//dsps_add_f32_ae32(a, b, result, VECTOR_SIZE, 1, 1, 1); // Compiles only for ESP-32-S3 at the momment
printv(result);
}
void loop() {} |
Beta Was this translation helpful? Give feedback.
-
Partially done (at least for ESPs): NeuralNetworks/src/NeuralNetwork.h Lines 1964 to 1967 in 5cd31c9 |
Beta Was this translation helpful? Give feedback.
-
Just learned about SIMD from a comment about pangrams in stackoverflow. ESP32 I think supports SIMD ... and possibly many others, so why not?
Beta Was this translation helpful? Give feedback.
All reactions