<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: TFLM Inference Issue: Unexpected Outputs with Large ASR Model in SDRAM (i.MX RT1170 EVK) in Other NXP Products</title>
    <link>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2378300#M32526</link>
    <description>&lt;P&gt;Hi Edwin,&lt;/P&gt;&lt;P&gt;We have successfully isolated the issue and can confirm it is a mathematical corruption bug within the CMSIS-NN optimized kernels (specifically affecting dilated convolutions, which our ASR model relies on heavily).&lt;/P&gt;&lt;P&gt;Our Proof:&lt;BR /&gt;1. We recompiled "libtflm.a" using purely standard C++ Reference Kernels (omitting the "cmsis_nn" directory during compilation) while keeping our SDRAM cache active and using safe DTCM buffers for DMA transfers.&lt;BR /&gt;2. With CMSIS-NN bypassed, the model immediately began successfully decoding correct speech tokens. For example, Chunk 7 correctly outputs "[ easy]", and Chunk 10 correctly outputs "[ ch]".&lt;BR /&gt;3. When we revert back to the precompiled CMSIS-NN library, the execution speed drops to 537 ms, but the output is completely corrupted back to empty brackets across all chunks.&lt;/P&gt;&lt;P&gt;This confirms our memory setup, cache configuration, and DMA buffers are completely correct, and that a mathematical error is occurring within the CMSIS-NN optimized convolution/depthwise convolution paths when processing non-unity dilation (dilation rate greater than 1).&lt;/P&gt;&lt;P&gt;Our Questions:&lt;BR /&gt;- Which version of the eIQ SDK / CMSIS-NN middleware contains the official bugfix for dilated convolutions (dilation rate greater than 1) in arm_convolve_s8 and arm_depthwise_conv_s8?&lt;BR /&gt;- Can you provide us with a patch or updated libtflm.a that has corrected CMSIS-NN kernels so we can achieve both full accuracy and the optimized 537 ms inference speed?&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Priyesh shahi&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2026 10:37:18 GMT</pubDate>
    <dc:creator>priyesh_shahi</dc:creator>
    <dc:date>2026-06-08T10:37:18Z</dc:date>
    <item>
      <title>TFLM Inference Issue: Unexpected Outputs with Large ASR Model in SDRAM (i.MX RT1170 EVK)</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2368080#M32130</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello NXP Support Team,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://i.mx/" rel="noopener" target="_blank"&gt;i.MX&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;RT1170.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Environment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MCU: MIMXRT1170 (Cortex-M7)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OS: FreeRTOS&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Framework: eIQ / TFLM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Memory: Model and Tensor Arena residing entirely in external SDRAM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Problem Description:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We load the model data into the external SDRAM and configure the MPU.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The TFLM MicroInterpreter is initialized, and AllocateTensors() completes successfully (kTfLiteOk).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;interpreter.Invoke() executes and completes successfully with no crashes or HardFaults.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Troubleshooting Steps Taken:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OpResolver: Verified that every TFLite operation required by the model is registered and supported.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Questions for the Team:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there known precision loss issues or mathematical discrepancies with NXP's TFLM implementation when heavy matrix operations execute entirely out of external SDRAM?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any guidance on debugging this discrepancy between the MCU output and the PC baseline would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Priyesh shahi&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2026 05:08:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2368080#M32130</guid>
      <dc:creator>priyesh_shahi</dc:creator>
      <dc:date>2026-05-20T05:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: TFLM Inference Issue: Unexpected Outputs with Large ASR Model in SDRAM (i.MX RT1170 EVK)</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2374636#M32422</link>
      <description>&lt;P&gt;Hi&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;From the description you shared, it seems like the issue would likely be related to a cache coherency issue rather than to a numerical precision limitation. Rather than invalidating&amp;nbsp;the DCache for the input buffer prior to inference, I recommend&amp;nbsp;using non-cacheable regions for shared/DMA-updated buffers. The following application note describes in more detail how to set up and use non-cacheable memory regions:&amp;nbsp;&lt;A href="https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs-Knowledge/Using-NonCached-Memory-on-i-MXRT/ta-p/1183369" target="_blank"&gt;Using NonCached Memory on i.MXRT&lt;/A&gt;. Please try using this method instead and let me know if it helps.&lt;/P&gt;
&lt;P&gt;Addressing your specific questions:&lt;/P&gt;
&lt;P&gt;1. We do not have any documented data that describes precision loss issues when implementing heavy matrix operations entirely on an external SDRAM.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;For external SDRAM used as normal data configuring it as normal memory would be the recommendation in order to ensure it can be configured as non-cacheable.&lt;/P&gt;
&lt;P&gt;3. There isn't any specific accelerator flags documented as the correct path to ensure proper execution of the TFLM operations outside the internal RAM. This is another reason why the issue is more likely related to the cache memory handling rather than the actual operation of the model.&lt;/P&gt;
&lt;P&gt;BR,&lt;BR /&gt;Edwin.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2026 22:20:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2374636#M32422</guid>
      <dc:creator>EdwinHz</dc:creator>
      <dc:date>2026-06-01T22:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: TFLM Inference Issue: Unexpected Outputs with Large ASR Model in SDRAM (i.MX RT1170 EVK)</title>
      <link>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2378300#M32526</link>
      <description>&lt;P&gt;Hi Edwin,&lt;/P&gt;&lt;P&gt;We have successfully isolated the issue and can confirm it is a mathematical corruption bug within the CMSIS-NN optimized kernels (specifically affecting dilated convolutions, which our ASR model relies on heavily).&lt;/P&gt;&lt;P&gt;Our Proof:&lt;BR /&gt;1. We recompiled "libtflm.a" using purely standard C++ Reference Kernels (omitting the "cmsis_nn" directory during compilation) while keeping our SDRAM cache active and using safe DTCM buffers for DMA transfers.&lt;BR /&gt;2. With CMSIS-NN bypassed, the model immediately began successfully decoding correct speech tokens. For example, Chunk 7 correctly outputs "[ easy]", and Chunk 10 correctly outputs "[ ch]".&lt;BR /&gt;3. When we revert back to the precompiled CMSIS-NN library, the execution speed drops to 537 ms, but the output is completely corrupted back to empty brackets across all chunks.&lt;/P&gt;&lt;P&gt;This confirms our memory setup, cache configuration, and DMA buffers are completely correct, and that a mathematical error is occurring within the CMSIS-NN optimized convolution/depthwise convolution paths when processing non-unity dilation (dilation rate greater than 1).&lt;/P&gt;&lt;P&gt;Our Questions:&lt;BR /&gt;- Which version of the eIQ SDK / CMSIS-NN middleware contains the official bugfix for dilated convolutions (dilation rate greater than 1) in arm_convolve_s8 and arm_depthwise_conv_s8?&lt;BR /&gt;- Can you provide us with a patch or updated libtflm.a that has corrected CMSIS-NN kernels so we can achieve both full accuracy and the optimized 537 ms inference speed?&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Priyesh shahi&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2026 10:37:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Other-NXP-Products/TFLM-Inference-Issue-Unexpected-Outputs-with-Large-ASR-Model-in/m-p/2378300#M32526</guid>
      <dc:creator>priyesh_shahi</dc:creator>
      <dc:date>2026-06-08T10:37:18Z</dc:date>
    </item>
  </channel>
</rss>

