fix: size the ESP-NN conv pad-bounce buffer tile-aware so tiled edge tiles accelerate - #40
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On-device validation (ESP32-S3, SiliconRig) after Phase 1.5 showed tiled convs reach the ESP-NN
adapter with correct output but many EDGE tiles fall back to s8_ref. Root cause:
tigris_esp_nn_preparesized the asymmetric-pad bounce buffer (s_pad_buf) only when the FULL opis asymmetric, but tiling manufactures asymmetric edge tiles (a top tile pads only the top; a left
width tile only the left) even for a symmetric full op (e.g.
pad 1,1,1,1). Those edge tiles needthe bounce buffer, find it unallocated, and drop to s8_ref. This sizes the pad buffer tile-aware.
Change
esp_conv_tile_input_dims(): for a conv op, returns the max input rect it sees at inference -the tile's input rect (from the stage's tile plan:
tile_height, and for 2D the width packed in_reserved & 0xFFFF; for a chain,chain_tile_hplus one halo per chain member) - or the fulltensor if untiled.
tigris_esp_nn_prepare: for a tiled conv, sizemax_padfor the tile's input rect with the op'spads, so every edge tile's bounce buffer is allocated. Bounded by the tile, not the full op, so
the memory footprint is preserved (the flagship's fit story is not affected).
full-op size already covers any tile. Depthwise uses implicit clipping (no bounce) and is
unaffected.
Validation (real ESP32-S3 via SiliconRig)
chain_lb(rolled) sram=104 / fallback=52;wide(2D) sram=130 / fallback=338.max_abs_diff=0, 2Dmax_abs_diff=0.1.5b/c ESP code).
#ifdef'd out); MISRA baseline unchanged; stack gatepasses.
Note: on these synthetic 1-row-tile plans the esp_nn-vs-s8_ref speedup is 1.0x (tiles too small to
vectorize). The acceleration benefit shows on real models tiled to the SRAM budget (larger tiles) -
the accelerated multi-board bench capstone.