xmos / ai_tools

AI applications and tools
Other
24 stars 10 forks source link

Add example for placing tensor arena in external RAM #906

Open andresovela opened 2 months ago

andresovela commented 2 months ago

In the same spirit as #903, it would be nice to have an example that shows how to place the tensor arena in external RAM.

If I understand correctly, this should be much easier to do than moving the weights to RAM. Looking at the two_models_one_arena example, it should be fairly simple to just add -DSHARED_TENSOR_ARENA to the APP_FLAGS in the Makefile, and add declare the array as follows

// Place in BSS - zero-initialise in bootstrap - do not occupy space in the flash image
__attribute__ ((section(".ExtMem.bss")))
uint8_t tensor_arena[LARGEST_TENSOR_ARENA_SIZE] ALIGN(8);

I'm not exactly sure if there's anything else to be done (I haven't tried this yet), but I think this would be a very valuable example to have.

panickal-xmos commented 2 months ago

Hi @andresovela, thank you for raising this and putting up an example. I'll get back to you.