Commit 218cc45
V2 quantizer: fix IO-boundary shared clusters left in float (#20291)
Summary:
Shared-op clusters (e.g. `cat`, `view`, `reshape`) on the quantized IO
boundary were silently left in float by the composable TOSA quantizer
(`_TOSAQuantizerV2`), causing them to fall off the Ethos-U integer
delegate onto CPU.
`SharedQspecQuantizer` propagates a qspec only from already-quantized
neighbors. A cluster whose only quantized neighbors are a uint8 model
input (intentionally skipped by `_skip_shared_qspec_from_io` to confine
uint8 to the IO boundary) and/or an input-state placeholder with no
`output_qspec` had no qspec to propagate, so it was rejected and
remained in float.
The fix adds `_is_quantized_io_boundary`, which detects annotated
`placeholder`/`output` nodes that signal the cluster is on the quantized
data path even when their qspec is filtered. `_get_shared_clique` now
returns a `touches_quantized_io` flag alongside the usual results. When
`_annotate_shared_cluster` finds an empty `adjacent_qspecs` but a
boundary-touching cluster, it initiates quantization from the global
config input-activation qspec instead of rejecting.
`_TOSAQuantizerV2.set_global` now also propagates to
`shared_qspec_quantizer.global_config` so the fallback is wired
automatically.
This restores the correctness fix from D107320847, which was abandoned
because its other fix (parameter-operand weight misclassification) had
already been resolved via the `is_weight` `PARAMETER_TARGETS` refactor.
This change was developed with assistance from Claude.
Differential Revision: D108662081
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils
@Sebastian-Larsson @robell
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 01e951f commit 218cc45
3 files changed
Lines changed: 93 additions & 3 deletions
File tree
- backends/arm
- quantizer
- test/quantizer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
| 1223 | + | |
1223 | 1224 | | |
1224 | 1225 | | |
1225 | 1226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
| 483 | + | |
483 | 484 | | |
484 | 485 | | |
485 | 486 | | |
| |||
551 | 552 | | |
552 | 553 | | |
553 | 554 | | |
554 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
555 | 569 | | |
556 | 570 | | |
557 | 571 | | |
| 572 | + | |
558 | 573 | | |
559 | 574 | | |
560 | 575 | | |
| |||
563 | 578 | | |
564 | 579 | | |
565 | 580 | | |
| 581 | + | |
566 | 582 | | |
567 | 583 | | |
568 | 584 | | |
569 | 585 | | |
| 586 | + | |
570 | 587 | | |
571 | | - | |
| 588 | + | |
572 | 589 | | |
573 | 590 | | |
574 | 591 | | |
| |||
623 | 640 | | |
624 | 641 | | |
625 | 642 | | |
626 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
627 | 662 | | |
628 | 663 | | |
629 | 664 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
27 | 45 | | |
28 | 46 | | |
29 | 47 | | |
| |||
40 | 58 | | |
41 | 59 | | |
42 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
0 commit comments