TFLM Inference Issue: Unexpected Outputs with Large ASR Model in SDRAM (i.MX RT1170 EVK)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

TFLM Inference Issue: Unexpected Outputs with Large ASR Model in SDRAM (i.MX RT1170 EVK)

94件の閲覧回数
priyesh_shahi
Contributor I

Hello NXP Support Team,

We are experiencing an issue with inference accuracy/behavior while running a large Acoustic Speech Recognition (ASR) model using TensorFlow Lite for Microcontrollers (TFLM) on the i.MX RT1170.

Because the model and the required tensor arena exceed internal SRAM, both are explicitly placed into external SDRAM. The application runs smoothly without any memory faults or crashes, but the mathematical output of the model is incorrect.

Environment:
MCU: MIMXRT1170 (Cortex-M7)

OS: FreeRTOS

Framework: eIQ / TFLM

Memory: Model and Tensor Arena residing entirely in external SDRAM

Problem Description:
We load the model data into the external SDRAM and configure the MPU.

The TFLM MicroInterpreter is initialized, and AllocateTensors() completes successfully (kTfLiteOk).

We feed pre-computed float features into the input tensor. To ensure DMA/memory coherency, we manually invalidate the DCache for the input buffer prior to inference.

interpreter.Invoke() executes and completes successfully with no crashes or HardFaults.

The Issue: The output logits returned by the interpreter are completely incorrect (or blank) compared to running the exact same model and input data on a desktop PC.

Troubleshooting Steps Taken:
Input Verification: Verified that the byte-for-byte input data fed into the MCU tensor exactly matches the input used in our successful PC Python baseline.

Cache Management: Configured the MPU for the SDRAM region and ensured DCache is invalidated before inference so the Cortex-M7 doesn't read stale memory.

OpResolver: Verified that every TFLite operation required by the model is registered and supported.

Questions for the Team:
Are there known precision loss issues or mathematical discrepancies with NXP's TFLM implementation when heavy matrix operations execute entirely out of external SDRAM?

Does the Cortex-M7 require a specific MPU attribute configuration (e.g., Strongly Ordered vs. Normal memory) for the external SDRAM to ensure TFLM calculates the weights/activations accurately?

Are there specific eIQ hardware-accelerator flags that should be disabled if we are forcing TFLM to run operations outside of the tightly coupled memory (DTC/ITC)?

Any guidance on debugging this discrepancy between the MCU output and the PC baseline would be greatly appreciated.

Thank you,
Priyesh shahi

