Skip to content

v1.5.0

Latest

Choose a tag to compare

@vikramdattu vikramdattu released this 11 Nov 13:50
· 8 commits to master since this release
v1.5.0

A minor release with new API, fixes on ESP32-S3 and ESP32-P4, and a faster ESP32-S3 MUL. No function is removed. One behaviour changes for direct callers of esp_nn_dual_core_run(); see below.

New API

  • Dual-core claim: esp_nn_dual_core_begin() and esp_nn_dual_core_end() let one caller own the dual-core worker. ESP_NN_HAS_DUAL_CORE_CLAIM marks the API. esp_nn_dual_core_run() returns false without the claim, and the caller runs the job on one core with the same result.
  • esp_nn_dual_core_disable() stops the worker and frees its stack, so esp_nn_dual_core_enable() can start it again.
  • esp_nn_fully_connected_per_ch_s8_batch_scratch(): runs a batch of fully connected rows as a 1x1 convolution when the weight zero-point is 0. The caller passes the scratch buffer, sized with esp_nn_get_fc_batch_scratch_size(). ESP_NN_HAS_FC_S8_BATCH_SCRATCH marks the API (#46).
  • The ESP32-S3 and ESP32-P4 scratch getters also build on Linux, so tools can size scratch buffers ahead of time. See docs/scratch_buffers.md.

Fixes

  • ESP32-P4: every hardware loop follows the P4 placement rules, and CI checks them. This fixes illegal-instruction and load faults that depended on code layout (#52, #53).
  • Dual core: one split kernel runs at a time, the worker task gets a stack that SIMD stores can use, and the caller is pinned before the worker's core is chosen.
  • ESP32-S3: convolution, depthwise and pooling take a vector path only when the buffers meet the alignment that path needs (#43, #44).
  • Convolution: padded 1x1 convolutions, input_offset -128, scratch alignment and large 1x1 batches on ESP32-S3 match the reference.
  • ESP32-S3: mean sums four channels per pass in registers.
  • Pooling: windows that miss the input give a defined result.

Performance

  • ESP32-S3 esp_nn_mul_elementwise_s8 and esp_nn_mul_broadcast_channel_s8: requantize on QACC, eight lanes per step.

Tests and CI

  • bench_app holds the cycle benchmarks; test_app checks correctness only.
  • Alignment sweeps, dual-core contention tests, and variable-length arrays as a build error.
  • GitHub CI builds and emulates test_app on pull requests. The emulator job runs esp-emu 0.51.0.

Upgrade note

  • Code that calls esp_nn_dual_core_run() directly must now take the claim with esp_nn_dual_core_begin() first, and release it with esp_nn_dual_core_end(). Without the claim, run() returns false and the job runs on the calling core, with the same result. For example, esp-tflite-micro 1.4.2 calls run() directly in a few kernels, so those kernels run single core with esp-nn 1.5.0. esp-tflite-micro 1.4.3 takes the claim.

Note for ESP32-P4: ESP-IDF v5.x release tags (up to v5.4.4 and v5.5.5) do not save the PIE register q3 on a task switch. Two tasks on the same core that both run PIE code can then corrupt each other's results. ESP-IDF v6.0 and later save q3, and so do the next v5.3, v5.4 and v5.5 releases. On an older v5.x release, run the PIE kernels from one task per core. See the README.

Thanks

  • James Lavrenz (@jameslavrenz) for the batched fully connected path (#46).
  • Nicolas Liaudat (@nliaudat) for the ESP32-S3 alignment fixes, the alignment sweeps and the stack guards (#43, #44).

Full changelog: v1.4.2...v1.5.0