Expand description
GAIC (Grid Anchor based Image Cropping, VGG16 backbone) on an AMD XDNA
NPU, replaying the bundle iron/applications/gaic/export_gaic.py
writes, through taconite.
Gaic::features runs the backbone once per image — the 13 VGG16
convs, each one flm.GEMM over an im2col view (see
iron/applications/gaic/gaic_npu.py) — and reduces it to the 32-channel
1/16-scale map every crop is scored from; Gaic::score scores any
number of candidate boxes against it (RoI + RoD align on the host, the
5184 -> 768 FC on the NPU, 768 -> 128 -> 1 on the host). anchors
makes GAIC’s candidate sets and preprocess the network input, both
matching GAIC-Pytorch’s demo exactly.
Host glue per conv, in one threaded pass: the GEMM’s output (bf16,
pixel-major [H][W + 2][OC], two junk columns a row) -> + bias, ReLU,
[2x2 max-pool] -> the next conv’s A source written straight into the
shared input buffer. The activation buffers are host_only (uncached)
BOs, so rows move through them with whole-row copies.
One Gaic per process: its kernels stay resident as 9 of the NPU’s 16
hardware contexts. Send, not Sync.
Modules§
- align
- RoIAlignAvg / RoDAlignAvg: ports of GAIC-Pytorch’s CPU kernels
(untils/{roi,rod}_align/src/*.cpp, forward) followed by the 2x2 stride-1
average pool the
*Avgmodules apply. f32 throughout, like the C code. - anchors
- Candidate crops, as GAIC-Pytorch’s dataset/candidate_generation.py makes
them (same f64 arithmetic, same truncating
int()), in the network input’s pixels:[x1, y1, x2, y2]. - bundle
- The bundle
iron/applications/gaic/export_gaic.pywrites, in the format every IRON bundle shares (read withtaconite_bundle):manifest.txtnaming the compiled kernels and the layer table, the packed weights, host-side parameters and the self-check’s references in the tensor store. See that script’s docstring for every record and tensor. - preprocess
- The network input, as GAIC-Pytorch’s demo.py makes it: resize (short side 256, each side rounded to a multiple of 32) with PIL’s LANCZOS filter, then ToTensor + ImageNet normalisation.
Structs§
- Features
- The reduced feature map of one image:
[reddim][h][w]f32 at 1/16 of the network input (input_w x input_h), what every box is scored from. - Gaic
- Timing
- Wall time per stage, accumulated since the last
Gaic::reset_timing.