Generated module
A conversion writes a self-contained module: the emitted C, the headers a firmware project includes, and the build file its build system reads. What follows is the module produced from one small fixture model, so the shapes and the file names are real rather than illustrative.
| Fixture setting | Value |
|---|---|
| Module name | demo |
| Symbol prefix | aot |
| Operators | CONV_2D → MAX_POOL_2D → CONV_2D → AVERAGE_POOL_2D → RESHAPE → SVDF → FULLY_CONNECTED → SOFTMAX |
| Target | apollo510_evb |
Module types
Section titled “Module types”The module.type setting decides the build system the module is written for. The tree is the same module in each case; the build files and the placement differ.
zephyr
Section titled “zephyr”| Property | Value |
|---|---|
| Module root | demo |
| Build manifest | zephyr/CMakeLists.txt, zephyr/Kconfig, zephyr/module.yml |
| Files | 38 |
LICENSEREADME.mdaot_plan.jsonaot_report.jsonaot_residency.json # only with memory.dump_residency_jsonincludes-api/aot_average_pool_2d_3.hincludes-api/aot_common.hincludes-api/aot_context.hincludes-api/aot_conv_2d_0.hincludes-api/aot_conv_2d_2.hincludes-api/aot_fully_connected_6.hincludes-api/aot_kernels.hincludes-api/aot_max_pool_2d_1.hincludes-api/aot_model.hincludes-api/aot_operators.hincludes-api/aot_platform.hincludes-api/aot_reshape_4.hincludes-api/aot_softmax_7.hincludes-api/aot_svdf_5.hincludes-api/aot_tensors.hincludes-api/aot_test_case.h # only with test.enabledsrc/aot_average_pool_2d_3.csrc/aot_constants.csrc/aot_context.csrc/aot_conv_2d_0.csrc/aot_conv_2d_2.csrc/aot_fully_connected_6.csrc/aot_kernels.csrc/aot_max_pool_2d_1.csrc/aot_model.csrc/aot_reshape_4.csrc/aot_softmax_7.csrc/aot_svdf_5.csrc/aot_tensors.csrc/aot_test_case.c # only with test.enabledzephyr/CMakeLists.txtzephyr/Kconfigzephyr/module.yml| Property | Value |
|---|---|
| Module root | demo |
| Build manifest | CMakeLists.txt |
| Files | 36 |
CMakeLists.txtLICENSEREADME.mdaot_plan.jsonaot_report.jsonaot_residency.json # only with memory.dump_residency_jsonincludes-api/aot_average_pool_2d_3.hincludes-api/aot_common.hincludes-api/aot_context.hincludes-api/aot_conv_2d_0.hincludes-api/aot_conv_2d_2.hincludes-api/aot_fully_connected_6.hincludes-api/aot_kernels.hincludes-api/aot_max_pool_2d_1.hincludes-api/aot_model.hincludes-api/aot_operators.hincludes-api/aot_platform.hincludes-api/aot_reshape_4.hincludes-api/aot_softmax_7.hincludes-api/aot_svdf_5.hincludes-api/aot_tensors.hincludes-api/aot_test_case.h # only with test.enabledsrc/aot_average_pool_2d_3.csrc/aot_constants.csrc/aot_context.csrc/aot_conv_2d_0.csrc/aot_conv_2d_2.csrc/aot_fully_connected_6.csrc/aot_kernels.csrc/aot_max_pool_2d_1.csrc/aot_model.csrc/aot_reshape_4.csrc/aot_softmax_7.csrc/aot_svdf_5.csrc/aot_tensors.csrc/aot_test_case.c # only with test.enabled| Variant | Settings | Adds | Removes |
|---|---|---|---|
external_arenas |
memory.allocate_arenas=false, memory.dump_residency_json=true, test.enabled=true |
aot_arena_const_dtcm__blob.bin |
— |
| Variant | Settings | Adds | Removes |
|---|---|---|---|
streamed |
memory.allocate_arenas=true, memory.dump_residency_json=true, memory.stream_pool.bytes=16384, memory.stream_pool.memory=dtcm, test.enabled=true |
— | — |
| Variant | Settings | Adds | Removes |
|---|---|---|---|
streamed_dma |
memory.allocate_arenas=true, memory.dump_residency_json=true, memory.stream_pool.bytes=16384, memory.stream_pool.memory=dtcm, memory.tensors=[{type: constant, attributes: {memory: PSRAM, residency: stream}}], optimization.plan=<the conversion's plan with a schedule of dma units>, test.enabled=true |
includes-api/aot_fully_connected_0.h, includes-api/aot_fully_connected_1.h, includes-api/aot_fully_connected_2.h, includes-api/aot_fully_connected_3.h, src/aot_fully_connected_0.c, src/aot_fully_connected_1.c, src/aot_fully_connected_2.c, src/aot_fully_connected_3.c |
includes-api/aot_average_pool_2d_3.h, includes-api/aot_conv_2d_0.h, includes-api/aot_conv_2d_2.h, includes-api/aot_fully_connected_6.h, includes-api/aot_kernels.h, includes-api/aot_max_pool_2d_1.h, includes-api/aot_reshape_4.h, includes-api/aot_softmax_7.h, includes-api/aot_svdf_5.h, src/aot_average_pool_2d_3.c, src/aot_conv_2d_0.c, src/aot_conv_2d_2.c, src/aot_fully_connected_6.c, src/aot_kernels.c, src/aot_max_pool_2d_1.c, src/aot_reshape_4.c, src/aot_softmax_7.c, src/aot_svdf_5.c |
| Property | Value |
|---|---|
| Module root | demo |
| Build manifest | CMakeLists.txt, nsx-module.yaml |
| Files | 37 |
CMakeLists.txtLICENSEREADME.mdaot_plan.jsonaot_report.jsonaot_residency.json # only with memory.dump_residency_jsonincludes-api/aot_average_pool_2d_3.hincludes-api/aot_common.hincludes-api/aot_context.hincludes-api/aot_conv_2d_0.hincludes-api/aot_conv_2d_2.hincludes-api/aot_fully_connected_6.hincludes-api/aot_kernels.hincludes-api/aot_max_pool_2d_1.hincludes-api/aot_model.hincludes-api/aot_operators.hincludes-api/aot_platform.hincludes-api/aot_reshape_4.hincludes-api/aot_softmax_7.hincludes-api/aot_svdf_5.hincludes-api/aot_tensors.hincludes-api/aot_test_case.h # only with test.enablednsx-module.yamlsrc/aot_average_pool_2d_3.csrc/aot_constants.csrc/aot_context.csrc/aot_conv_2d_0.csrc/aot_conv_2d_2.csrc/aot_fully_connected_6.csrc/aot_kernels.csrc/aot_max_pool_2d_1.csrc/aot_model.csrc/aot_reshape_4.csrc/aot_softmax_7.csrc/aot_svdf_5.csrc/aot_tensors.csrc/aot_test_case.c # only with test.enabled| Variant | Settings | Adds | Removes |
|---|---|---|---|
external_arenas |
memory.allocate_arenas=false, memory.dump_residency_json=true, test.enabled=true |
aot_arena_const_dtcm__blob.bin |
— |
| Variant | Settings | Adds | Removes |
|---|---|---|---|
streamed |
memory.allocate_arenas=true, memory.dump_residency_json=true, memory.stream_pool.bytes=16384, memory.stream_pool.memory=dtcm, test.enabled=true |
— | — |
| Variant | Settings | Adds | Removes |
|---|---|---|---|
streamed_dma |
memory.allocate_arenas=true, memory.dump_residency_json=true, memory.stream_pool.bytes=16384, memory.stream_pool.memory=dtcm, memory.tensors=[{type: constant, attributes: {memory: PSRAM, residency: stream}}], optimization.plan=<the conversion's plan with a schedule of dma units>, test.enabled=true |
includes-api/aot_fully_connected_0.h, includes-api/aot_fully_connected_1.h, includes-api/aot_fully_connected_2.h, includes-api/aot_fully_connected_3.h, includes-api/aot_nsx_transfer.h, src/aot_fully_connected_0.c, src/aot_fully_connected_1.c, src/aot_fully_connected_2.c, src/aot_fully_connected_3.c, src/aot_nsx_transfer.c |
includes-api/aot_average_pool_2d_3.h, includes-api/aot_conv_2d_0.h, includes-api/aot_conv_2d_2.h, includes-api/aot_fully_connected_6.h, includes-api/aot_kernels.h, includes-api/aot_max_pool_2d_1.h, includes-api/aot_reshape_4.h, includes-api/aot_softmax_7.h, includes-api/aot_svdf_5.h, src/aot_average_pool_2d_3.c, src/aot_conv_2d_0.c, src/aot_conv_2d_2.c, src/aot_fully_connected_6.c, src/aot_kernels.c, src/aot_max_pool_2d_1.c, src/aot_reshape_4.c, src/aot_softmax_7.c, src/aot_svdf_5.c |
cmsis_pack
Section titled “cmsis_pack”| Property | Value |
|---|---|
| Module root | demo |
| Build manifest | Ambiq.demo.pdsc |
| Files | 36 |
Ambiq.demo.pdscLICENSEREADME.mdaot_plan.jsonaot_report.jsonaot_residency.json # only with memory.dump_residency_jsonincludes-api/aot_average_pool_2d_3.hincludes-api/aot_common.hincludes-api/aot_context.hincludes-api/aot_conv_2d_0.hincludes-api/aot_conv_2d_2.hincludes-api/aot_fully_connected_6.hincludes-api/aot_kernels.hincludes-api/aot_max_pool_2d_1.hincludes-api/aot_model.hincludes-api/aot_operators.hincludes-api/aot_platform.hincludes-api/aot_reshape_4.hincludes-api/aot_softmax_7.hincludes-api/aot_svdf_5.hincludes-api/aot_tensors.hincludes-api/aot_test_case.h # only with test.enabledsrc/aot_average_pool_2d_3.csrc/aot_constants.csrc/aot_context.csrc/aot_conv_2d_0.csrc/aot_conv_2d_2.csrc/aot_fully_connected_6.csrc/aot_kernels.csrc/aot_max_pool_2d_1.csrc/aot_model.csrc/aot_reshape_4.csrc/aot_softmax_7.csrc/aot_svdf_5.csrc/aot_tensors.csrc/aot_test_case.c # only with test.enabledPublic C API
Section titled “Public C API”Start with the generated model header and its model_init/model_run entry points. Check initialization and run status before using I/O views. Initialization resets persistent state and hydrates staged constants before operator initialization; repeated runs carry state until reset. Arena bindings and hydration state are module-global, so two context structs do not create independent instances. Serialize module use and keep arena storage alive.
Every declaration below, and every field and member, carries the stability the compatibility page gives it. public is the application interface: the entry points, the context’s callback, user_data, inputs and outputs, the status codes, the I/O tables, the platform hooks, the test-case entry points and the API version macros. advanced is arena binding, hydration and the arena tables, and in a module with a stream pool the pool region, the transfer counts and the transfer provider. internal is implementation: the operator wrappers, the kernel helpers and state such as _lifecycle_state and tensor_ptrs, which an application must not use. Test-case functions exist only when tests are enabled. See Firmware integration and Memory placement for complete usage.
Fixture declaration inventory
Section titled “Fixture declaration inventory”aot_average_pool_2d_3.h
Section titled “aot_average_pool_2d_3.h”Declared in includes-api/aot_average_pool_2d_3.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_average_pool_2d_3_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_average_pool_2d_3_run(aot_model_context_t *ctx) |
internal | always |
aot_context.h
Section titled “aot_context.h”Declared in includes-api/aot_context.h. Integration header; its file name is promised.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_context_init(aot_model_context_t *ctx) |
advanced | always |
aot_operator_state_t (public)
| Member | Value | Stability |
|---|---|---|
aot_op_state_init_started |
0 |
public |
aot_op_state_init_finished |
next | public |
aot_op_state_run_started |
next | public |
aot_op_state_run_finished |
next | public |
aot_model_context_t (public)
| Field | Type | Extent | Stability |
|---|---|---|---|
callback |
aot_operator_callback |
— | public |
user_data |
void * |
— | public |
arena_buffers |
const void * const * |
— | advanced |
arena_sizes |
const size_t * |
— | advanced |
_lifecycle_state |
uint32_t |
— | internal |
tensor_ptrs |
int8_t * |
aot_num_tensors |
internal |
inputs |
aot_tensor_io_t |
aot_num_inputs |
public |
outputs |
aot_tensor_io_t |
aot_num_outputs |
public |
aot_operator_callback (public)
| Signature | Kind |
|---|---|
void (*aot_operator_callback)(int32_t op, aot_operator_state_t state, int32_t status, void *user_data) |
function pointer |
aot_conv_2d_0.h
Section titled “aot_conv_2d_0.h”Declared in includes-api/aot_conv_2d_0.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_conv_2d_0_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_conv_2d_0_run(aot_model_context_t *ctx) |
internal | always |
aot_conv_2d_2.h
Section titled “aot_conv_2d_2.h”Declared in includes-api/aot_conv_2d_2.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_conv_2d_2_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_conv_2d_2_run(aot_model_context_t *ctx) |
internal | always |
aot_fully_connected_0.h
Section titled “aot_fully_connected_0.h”Declared in includes-api/aot_fully_connected_0.h. Implementation header; its file name can change in any release.
aot_fully_connected_1.h
Section titled “aot_fully_connected_1.h”Declared in includes-api/aot_fully_connected_1.h. Implementation header; its file name can change in any release.
aot_fully_connected_2.h
Section titled “aot_fully_connected_2.h”Declared in includes-api/aot_fully_connected_2.h. Implementation header; its file name can change in any release.
aot_fully_connected_3.h
Section titled “aot_fully_connected_3.h”Declared in includes-api/aot_fully_connected_3.h. Implementation header; its file name can change in any release.
aot_fully_connected_6.h
Section titled “aot_fully_connected_6.h”Declared in includes-api/aot_fully_connected_6.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_fully_connected_6_run(aot_model_context_t *ctx) |
internal | always |
aot_kernels.h
Section titled “aot_kernels.h”Declared in includes-api/aot_kernels.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_kernel_fc_per_channel_packed_s8(aot_model_context_t *ctx, const aot_fc_per_channel_packed_s8_desc_t *d) |
internal | always |
aot_fc_per_channel_packed_s8_desc_t (internal)
| Field | Type | Extent | Stability |
|---|---|---|---|
input_id |
int32_t |
— | internal |
output_id |
int32_t |
— | internal |
packed_id |
int32_t |
— | internal |
input_dims |
cmsis_nn_dims |
— | internal |
filter_dims |
cmsis_nn_dims |
— | internal |
output_dims |
cmsis_nn_dims |
— | internal |
output_offset |
int32_t |
— | internal |
activation_min |
int32_t |
— | internal |
activation_max |
int32_t |
— | internal |
aot_max_pool_2d_1.h
Section titled “aot_max_pool_2d_1.h”Declared in includes-api/aot_max_pool_2d_1.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_max_pool_2d_1_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_max_pool_2d_1_run(aot_model_context_t *ctx) |
internal | always |
aot_model.h
Section titled “aot_model.h”Declared in includes-api/aot_model.h. Integration header; its file name is promised.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_model_init(aot_model_context_t *ctx) |
public | always |
int32_t aot_model_run(aot_model_context_t *ctx) |
public | always |
Macros
| Macro | Value | Stability | Defined when |
|---|---|---|---|
AOT_API_VERSION_MAJOR |
2 |
public | always |
AOT_API_VERSION_MINOR |
1 |
public | always |
AOT_API_VERSION_PATCH |
0 |
public | always |
aot_nsx_transfer.h
Section titled “aot_nsx_transfer.h”Declared in includes-api/aot_nsx_transfer.h. Implementation header; its file name can change in any release.
aot_platform.h
Section titled “aot_platform.h”Declared in includes-api/aot_platform.h. Integration header; its file name is promised.
Macros
| Macro | Value | Stability | Defined when |
|---|---|---|---|
AOT_PUT_IN_DRAM |
— | public | !defined(AOT_PUT_IN_DRAM) |
AOT_PUT_IN_DRAM_INIT |
— | public | !defined(AOT_PUT_IN_DRAM_INIT) |
AOT_PUT_IN_HBLRAM |
— | public | !defined(AOT_PUT_IN_HBLRAM) |
AOT_PUT_IN_HBLRAM_INIT |
— | public | !defined(AOT_PUT_IN_HBLRAM_INIT) |
AOT_PUT_IN_MRAM_INIT |
— | public | !defined(AOT_PUT_IN_MRAM_INIT) |
AOT_PUT_IN_PSRAM |
— | public | !defined(AOT_PUT_IN_PSRAM) |
AOT_PUT_IN_PSRAM_INIT |
— | public | !defined(AOT_PUT_IN_PSRAM_INIT) |
AOT_PUT_IN_SRAM |
— | public | !defined(AOT_PUT_IN_SRAM) |
AOT_PUT_IN_SRAM_INIT |
— | public | !defined(AOT_PUT_IN_SRAM_INIT) |
Macros that differ by module type
| Macro | Module type | Value | Stability | Defined when |
|---|---|---|---|---|
AOT_PRINTF(...) |
zephyr |
printk(__VA_ARGS__) |
public | (!defined(AOT_PRINTF)) && (defined(CONFIG_PRINTK)) |
AOT_PRINTF(...) |
zephyr |
((void)0) |
public | (!defined(AOT_PRINTF)) && (!(defined(CONFIG_PRINTK))) |
AOT_PRINTF(...) |
cmake |
((void)0) |
public | !defined(AOT_PRINTF) |
AOT_PRINTF(...) |
nsx |
((void)0) |
public | !defined(AOT_PRINTF) |
AOT_PRINTF(...) |
cmsis_pack |
((void)0) |
public | !defined(AOT_PRINTF) |
AOT_PUT_CODE_IN_ITCM |
zephyr |
__itcm_section |
public | !defined(AOT_PUT_CODE_IN_ITCM) |
AOT_PUT_CODE_IN_ITCM |
cmake |
— | public | !defined(AOT_PUT_CODE_IN_ITCM) |
AOT_PUT_CODE_IN_ITCM |
nsx |
__attribute__((section(".itcm_text"))) |
public | (!defined(AOT_PUT_CODE_IN_ITCM)) && (defined(__GNUC__) || defined(__clang__) || defined(__ARMCC_VERSION)) |
AOT_PUT_CODE_IN_ITCM |
nsx |
— | public | (!defined(AOT_PUT_CODE_IN_ITCM)) && (!(defined(__GNUC__) || defined(__clang__) || defined(__ARMCC_VERSION))) |
AOT_PUT_CODE_IN_ITCM |
cmsis_pack |
— | public | !defined(AOT_PUT_CODE_IN_ITCM) |
AOT_PUT_IN_DTCM |
zephyr |
__dtcm_bss_section |
public | !defined(AOT_PUT_IN_DTCM) |
AOT_PUT_IN_DTCM |
cmake |
— | public | !defined(AOT_PUT_IN_DTCM) |
AOT_PUT_IN_DTCM |
nsx |
— | public | !defined(AOT_PUT_IN_DTCM) |
AOT_PUT_IN_DTCM |
cmsis_pack |
— | public | !defined(AOT_PUT_IN_DTCM) |
AOT_PUT_IN_DTCM_INIT |
zephyr |
__dtcm_data_section |
public | !defined(AOT_PUT_IN_DTCM_INIT) |
AOT_PUT_IN_DTCM_INIT |
cmake |
— | public | !defined(AOT_PUT_IN_DTCM_INIT) |
AOT_PUT_IN_DTCM_INIT |
nsx |
— | public | !defined(AOT_PUT_IN_DTCM_INIT) |
AOT_PUT_IN_DTCM_INIT |
cmsis_pack |
— | public | !defined(AOT_PUT_IN_DTCM_INIT) |
AOT_PUT_IN_ITCM |
zephyr |
__itcm_section |
public | !defined(AOT_PUT_IN_ITCM) |
AOT_PUT_IN_ITCM |
cmake |
— | public | !defined(AOT_PUT_IN_ITCM) |
AOT_PUT_IN_ITCM |
nsx |
— | public | !defined(AOT_PUT_IN_ITCM) |
AOT_PUT_IN_ITCM |
cmsis_pack |
— | public | !defined(AOT_PUT_IN_ITCM) |
AOT_PUT_IN_ITCM_INIT |
zephyr |
__itcm_section |
public | !defined(AOT_PUT_IN_ITCM_INIT) |
AOT_PUT_IN_ITCM_INIT |
cmake |
— | public | !defined(AOT_PUT_IN_ITCM_INIT) |
AOT_PUT_IN_ITCM_INIT |
nsx |
— | public | !defined(AOT_PUT_IN_ITCM_INIT) |
AOT_PUT_IN_ITCM_INIT |
cmsis_pack |
— | public | !defined(AOT_PUT_IN_ITCM_INIT) |
AOT_PUT_IN_MRAM |
zephyr |
const |
public | !defined(AOT_PUT_IN_MRAM) |
AOT_PUT_IN_MRAM |
cmake |
— | public | !defined(AOT_PUT_IN_MRAM) |
AOT_PUT_IN_MRAM |
nsx |
— | public | !defined(AOT_PUT_IN_MRAM) |
AOT_PUT_IN_MRAM |
cmsis_pack |
— | public | !defined(AOT_PUT_IN_MRAM) |
aot_reshape_4.h
Section titled “aot_reshape_4.h”Declared in includes-api/aot_reshape_4.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_reshape_4_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_reshape_4_run(aot_model_context_t *ctx) |
internal | always |
aot_softmax_7.h
Section titled “aot_softmax_7.h”Declared in includes-api/aot_softmax_7.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_softmax_7_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_softmax_7_run(aot_model_context_t *ctx) |
internal | always |
aot_svdf_5.h
Section titled “aot_svdf_5.h”Declared in includes-api/aot_svdf_5.h. Implementation header; its file name can change in any release.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_svdf_5_init(aot_model_context_t *ctx) |
internal | always |
int32_t aot_svdf_5_run(aot_model_context_t *ctx) |
internal | always |
aot_tensors.h
Section titled “aot_tensors.h”Declared in includes-api/aot_tensors.h. Integration header; its file name is promised.
aot_arena_region_t (advanced)
| Member | Value | Stability |
|---|---|---|
aot_arena_dtcm |
0 |
advanced |
aot_arena_persistent_dtcm |
1 |
advanced |
aot_arena_const_dtcm |
2 |
advanced |
aot_num_arena_buffers |
3 |
advanced |
aot_status_t (public)
| Member | Value | Stability |
|---|---|---|
aot_status_ok |
0 |
public |
aot_status_bind_unknown_region |
1 |
public |
aot_status_bind_null_buffer |
2 |
public |
aot_status_bind_undersized |
3 |
public |
aot_status_bind_misaligned |
4 |
public |
aot_status_context_arena_unbound |
10 |
public |
aot_status_hydrate_uninited_context |
11 |
public |
aot_status_hydrate_null_blob |
12 |
public |
aot_status_null_context |
13 |
public |
aot_status_not_initialized |
14 |
public |
aot_status_bind_bulk_null_argument |
100 |
public |
aot_status_bind_bulk_wrong_count |
101 |
public |
aot_status_hydration_required |
200 |
public |
aot_status_custom_first |
1000 |
public |
aot_status_custom_last |
1999 |
public |
aot_tensor_ident_t (public)
| Member | Value | Stability |
|---|---|---|
aot_tensor_0 |
0 |
internal |
aot_tensor_1 |
1 |
internal |
aot_tensor_3 |
2 |
internal |
aot_tensor_4 |
3 |
internal |
aot_tensor_5 |
4 |
internal |
aot_tensor_7 |
5 |
internal |
aot_tensor_8 |
6 |
internal |
aot_tensor_9 |
7 |
internal |
aot_tensor_10 |
8 |
internal |
aot_tensor_11 |
9 |
internal |
aot_tensor_12 |
10 |
internal |
aot_tensor_13 |
11 |
internal |
aot_tensor_14 |
12 |
internal |
aot_tensor_15 |
13 |
internal |
aot_tensor_18 |
14 |
internal |
aot_tensor_19 |
15 |
internal |
aot_tensor_conv_2d_0_scratch |
16 |
internal |
aot_tensor_conv_2d_0_weight_sum |
17 |
internal |
aot_tensor_conv_2d_0_multiplier |
18 |
internal |
aot_tensor_conv_2d_0_shift |
19 |
internal |
aot_tensor_conv_2d_2_scratch |
20 |
internal |
aot_tensor_conv_2d_2_weight_sum |
21 |
internal |
aot_tensor_conv_2d_2_multiplier |
22 |
internal |
aot_tensor_conv_2d_2_shift |
23 |
internal |
aot_tensor_svdf_5_scratch_a |
24 |
internal |
aot_tensor_svdf_5_scratch_b |
25 |
internal |
aot_tensor_svdf_5_weight_sum |
26 |
internal |
aot_tensor_fully_connected_6_packed |
27 |
internal |
aot_num_tensors |
28 |
internal |
aot_tensor_type_t (internal)
| Member | Value | Stability |
|---|---|---|
aot_tensor_type_constant |
next | internal |
aot_tensor_type_persistent |
next | internal |
aot_tensor_type_scratch |
next | internal |
aot_tensor_descriptor_t (internal)
| Field | Type | Extent | Stability |
|---|---|---|---|
type |
aot_tensor_type_t |
— | internal |
region |
aot_arena_region_t |
— | internal |
offset |
size_t |
— | internal |
size |
size_t |
— | internal |
aot_tensor_io_t (public)
| Field | Type | Extent | Stability |
|---|---|---|---|
id |
aot_tensor_ident_t |
— | public |
data |
int8_t * |
— | public |
size |
size_t |
— | public |
zero_point |
int32_t |
— | public |
scale |
float |
— | public |
Data
| Name | Type | Extent | Stability |
|---|---|---|---|
aot_arena_alignments |
const size_t |
aot_num_arena_buffers |
advanced |
aot_arena_buffers |
const void * const |
aot_num_arena_buffers |
advanced |
aot_arena_sizes |
const size_t |
aot_num_arena_buffers |
advanced |
aot_inputs_id |
const aot_tensor_ident_t |
aot_num_inputs |
public |
aot_inputs_len |
const int32_t |
aot_num_inputs |
public |
aot_inputs_scale |
const float |
aot_num_inputs |
public |
aot_inputs_zero_point |
const int32_t |
aot_num_inputs |
public |
aot_outputs_id |
const aot_tensor_ident_t |
aot_num_outputs |
public |
aot_outputs_len |
const int32_t |
aot_num_outputs |
public |
aot_outputs_scale |
const float |
aot_num_outputs |
public |
aot_outputs_zero_point |
const int32_t |
aot_num_outputs |
public |
aot_tensor_descriptors |
const aot_tensor_descriptor_t |
aot_num_tensors |
internal |
Macros
| Macro | Value | Stability | Defined when |
|---|---|---|---|
AOT_PLAN_HASH |
"87f6d61da9206a74" |
advanced | always |
aot_arena_const_dtcm_alignment |
16 |
advanced | always |
aot_arena_const_dtcm_size |
44176 |
advanced | always |
aot_arena_dtcm_alignment |
16 |
advanced | always |
aot_arena_dtcm_size |
5696 |
advanced | always |
aot_arena_persistent_dtcm_alignment |
16 |
advanced | always |
aot_arena_persistent_dtcm_size |
128 |
advanced | always |
aot_input_0_nbytes |
(768) |
public | always |
aot_input_0_size |
(768) |
public | always |
aot_num_inputs |
1 |
public | always |
aot_num_outputs |
1 |
public | always |
aot_output_0_nbytes |
(10) |
public | always |
aot_output_0_size |
(10) |
public | always |
aot_test_case.h
Section titled “aot_test_case.h”Declared in includes-api/aot_test_case.h. Integration header; its file name is promised.
Functions
| Signature | Stability | Declared when |
|---|---|---|
int32_t aot_test_case_init(void) |
public | always |
int32_t aot_test_case_run(void) |
public | always |
With external arenas
Section titled “With external arenas”A module converted with memory.allocate_arenas=false leaves the arena memory to the caller and declares what it needs to be given. Settings: memory.allocate_arenas=false, memory.dump_residency_json=true, test.enabled=true.
| Declaration | Kind | Header | Stability | Module types |
|---|---|---|---|---|
int8_t aot_arena_buffers_table_any_unbound(void) |
function | includes-api/aot_tensors.h |
internal | cmake, nsx |
const void * const * aot_arena_buffers_table_view(void) |
function | includes-api/aot_tensors.h |
internal | cmake, nsx |
int32_t aot_bind_arena(aot_arena_region_t region, void *buffer, size_t size) |
function | includes-api/aot_tensors.h |
advanced | cmake, nsx |
int32_t aot_bind_arenas(void * const *buffers, const size_t *sizes, size_t n) |
function | includes-api/aot_tensors.h |
advanced | cmake, nsx |
With a stream pool
Section titled “With a stream pool”A module converted with memory.stream_pool declares the stream pool region the application binds, the transfer counts and the transfer provider for dma units, and adds the context’s transfer field, the transfer callback states and statuses 300 to 302. Every module with a stream pool declares all of them, with or without dma units; the one exception is the nsx provider header below, which exists only with dma units under module.transfer_provider: auto. Settings: memory.allocate_arenas=true, memory.dump_residency_json=true, memory.stream_pool.bytes=16384, memory.stream_pool.memory=dtcm, test.enabled=true.
| Declaration | Kind | Header | Stability | Module types |
|---|---|---|---|---|
aot_num_dma_units |
macro | includes-api/aot_context.h |
advanced | cmake, nsx |
aot_num_transfer_units |
macro | includes-api/aot_context.h |
advanced | cmake, nsx |
aot_transfer_pieces_in_flight |
macro | includes-api/aot_context.h |
advanced | cmake, nsx |
aot_transfer_abort_fn |
typedef | includes-api/aot_context.h |
advanced | cmake, nsx |
aot_transfer_issue_fn |
typedef | includes-api/aot_context.h |
advanced | cmake, nsx |
aot_transfer_provider_t |
typedef | includes-api/aot_context.h |
advanced | cmake, nsx |
aot_transfer_wait_fn |
typedef | includes-api/aot_context.h |
advanced | cmake, nsx |
int8_t aot_arena_buffers_table_any_unbound(void) |
function | includes-api/aot_tensors.h |
internal | cmake, nsx |
const void * const * aot_arena_buffers_table_view(void) |
function | includes-api/aot_tensors.h |
internal | cmake, nsx |
int32_t aot_bind_arena(aot_arena_region_t region, void *buffer, size_t size) |
function | includes-api/aot_tensors.h |
advanced | cmake, nsx |
aot_arena_pool_dtcm_alignment |
macro | includes-api/aot_tensors.h |
advanced | cmake, nsx |
aot_arena_pool_dtcm_size |
macro | includes-api/aot_tensors.h |
advanced | cmake, nsx |
aot_transfer_abort_fn (advanced)
| Signature |
|---|
int32_t (*aot_transfer_abort_fn)(void *self) |
aot_transfer_issue_fn (advanced)
| Signature |
|---|
int32_t (*aot_transfer_issue_fn)(void *self, uint32_t ticket, void *destination, const void *source, size_t bytes) |
aot_transfer_provider_t (advanced)
| Field | Type | Stability |
|---|---|---|
issue |
aot_transfer_issue_fn |
advanced |
wait |
aot_transfer_wait_fn |
advanced |
abort |
aot_transfer_abort_fn |
advanced |
self |
void * |
advanced |
aot_transfer_wait_fn (advanced)
| Signature |
|---|
int32_t (*aot_transfer_wait_fn)(void *self, uint32_t ticket) |
It adds these fields and members to declarations every module makes:
| Field or member | Of | Type or value | Stability |
|---|---|---|---|
aot_op_state_transfer_wait_started |
aot_operator_state_t |
next | public |
aot_op_state_transfer_wait_finished |
aot_operator_state_t |
next | public |
aot_op_state_transfer_issue_started |
aot_operator_state_t |
next | public |
aot_op_state_transfer_issue_finished |
aot_operator_state_t |
next | public |
_arena_bases |
aot_model_context_t |
int8_t * |
internal |
transfer |
aot_model_context_t |
const aot_transfer_provider_t * |
advanced |
aot_arena_pool_dtcm |
aot_arena_region_t |
3 |
advanced |
aot_status_transfer_unbound |
aot_status_t |
300 |
public |
aot_status_transfer_failed |
aot_status_t |
301 |
public |
aot_status_transfer_abort_failed |
aot_status_t |
302 |
public |
With dma units
Section titled “With dma units”A module whose plan schedules dma units: an nsx module emits its own transfer provider on the nsx-psram module’s asynchronous read, includes-api/<prefix>_nsx_transfer.h with src/<prefix>_nsx_transfer.c, built as nsx::<module>_nsx_transfer, under module.transfer_provider: auto (the default; none emits nothing). The emitted provider is experimental with that setting, so its header and declarations are internal; every other module type leaves the provider to the application and declares nothing more than the stream pool variant. This variant is converted from another model on top of the stream pool variant, so only what its dma units add is listed: neither the stream pool variant’s declarations nor the model’s own operators, tensor ids and constant arenas. Model: four int16 fully connected layers with every constant streamed from PSRAM through a 16 KiB DTCM pool, under a plan whose schedule has three dma units and one cpu unit. Settings: memory.allocate_arenas=true, memory.dump_residency_json=true, memory.stream_pool.bytes=16384, memory.stream_pool.memory=dtcm, memory.tensors=[{type: constant, attributes: {memory: PSRAM, residency: stream}}], optimization.plan=<the conversion's plan with a schedule of dma units>, test.enabled=true.
| Declaration | Kind | Header | Stability | Module types |
|---|---|---|---|---|
aot_nsx_transfer_status_t |
enum | includes-api/aot_nsx_transfer.h |
internal | nsx |
int32_t aot_nsx_transfer_bind(aot_model_context_t *ctx, const aot_nsx_transfer_options_t *options) |
function | includes-api/aot_nsx_transfer.h |
internal | nsx |
bool aot_nsx_transfer_can_sleep(void) |
function | includes-api/aot_nsx_transfer.h |
internal | nsx |
const aot_nsx_transfer_last_t * aot_nsx_transfer_last(void) |
function | includes-api/aot_nsx_transfer.h |
internal | nsx |
int32_t aot_nsx_transfer_reset(void) |
function | includes-api/aot_nsx_transfer.h |
internal | nsx |
const aot_nsx_transfer_stats_t * aot_nsx_transfer_stats(void) |
function | includes-api/aot_nsx_transfer.h |
internal | nsx |
aot_nsx_transfer_last_t |
typedef | includes-api/aot_nsx_transfer.h |
internal | nsx |
aot_nsx_transfer_observer_fn |
typedef | includes-api/aot_nsx_transfer.h |
internal | nsx |
aot_nsx_transfer_options_t |
typedef | includes-api/aot_nsx_transfer.h |
internal | nsx |
aot_nsx_transfer_piece_t |
typedef | includes-api/aot_nsx_transfer.h |
internal | nsx |
aot_nsx_transfer_stats_t |
typedef | includes-api/aot_nsx_transfer.h |
internal | nsx |
aot_nsx_transfer_status_t (internal)
| Member | Value | Stability |
|---|---|---|
aot_nsx_transfer_ok |
0 |
internal |
aot_nsx_transfer_null_context |
310 |
internal |
aot_nsx_transfer_psram_api |
311 |
internal |
aot_nsx_transfer_psram_not_ready |
312 |
internal |
aot_nsx_transfer_psram_no_async |
313 |
internal |
aot_nsx_transfer_psram_depth |
314 |
internal |
aot_nsx_transfer_failed |
315 |
internal |
aot_nsx_transfer_window |
317 |
internal |
aot_nsx_transfer_slots |
318 |
internal |
aot_nsx_transfer_queue |
319 |
internal |
aot_nsx_transfer_ticket |
320 |
internal |
aot_nsx_transfer_timeout |
321 |
internal |
aot_nsx_transfer_landed |
322 |
internal |
aot_nsx_transfer_drain |
323 |
internal |
aot_nsx_transfer_last_t (internal)
| Field | Type | Stability |
|---|---|---|
error |
int32_t |
internal |
driver_status |
uint32_t |
internal |
ticket |
uint32_t |
internal |
aot_nsx_transfer_observer_fn (internal)
| Signature |
|---|
void (*aot_nsx_transfer_observer_fn)(void *ctx, const aot_nsx_transfer_piece_t *piece) |
aot_nsx_transfer_options_t (internal)
| Field | Type | Stability |
|---|---|---|
wait_checks |
uint32_t |
internal |
drain_timeout_us |
uint32_t |
internal |
observe |
aot_nsx_transfer_observer_fn |
internal |
observer_ctx |
void * |
internal |
aot_nsx_transfer_piece_t (internal)
| Field | Type | Stability |
|---|---|---|
sequence |
uint32_t |
internal |
ticket |
uint32_t |
internal |
bytes |
uint32_t |
internal |
status |
uint32_t |
internal |
aot_nsx_transfer_stats_t (internal)
| Field | Type | Stability |
|---|---|---|
issues |
uint32_t |
internal |
waits |
uint32_t |
internal |
aborts |
uint32_t |
internal |
peak_in_flight |
uint32_t |
internal |
wait_checks_max |
uint32_t |
internal |
Residency report
Section titled “Residency report”A conversion that sets memory.dump_residency_json writes aot_residency.json beside the module: where the planner put every tensor, and how much of each arena that used. The table illustrates the observed shape of this fixture, using the first element of each array; it is not a complete residency JSON schema. The full fixture follows verbatim.
| Field | Type |
|---|---|
arenas |
object |
arenas.constant |
array |
arenas.constant[].alignment |
number |
arenas.constant[].kind |
string |
arenas.constant[].memory |
string |
arenas.constant[].region_id |
number |
arenas.constant[].source_memory |
string |
arenas.constant[].storage |
object |
arenas.constant[].storage.enum_name |
string |
arenas.constant[].storage.runtime |
object |
arenas.constant[].storage.runtime.data_offset_bytes |
number |
arenas.constant[].storage.runtime.memory |
string |
arenas.constant[].storage.runtime.owner |
string |
arenas.constant[].storage.runtime.size_bytes |
number |
arenas.constant[].storage.runtime.symbol |
string |
arenas.constant[].storage.sidecar |
null |
arenas.constant[].storage.source |
null |
arenas.constant[].tensor_count |
number |
arenas.constant[].total_size |
number |
arenas.constant[].used |
number |
arenas.persistent |
array |
arenas.persistent[].alignment |
number |
arenas.persistent[].memory |
string |
arenas.persistent[].region_id |
number |
arenas.persistent[].storage |
object |
arenas.persistent[].storage.enum_name |
string |
arenas.persistent[].storage.runtime |
object |
arenas.persistent[].storage.runtime.data_offset_bytes |
number |
arenas.persistent[].storage.runtime.memory |
string |
arenas.persistent[].storage.runtime.owner |
string |
arenas.persistent[].storage.runtime.size_bytes |
number |
arenas.persistent[].storage.runtime.symbol |
string |
arenas.persistent[].storage.sidecar |
null |
arenas.persistent[].storage.source |
null |
arenas.persistent[].total_size |
number |
arenas.persistent[].used |
number |
arenas.pool |
array |
arenas.scratch |
array |
arenas.scratch[].alignment |
number |
arenas.scratch[].fragmentation |
number |
arenas.scratch[].memory |
string |
arenas.scratch[].peak_live |
number |
arenas.scratch[].region_id |
number |
arenas.scratch[].storage |
object |
arenas.scratch[].storage.enum_name |
string |
arenas.scratch[].storage.runtime |
object |
arenas.scratch[].storage.runtime.data_offset_bytes |
number |
arenas.scratch[].storage.runtime.memory |
string |
arenas.scratch[].storage.runtime.owner |
string |
arenas.scratch[].storage.runtime.size_bytes |
number |
arenas.scratch[].storage.runtime.symbol |
string |
arenas.scratch[].storage.sidecar |
null |
arenas.scratch[].storage.source |
null |
arenas.scratch[].total_size |
number |
arenas.scratch[].used |
number |
compiler_version |
string |
module_prefix |
string |
plan_hash |
string |
schema_version |
number |
tensor_layout_hash |
string |
tensors |
array |
tensors[].id |
string |
tensors[].memory |
string |
tensors[].offset |
number |
tensors[].pool_offset |
null |
tensors[].role |
string |
tensors[].size |
number |
tensors[].source_memory |
string |
tensors[].unit |
null |
{ "arenas": { "constant": [ { "alignment": 16, "kind": "cold", "memory": "dtcm", "region_id": 2, "source_memory": "dtcm", "storage": { "enum_name": "aot_arena_const_dtcm", "runtime": { "data_offset_bytes": 0, "memory": "dtcm", "owner": "generated", "size_bytes": 44176, "symbol": "aot_arena_const_dtcm__blob" }, "sidecar": null, "source": null }, "tensor_count": 14, "total_size": 44176, "used": 44176 } ], "persistent": [ { "alignment": 16, "memory": "dtcm", "region_id": 1, "storage": { "enum_name": "aot_arena_persistent_dtcm", "runtime": { "data_offset_bytes": 0, "memory": "dtcm", "owner": "generated", "size_bytes": 128, "symbol": "aot_arena_persistent_dtcm_buffer" }, "sidecar": null, "source": null }, "total_size": 128, "used": 128 } ], "pool": [], "scratch": [ { "alignment": 16, "fragmentation": 0, "memory": "dtcm", "peak_live": 5696, "region_id": 0, "storage": { "enum_name": "aot_arena_dtcm", "runtime": { "data_offset_bytes": 0, "memory": "dtcm", "owner": "generated", "size_bytes": 5696, "symbol": "aot_arena_dtcm_buffer" }, "sidecar": null, "source": null }, "total_size": 463600, "used": 5696 } ] }, "compiler_version": "1.13.0", "module_prefix": "aot", "plan_hash": "87f6d61da9206a74", "schema_version": 6, "tensor_layout_hash": "b8c2130e3dd06b16", "tensors": [ { "id": "0", "memory": "dtcm", "offset": 4096, "pool_offset": null, "role": "scratch", "size": 768, "source_memory": "dtcm", "unit": null }, { "id": "1", "memory": "dtcm", "offset": 0, "pool_offset": null, "role": "constant", "size": 432, "source_memory": "dtcm", "unit": null }, { "id": "3", "memory": "dtcm", "offset": 0, "pool_offset": null, "role": "scratch", "size": 4096, "source_memory": "dtcm", "unit": null }, { "id": "4", "memory": "dtcm", "offset": 4096, "pool_offset": null, "role": "scratch", "size": 1024, "source_memory": "dtcm", "unit": null }, { "id": "5", "memory": "dtcm", "offset": 624, "pool_offset": null, "role": "constant", "size": 9216, "source_memory": "dtcm", "unit": null }, { "id": "7", "memory": "dtcm", "offset": 0, "pool_offset": null, "role": "scratch", "size": 4096, "source_memory": "dtcm", "unit": null }, { "id": "8", "memory": "dtcm", "offset": 4096, "pool_offset": null, "role": "scratch", "size": 1024, "source_memory": "dtcm", "unit": null }, { "id": "9", "memory": "dtcm", "offset": 10608, "pool_offset": null, "role": "constant", "size": 8, "source_memory": "dtcm", "unit": null }, { "id": "10", "memory": "dtcm", "offset": 4096, "pool_offset": null, "role": "scratch", "size": 1024, "source_memory": "dtcm", "unit": null }, { "id": "11", "memory": "dtcm", "offset": 10624, "pool_offset": null, "role": "constant", "size": 32768, "source_memory": "dtcm", "unit": null }, { "id": "12", "memory": "dtcm", "offset": 43392, "pool_offset": null, "role": "constant", "size": 128, "source_memory": "dtcm", "unit": null }, { "id": "13", "memory": "dtcm", "offset": 43520, "pool_offset": null, "role": "constant", "size": 128, "source_memory": "dtcm", "unit": null }, { "id": "14", "memory": "dtcm", "offset": 0, "pool_offset": null, "role": "persistent", "size": 128, "source_memory": "dtcm", "unit": null }, { "id": "15", "memory": "dtcm", "offset": 256, "pool_offset": null, "role": "scratch", "size": 32, "source_memory": "dtcm", "unit": null }, { "id": "18", "memory": "dtcm", "offset": 0, "pool_offset": null, "role": "scratch", "size": 10, "source_memory": "dtcm", "unit": null }, { "id": "19", "memory": "dtcm", "offset": 16, "pool_offset": null, "role": "scratch", "size": 10, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_0_multiplier", "memory": "dtcm", "offset": 496, "pool_offset": null, "role": "constant", "size": 64, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_0_scratch", "memory": "dtcm", "offset": 4864, "pool_offset": null, "role": "scratch", "size": 128, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_0_shift", "memory": "dtcm", "offset": 560, "pool_offset": null, "role": "constant", "size": 64, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_0_weight_sum", "memory": "dtcm", "offset": 432, "pool_offset": null, "role": "constant", "size": 64, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_2_multiplier", "memory": "dtcm", "offset": 10096, "pool_offset": null, "role": "constant", "size": 256, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_2_scratch", "memory": "dtcm", "offset": 5120, "pool_offset": null, "role": "scratch", "size": 576, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_2_shift", "memory": "dtcm", "offset": 10352, "pool_offset": null, "role": "constant", "size": 256, "source_memory": "dtcm", "unit": null }, { "id": "conv_2d_2_weight_sum", "memory": "dtcm", "offset": 9840, "pool_offset": null, "role": "constant", "size": 256, "source_memory": "dtcm", "unit": null }, { "id": "fully_connected_6_packed", "memory": "dtcm", "offset": 43648, "pool_offset": null, "role": "constant", "size": 528, "source_memory": "dtcm", "unit": null }, { "id": "svdf_5_scratch_a", "memory": "dtcm", "offset": 0, "pool_offset": null, "role": "scratch", "size": 128, "source_memory": "dtcm", "unit": null }, { "id": "svdf_5_scratch_b", "memory": "dtcm", "offset": 128, "pool_offset": null, "role": "scratch", "size": 128, "source_memory": "dtcm", "unit": null }, { "id": "svdf_5_weight_sum", "memory": "dtcm", "offset": 43520, "pool_offset": null, "role": "constant", "size": 128, "source_memory": "dtcm", "unit": null } ]}