Skip to content

ESP32-S3 throws IllegalInstruction-error for dsps_dotprod_f32 due to (ASM) dsps_dotprod_f32_ae32? #988

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

Open
GiorgosXou opened this issue Mar 29, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@GiorgosXou
Copy link

GiorgosXou commented Mar 29, 2025

Describe the bug
Based on this macro-condition dsps_dotprod_f32 defaults to dsps_dotprod_f32_ae32 for ESP32-S3. However, (despite the fact that it compiles) it throws IllegalInstruction-error in log, therefore it doesn't work. Unfortunately, I don't have an ESP32-S3 to verify this 100%, but as far as I understand this should be a wokwi issue.

To Reproduce
Just test this wokwi example here:

#include "esp_dsp.h"

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32-S3!");
  
  float x[]  = {1,2,3,4};
  float y[]  = {5,4,3,2};
  float dest = 1;

  dsps_dotprod_f32(x, y, &dest, 4); // FAILS (ASM)
  // dsps_dotprod_f32_ae32(x, y, &dest, 4); // FAILS (ASM)
  // dsps_dotprod_f32_ansi(x, y, &dest, 4); // WORKS (C-CODE)
  
  Serial.println(dest);
}

void loop() {}

Expected behavior
Based on this example, dsps_dotprod_f32 should work just like the ...ansi-version works without any error.

Environment (please complete the following information):

  • OS: Arch Linux
  • Browser: Ungoogled-chromium
  • Version: -

Additional context
As said, unfortunately: I don't have an ESP32-S3 to verify this 100% (an order I had never came), but as far as I understand this should be a wokwi issue.

@GiorgosXou GiorgosXou added the bug Something isn't working label Mar 29, 2025
@GiorgosXou GiorgosXou changed the title ESP32-S3 throughs IllegalInstruction-error for dsps_dotprod_f32 due to dsps_dotprod_f32_ae32. ESP32-S3 throws IllegalInstruction-error for dsps_dotprod_f32 due to dsps_dotprod_f32_ae32. Mar 29, 2025
@GiorgosXou GiorgosXou changed the title ESP32-S3 throws IllegalInstruction-error for dsps_dotprod_f32 due to dsps_dotprod_f32_ae32. ESP32-S3 throws IllegalInstruction-error for dsps_dotprod_f32 due to (ASM) dsps_dotprod_f32_ae32? Mar 29, 2025
@urish urish self-assigned this Mar 29, 2025
@urish
Copy link
Contributor

urish commented Mar 29, 2025

Thanks for reporting!

I looked into this, and it seems that the DSP code uses one of the ESP32-S3 PIE (Processor Instruction Extensions), ee.ldf.128.ip, which is not currently implemented in Wokwi.

Out of curiosity, what project are you working on?

@GiorgosXou
Copy link
Author

Out of curiosity, what project are you working on?

Thanks for asking. I'm working on my NeuralNetworks-library and while I was messing around with DSPs and SIMD-instructions for adding extensive support for other CPU-architectures^1 + while I was developing RNN support^2, I went back to wokwi to test if everything works fine (since my order never came). And that's how I found this issue, in a nutshell (:

[1]: (eg. see issue for arm_dot_prod_f32)
[2]: (for a private-company I'm recently collaborating with [not officially yet])

@urish
Copy link
Contributor

urish commented Mar 29, 2025

Thanks for explaining the use case!

Implementing the SIMD + DSP instruction simulation would take a considerable amount of effort. Is this something that would be helpful for your work?

@GiorgosXou
Copy link
Author

GiorgosXou commented Mar 29, 2025

it'd be cool, but there's no such rush at all, you don't need to. I re-ordered an ESP, so in a few days: (to be more specific about the use case) I'll be able to test a custom function I was planning to make based on those simd instructions on hardware. Stay safe ✌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants