Memory Allocation

The sdscc/sds++compilers analyze your program and select data movers to match the requirements for each hardware function call between software and hardware, based on payload size, hardware interface on the accelerator, and properties of the function arguments. When the compiler can guarantee an array argument is located in physically contiguous memory, it can use the most efficient data movers. Allocating or memory-mapping arrays with the following sds_liblibrary functions can inform the compiler that memory is physically contiguous.
sds_alloc(size_t size); // guarantees physically contiguous memory sds_mmap(void *paddr, size_t size, void *vaddr); // paddr must point to contiguous memory sds_register_dmabuf(void *vaddr, int fd); // assumes physically contiguous memory
It is possible that due to the program structure, the sdscccompiler cannot definitively deduce the memory contiguity, and when this occurs, it issues a warning message, as shown:
WARNING: [SDSoC 0-0] Unable to determine the memory attributes passed to foo_arg_A of function foo at foo.cpp:102
You can inform the compiler that the data is allocated in a physically contiguous memory by inserting the following pragma immediately before the function declaration (note: the pragma does not guarantee physically contiguous allocation of memory; your code must use sds_allocto allocate such memory).
#pragma SDS data mem_attribute (A:PHYSICAL_CONTIGUOUS) // default is NON_PHYSICAL_CONTIGUOUS