Enabling Data Cache

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

Enabling Data Cache

2,396 Views
ge0rgeth0mas
Contributor II

Hi, 

I'm testing the inference time and performance of TFLite AI Models on the NXP FRDM-MCXN947 MCUs. While I'm getting good performance using the NPU, I'm getting comparably slow inference times when not using it. I have been able to reduce inference time for other MCUs by enabling the Data Cache. I would like to know how to enable D-Cache on the NXP MCUs. Any other performance boost strategies are also welcome.

Labels (2)
Tags (3)
0 Kudos
Reply
7 Replies

185 Views
Selina_Robert
Contributor I

Enabling data cache can really speed up workflows and reduce repetitive processing. For those looking to plan effectively, the Persona fusion strategy offers a clear way to anticipate outcomes and optimize results. It’s fascinating how combining the right elements can lead to unexpected efficiencies. This approach definitely makes managing complex data much more approachable.

0 Kudos
Reply

2,046 Views
Slopegame
Contributor I

Interesting! Have you experimented with compiler optimization flags? Often, bumping up optimization (e.g., -O3) can significantly speed up code when the NPU isn't active. Also, regarding D-Cache, check the SDK documentation for CACHE_Enable or similar functions, specifically for the MCXN947. Remember optimizing often comes down to a balancing act like in Slope Game, optimizing code versus hardware limitations for top performance. Good luck!

0 Kudos
Reply

2,355 Views
Trappka
Contributor I

It's great to see you exploring TFLite AI Models on the NXP FRDM-MCXN947! Enabling D-Cache can indeed enhance performance significantly. You might also look into optimizing your model size or quantizing your models for better efficiency. Speaking of performance, have you tried integrating it with gaming applications like the Snow Rider 3D game? It could be a fun way to test the capabilities of your setup!

0 Kudos
Reply

2,369 Views
ge0rgeth0mas
Contributor II

Hi Harry, 

Could CACHE64 be data cache and LPCAC be Instruction cache?

 

0 Kudos
Reply

2,369 Views
ge0rgeth0mas
Contributor II

Hi Harry, 
I was going through the reference manual and SDK drivers as you mentioned:
I noticed theres is 
* fsl_cach_lpcac.h which contains L1CACHE_EnableCodeCache()
and
* fsl_cache.h which contains CACHE64_EnableCache(CACHE64_CTRL_Type *base)

Could CACHE64 be data cache and LPCAC be Instruction cache?

0 Kudos
Reply

2,343 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @ge0rgeth0mas 

The CACHE64 module is used to cache FlexSPI accesses.

Based on  your need, you just need to enable lpcache.

BR

Harry

0 Kudos
Reply

2,382 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @ge0rgeth0mas 

You can refer to the Chapter 5 in MCX Nx4x Reference Manual.

Snipaste_2025-02-25_17-55-06.png

Regarding cache related APIs. 

You can refer to the fsl_cache_lpcac.h in MCXN947 SDK.

Snipaste_2025-02-25_17-58-52.png

 

BR

Harry