1861261_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

1861261_en-US

1861261_en-US

Code is slower executing from tightly-coupled (ITC) memory

As an experiment, I tagged a fairly costly function with

__RAMFUNC(SRAM_ITC)

To my surprise, it ran about 10% slower. Could anyone share any insight on why that might be?

This is on an iMXRT1062, running from flash (XIP) if not running from ITC.


i.MXRT 106xRe: Code is slower executing from tightly-coupled (ITC) memory

Hello @expertsleepers,

The FPU setting for all M7 cores of the iMXRT family should be FPv5-D16. The only exception is the iMXRT1011, here it must be FPv5-SP-D16.
For the M4 and M33 cores it is also FPv5-SP-D16.

The reason why it is not faster in the ITCM than when executing from the flash is that the function is probably so small that it fits completely into the cache.
However, if the code base increases in size, cache trashing occurs. This means that the speed at which the function is executed is no longer deterministic.

Regards

Re: Code is slower executing from tightly-coupled (ITC) memory

Hello @expertsleepers,

If the function to be called is a maximum of four megabytes “away” in the address range, a direct jump “BL” can be used without veneer.

Regards

Re: Code is slower executing from tightly-coupled (ITC) memory

This was indeed it.

The full situation was:

  • The code uses a lot of double precision maths.
  • The project was set to use a single precision floating point ABI, and so was full of function calls instead of .f64 operations.
  • When the code was put in ITCM every one of those function calls went through a veneer.

Having selected a double precision ABI, the function is now twice as fast and doesn't slow down when in ITCM. It doesn't get any faster either, but I'm sure there are more mundane reasons for that.

I find it odd that the project was created with the wrong ABI - it was created from a iMXRT1062 template.

This thread was useful regarding the FP ABI:

https://community.nxp.com/t5/i-MX-RT/FPU-Type-options-for-MCUXpresso-for-double-precision-floating/m...


Re: Code is slower executing from tightly-coupled (ITC) memoryAh yes, it could be that.
Just to be clear, are function calls from ITC to other ITC functions still fast?
Re: Code is slower executing from tightly-coupled (ITC) memory

Hello @expertsleepers,

does the code you execute from the ITCM call functions that are located in flash or SDRAM/OCRAM? These are now more expensive because the compiler inserts a veneer function.
When calling Std-Lib functions, it is also not quite obvious where they are located.

Regards

Re: Code is slower executing from tightly-coupled (ITC) memory

But would that not also be true if the function was executing from flash?

The function accesses OC SRAM and external DRAM. Both will cause waits, I'm sure, but I can't see how that would make ITC slower than XIP.


Re: Code is slower executing from tightly-coupled (ITC) memory

It is possible that the function has some routine that expects data contained on another memory inducing some wait states to the execution.

Best regards,
Omar

Re: Code is slower executing from tightly-coupled (ITC) memoryI understand. Following this topic.Re: Code is slower executing from tightly-coupled (ITC) memory

Unfortunately the code in question is part of a very large project. I'd have to try to isolate it into a fresh project - which of course may not exhibit the same behaviour. I'll post if I manage to create a small test case.


Re: Code is slower executing from tightly-coupled (ITC) memoryInteresting. Would you be able to provide a test case? I'd like to reproduce this behaviour.
Tags (1)
No ratings
Version history
Last update:
‎11-21-2025 03:13 PM
Updated by: