Commit d83aa08
authored
Arm backend: Reuse identical CONST_SHAPE nodes (#19770)
Cache CONST_SHAPE nodes created by InsertConstShapesPass and reuse them
when a later view/repeat needs the same shape. This removes duplicate
shape constants.
This improvement is model dependent. Models with few repeated literal
shapes will not see any meaningful change, but some models can benefit
from it notably.
The table below shows the results of a local test lowering DeiT Tiny to
TOSA-FP. The lowering time reduced in this run, likely because passes
following InsertConstShapesPass had fewer nodes to iterate over.
| Metric | Baseline | Optimized | Delta |
| -------------- | -------- | --------- | ---------------- |
| Total ops | 2106 | 1736 | -370 (-17.6%) |
| CONST_SHAPE | 466 | 96 | -370 (-79.4%) |
| TOSA size | 23.82 MB | 23.75 MB | -71.6 KB (-0.3%) |
| Execution time | 118.7 s | 78.4 s | -40.3 s (-34.0%) |
Signed-off-by: Martin Lindström <Martin.Lindstroem@arm.com>1 parent dd00d42 commit d83aa08
1 file changed
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | 66 | | |
| |||
0 commit comments