analogdevicesinc / ai8x-synthesis

Quantization and Synthesis (Device Specific Code Generation) for ADI's MAX78000 and MAX78002 Edge AI Devices
Apache License 2.0
55 stars 47 forks source link

understanding error in synthesis yaml #312

Closed nikky4D closed 9 months ago

nikky4D commented 9 months ago

Hi, I am modifying ai87_fpndetector for my use case by changing the input shape, removing the first residual in the backbone, and other smaller mods in the FPN accordingly (see .py file attached). To create the yaml for my own model, I'm modifying the original ai87_fpndetector_pascalvoc for my own use case. But I am getting this error for my yaml:

ERROR: Layer 73 (loc_60_80_res0_preprocess): HWC (4 channels/word) 8-bit 60x80 output (size 19200) 
with output offset 0x10ae0 and expansion 1x exceeds data memory instance size of 81920.

What does this mean in general and how should I approach cases where memory is exceeded? how is this excess even calculated?

Here is my complete yaml and py file modFPN.zip

seldauyanik-maxim commented 9 months ago

For the layer of interest, when (4 channels/word) 8-bit and single pass (expansion 1) HWC format is in use, allocaiton of 60x80 output needs a memory address difference of size 19200 (60x80x4) as noted ($4B00) between first and last item. Note: x4 comes from the fact that each data memory item holds 32 bits (4 channels) and next memory item address is 4 bytes away.

For the same layer (layer id:72 and in yaml file comment refers as: # Layer 73: res0 - preprocess,), the layer output offset is defined as: 0x10ae0 by output field of the layer in the used yaml file

If izer places the output after the specified output offset, then the address of the first availabality should be: 0x10ae0 + 0x4B00 = 1 55E0 which exceeds data memory capacity (from 0x0000 to 0x14000)

To summarize, for the layer 72, the output does not fit into data memory with given output offset. As it is not meaningful to continue to latter layers with partial data, izer quits with error.

nikky4D commented 9 months ago

I understand now. Thank you so much for the clarification.