0 件の賞賛
返信
0 返答(返信)
%3CLINGO-SUB%20id%3D%22lingo-sub-2368080%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ETFLM%E6%8E%A8%E8%AB%96%E3%81%AE%E5%95%8F%E9%A1%8C%EF%BC%9ASDRAM%EF%BC%88i.MX%20RT1170%20EVK%EF%BC%89%E3%81%AB%E3%81%8A%E3%81%91%E3%82%8B%E5%A4%A7%E8%A6%8F%E6%A8%A1ASR%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A7%E3%81%AE%E4%BA%88%E6%9C%9F%E3%81%97%E3%81%AA%E3%81%84%E5%87%BA%E5%8A%9B%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2368080%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3ENXP%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88%E3%83%81%E3%83%BC%E3%83%A0%E3%81%AE%E7%9A%86%E6%A7%98%E3%80%81%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fi.mx%2F%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20target%3D%22_blank%22%3E%20i.MX%3C%2FA%3E%3CSPAN%3E%20RT1170%3C%2FSPAN%3E%3CSPAN%3E%20%E4%B8%8A%E3%81%A7TensorFlow%20Lite%20for%20Microcontrollers%EF%BC%88TFLM%EF%BC%89%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E5%A4%A7%E8%A6%8F%E6%A8%A1%E3%81%AA%E9%9F%B3%E9%9F%BF%E9%9F%B3%E5%A3%B0%E8%AA%8D%E8%AD%98%EF%BC%88ASR%EF%BC%89%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%A6%E3%81%84%E3%82%8B%E9%9A%9B%E3%81%AB%E3%80%81%E6%8E%A8%E8%AB%96%E7%B2%BE%E5%BA%A6%E3%82%84%E5%8B%95%E4%BD%9C%E3%81%AB%E5%95%8F%E9%A1%8C%E3%81%8C%E7%99%BA%E7%94%9F%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%20%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A8%E5%BF%85%E8%A6%81%E3%81%AA%E3%83%86%E3%83%B3%E3%82%BD%E3%83%AB%E9%A0%98%E5%9F%9F%E3%81%8C%E5%86%85%E9%83%A8SRAM%E3%81%AE%E5%AE%B9%E9%87%8F%E3%82%92%E8%B6%85%E3%81%88%E3%82%8B%E3%81%9F%E3%82%81%E3%80%81%E4%B8%A1%E6%96%B9%E3%81%A8%E3%82%82%E5%A4%96%E9%83%A8SDRAM%E3%81%AB%E6%98%8E%E7%A4%BA%E7%9A%84%E3%81%AB%E9%85%8D%E7%BD%AE%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AF%E3%83%A1%E3%83%A2%E3%83%AA%E9%9A%9C%E5%AE%B3%E3%82%84%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%82%92%E8%B5%B7%E3%81%93%E3%81%99%E3%81%93%E3%81%A8%E3%81%AA%E3%81%8F%E3%82%B9%E3%83%A0%E3%83%BC%E3%82%BA%E3%81%AB%E5%8B%95%E4%BD%9C%E3%81%97%E3%81%BE%E3%81%99%E3%81%8C%E3%80%81%E3%83%A2%E3%83%87%E3%83%AB%E3%81%AE%E6%95%B0%E5%AD%A6%E7%9A%84%E3%81%AA%E5%87%BA%E5%8A%9B%E3%81%AF%E6%AD%A3%E3%81%97%E3%81%8F%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E7%92%B0%E5%A2%83%EF%BC%9A%3C%2FSPAN%3E%3CBR%20%2F%3E%20%3CSPAN%3EMCU%3A%20MIMXRT1170%20(Cortex-M7)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%3CSPAN%3EOS%3A%20FreeRTOS%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%83%AF%E3%83%BC%E3%82%AF%EF%BC%9AeIQ%20%2F%20TFLM%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%A1%E3%83%A2%E3%83%AA%EF%BC%9A%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A8%E3%83%86%E3%83%B3%E3%82%BD%E3%83%AB%E3%82%A2%E3%83%AA%E3%83%BC%E3%83%8A%E3%81%AF%E3%81%99%E3%81%B9%E3%81%A6%E5%A4%96%E9%83%A8SDRAM%E3%81%AB%E6%A0%BC%E7%B4%8D%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E5%95%8F%E9%A1%8C%E3%81%AE%E8%AA%AC%E6%98%8E%EF%BC%9A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%A2%E3%83%87%E3%83%AB%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%A4%96%E9%83%A8SDRAM%E3%81%AB%E3%83%AD%E3%83%BC%E3%83%89%E3%81%97%E3%80%81MPU%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ETFLM%E3%83%9E%E3%82%A4%E3%82%AF%E3%83%AD%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%97%E3%83%AA%E3%82%BF%E3%81%8C%E5%88%9D%E6%9C%9F%E5%8C%96%E3%81%95%E3%82%8C%E3%80%81AllocateTensors()%E3%81%8C%E6%AD%A3%E5%B8%B8%E3%81%AB%E5%AE%8C%E4%BA%86%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%EF%BC%88kTfLiteOk%EF%BC%89%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E4%BA%8B%E5%89%8D%E3%81%AB%E8%A8%88%E7%AE%97%E3%81%95%E3%82%8C%E3%81%9F%E6%B5%AE%E5%8B%95%E5%B0%8F%E6%95%B0%E7%82%B9%E7%89%B9%E5%BE%B4%E9%87%8F%E3%82%92%E5%85%A5%E5%8A%9B%E3%83%86%E3%83%B3%E3%82%BD%E3%83%AB%E3%81%AB%E5%85%A5%E5%8A%9B%E3%81%97%E3%81%BE%E3%81%99%E3%80%82DMA%2F%E3%83%A1%E3%83%A2%E3%83%AA%E3%81%AE%E4%B8%80%E8%B2%AB%E6%80%A7%E3%82%92%E7%A2%BA%E4%BF%9D%E3%81%99%E3%82%8B%E3%81%9F%E3%82%81%E3%80%81%E6%8E%A8%E8%AB%96%E3%81%AE%E5%89%8D%E3%81%AB%E5%85%A5%E5%8A%9B%E3%83%90%E3%83%83%E3%83%95%E3%82%A1%E3%81%AEDCache%E3%82%92%E6%89%8B%E5%8B%95%E3%81%A7%E7%84%A1%E5%8A%B9%E5%8C%96%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3Einterpreter.Invoke()%20%E3%81%AF%E3%82%AF%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5%E3%82%84%E3%83%8F%E3%83%BC%E3%83%89%E3%83%95%E3%82%A9%E3%83%BC%E3%83%AB%E3%83%88%E3%82%92%E8%B5%B7%E3%81%93%E3%81%99%E3%81%93%E3%81%A8%E3%81%AA%E3%81%8F%E6%AD%A3%E5%B8%B8%E3%81%AB%E5%AE%9F%E8%A1%8C%E3%81%95%E3%82%8C%E3%80%81%E5%AE%8C%E4%BA%86%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E5%95%8F%E9%A1%8C%E7%82%B9%EF%BC%9A%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%97%E3%83%AA%E3%82%BF%E3%81%AB%E3%82%88%E3%81%A3%E3%81%A6%E8%BF%94%E3%81%95%E3%82%8C%E3%82%8B%E5%87%BA%E5%8A%9B%E3%83%AD%E3%82%B8%E3%83%83%E3%83%88%E3%81%8C%E3%80%81%E3%83%87%E3%82%B9%E3%82%AF%E3%83%88%E3%83%83%E3%83%97PC%E3%81%A7%E5%85%A8%E3%81%8F%E5%90%8C%E3%81%98%E3%83%A2%E3%83%87%E3%83%AB%E3%81%A8%E5%85%A5%E5%8A%9B%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%A8%E6%AF%94%E8%BC%83%E3%81%97%E3%81%A6%E3%80%81%E5%AE%8C%E5%85%A8%E3%81%AB%E9%96%93%E9%81%95%E3%81%A3%E3%81%A6%E3%81%84%E3%82%8B%EF%BC%88%E3%81%BE%E3%81%9F%E3%81%AF%E7%A9%BA%E7%99%BD%E3%81%A7%E3%81%82%E3%82%8B%EF%BC%89%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%88%E3%83%A9%E3%83%96%E3%83%AB%E3%82%B7%E3%83%A5%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0%E6%89%8B%E9%A0%86%EF%BC%9A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%E5%85%A5%E5%8A%9B%E6%A4%9C%E8%A8%BC%EF%BC%9AMCU%E3%83%86%E3%83%B3%E3%82%BD%E3%83%AB%E3%81%AB%E5%85%A5%E5%8A%9B%E3%81%95%E3%82%8C%E3%81%9F%E3%83%90%E3%82%A4%E3%83%88%E5%8D%98%E4%BD%8D%E3%81%AE%E5%85%A5%E5%8A%9B%E3%83%87%E3%83%BC%E3%82%BF%E3%81%8C%E3%80%81%E6%AD%A3%E5%B8%B8%E3%81%AB%E5%8B%95%E4%BD%9C%E3%81%97%E3%81%9FPC%20Python%E3%83%99%E3%83%BC%E3%82%B9%E3%83%A9%E3%82%A4%E3%83%B3%E3%81%A7%E4%BD%BF%E7%94%A8%E3%81%95%E3%82%8C%E3%81%9F%E5%85%A5%E5%8A%9B%E3%83%87%E3%83%BC%E3%82%BF%E3%81%A8%E5%AE%8C%E5%85%A8%E3%81%AB%E4%B8%80%E8%87%B4%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%82%AD%E3%83%A3%E3%83%83%E3%82%B7%E3%83%A5%E7%AE%A1%E7%90%86%EF%BC%9ASDRAM%E9%A0%98%E5%9F%9F%E7%94%A8%E3%81%ABMPU%E3%82%92%E8%A8%AD%E5%AE%9A%E3%81%97%E3%80%81%E6%8E%A8%E8%AB%96%E5%89%8D%E3%81%ABDCache%E3%81%8C%E7%84%A1%E5%8A%B9%E5%8C%96%E3%81%95%E3%82%8C%E3%82%8B%E3%82%88%E3%81%86%E3%81%AB%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%A7%E3%80%81Cortex-M7%E3%81%8C%E5%8F%A4%E3%81%84%E3%83%A1%E3%83%A2%E3%83%AA%E3%82%92%E8%AA%AD%E3%81%BF%E5%8F%96%E3%82%89%E3%81%AA%E3%81%84%E3%82%88%E3%81%86%E3%81%AB%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EOpResolver%3A%20%E3%83%A2%E3%83%87%E3%83%AB%E3%81%AB%E5%BF%85%E8%A6%81%E3%81%AA%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%20TFLite%20%E6%93%8D%E4%BD%9C%E3%81%8C%E7%99%BB%E9%8C%B2%E3%81%95%E3%82%8C%E3%80%81%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B%E3%81%93%E3%81%A8%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%81%E3%83%BC%E3%83%A0%E3%81%B8%E3%81%AE%E8%B3%AA%E5%95%8F%EF%BC%9A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ENXP%E3%81%AETFLM%E5%AE%9F%E8%A3%85%E3%81%AB%E3%81%8A%E3%81%84%E3%81%A6%E3%80%81%E5%A4%A7%E8%A6%8F%E6%A8%A1%E3%81%AA%E3%83%9E%E3%83%88%E3%83%AA%E3%83%83%E3%82%AF%E3%82%B9%E6%BC%94%E7%AE%97%E3%82%92%E5%A4%96%E9%83%A8SDRAM%E3%81%AE%E3%81%BF%E3%81%A7%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88%E3%80%81%E6%97%A2%E7%9F%A5%E3%81%AE%E7%B2%BE%E5%BA%A6%E6%90%8D%E5%A4%B1%E5%95%8F%E9%A1%8C%E3%82%84%E6%95%B0%E5%AD%A6%E7%9A%84%E3%81%AA%E4%B8%8D%E4%B8%80%E8%87%B4%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ECortex-M7%E3%81%A7%E3%81%AF%E3%80%81TFLM%E3%81%8C%E9%87%8D%E3%81%BF%2F%E6%B4%BB%E6%80%A7%E5%8C%96%E3%82%92%E6%AD%A3%E7%A2%BA%E3%81%AB%E8%A8%88%E7%AE%97%E3%81%A7%E3%81%8D%E3%82%8B%E3%82%88%E3%81%86%E3%81%AB%E3%81%99%E3%82%8B%E3%81%9F%E3%82%81%E3%81%AB%E3%80%81%E5%A4%96%E9%83%A8SDRAM%E3%81%AB%E5%AF%BE%E3%81%97%E3%81%A6%E7%89%B9%E5%AE%9A%E3%81%AEMPU%E5%B1%9E%E6%80%A7%E6%A7%8B%E6%88%90%EF%BC%88%E4%BE%8B%EF%BC%9A%E5%BC%B7%E9%A0%86%E5%BA%8F%E3%83%A1%E3%83%A2%E3%83%AA%E5%AF%BE%E9%80%9A%E5%B8%B8%E3%83%A1%E3%83%A2%E3%83%AA%EF%BC%89%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%A7%E3%81%99%E3%81%8B%EF%BC%9F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%3CSPAN%3ETFLM%E3%81%AB%E5%AF%86%E7%B5%90%E5%90%88%E3%83%A1%E3%83%A2%E3%83%AA%EF%BC%88DTC%2FITC%EF%BC%89%E5%A4%96%E3%81%A7%E3%81%AE%E6%93%8D%E4%BD%9C%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%95%E3%81%9B%E3%82%8B%E5%A0%B4%E5%90%88%E3%80%81%E7%84%A1%E5%8A%B9%E3%81%AB%E3%81%99%E3%81%B9%E3%81%8DeIQ%E3%83%8F%E3%83%BC%E3%83%89%E3%82%A6%E3%82%A7%E3%82%A2%E3%82%A2%E3%82%AF%E3%82%BB%E3%83%A9%E3%83%AC%E3%83%BC%E3%82%BF%E3%81%AE%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%95%E3%83%A9%E3%82%B0%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EMCU%E3%81%AE%E5%87%BA%E5%8A%9B%E3%81%A8PC%E3%81%AE%E5%9F%BA%E6%BA%96%E5%80%A4%E3%81%A8%E3%81%AE%E9%96%93%E3%81%AE%E3%81%93%E3%81%AE%E4%B8%8D%E4%B8%80%E8%87%B4%E3%82%92%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%81%99%E3%82%8B%E3%81%9F%E3%82%81%E3%81%AE%E3%82%A2%E3%83%89%E3%83%90%E3%82%A4%E3%82%B9%E3%82%92%E3%81%84%E3%81%9F%E3%81%A0%E3%81%91%E3%82%8C%E3%81%B0%E5%A4%A7%E5%A4%89%E3%81%82%E3%82%8A%E3%81%8C%E3%81%9F%E3%81%84%E3%81%A7%E3%81%99%E3%80%82%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%81%82%E3%82%8A%E3%81%8C%E3%81%A8%E3%81%86%E3%80%81%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3E%E3%83%97%E3%83%AA%E3%82%A4%E3%82%A7%E3%82%B7%E3%83%A5%E3%83%BB%E3%82%B7%E3%83%A3%E3%83%92%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E