feat(heap): add a MALLOC_CAP_SIMD flag

MALLOC_CAP_SIMD can be used to allocate memory to be used for SIMD instructions
This commit is contained in:
Song Ruo Jing
2024-12-06 11:39:57 +08:00
parent 4d11fe5847
commit 20eb6ca5e9
12 changed files with 70 additions and 16 deletions

View File

@@ -1,6 +1,8 @@
Heap Memory Allocation
======================
{IDF_TARGET_SIMD_PREFERRED_DATA_ALIGNMENT: default="16", esp32s3="16", esp32p4="16"}
:link_to_translation:`zh_CN:[中文]`
Stack and Heap
@@ -134,6 +136,13 @@ Memory allocated with ``MALLOC_CAP_32BIT`` can **only** be accessed via 32-bit r
On ESP32 only external SPI RAM under 4 MiB in size can be allocated this way. To use the region above the 4 MiB limit, you can use the :doc:`himem API </api-reference/system/himem>`.
.. only:: SOC_SIMD_INSTRUCTION_SUPPORTED
SIMD-Instruction-Capable Memory
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``MALLOC_CAP_SIMD`` flag can be used to allocate memory which is accessible by SIMD (Single Instruction Multiple Data) instructions. The use of this flag also aligns the memory to a SIMD preferred data alignment size ({IDF_TARGET_SIMD_PREFERRED_DATA_ALIGNMENT}-byte) for a better performance.
Thread Safety
-------------