Arm backend: Add experimental support for new TOSAQuantizer#18100
Arm backend: Add experimental support for new TOSAQuantizer#18100AdrianLundell wants to merge 4 commits intopytorch:mainfrom
Conversation
Allows initializing TOSA/EthosU/Vgf quantizers with use_composable_quantizer=True to use a new implementation of the quantizer following the Cortex-M. See pytorch#17701 for more details. - Creates a new temporary TOSAQuantizer API layer for switching between the two versions - Adds a TOSAQuantizationConfig encapturing TOSA-specific qspec requirements for certain ops. - Adds quantizer_support.py for defining what operators are supported by the quantizer. - Align mark_node_as_annotated in cortex-m backend to TOSAQuantizer behaviour. - Update quantizer reporter to handle TOSA qspecs as they are dynamically created. Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: Icbca66ff86e6f78ffa1c8dcec55e17c25f97d8ca
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18100
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit 5c02aa7 with merge base 096f10c ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com> Change-Id: Id81e0c39d13a94a749206441fce60664c80a0af8
|
Hi @SS-JIA / @digantdesai this adds a file, do you want/need to check this? |
|
Fails unrelated |
|
|
||
| # Lazily import heavy quantizer classes to avoid circular imports with | ||
| # Cortex-M quantization configs. | ||
| _LAZY_EXPORTS = { |
| (torch.ops.aten.sqrt.default,), | ||
| (torch.ops.aten.silu.default,), | ||
| (torch.ops.aten.silu_.default,), | ||
| (torch.ops.aten.logit.default,), |
There was a problem hiding this comment.
torch.ops.aten.logit.default listed twice (also at line 126).
| if qspec.is_dynamic != key.is_dynamic: | ||
| continue | ||
| return val | ||
| return "UNREGISTRED_QSPEC" |
| targeted_nodes_description = str(self.node_finder) | ||
| quantization_config_path = SUPPORTED_QCONFIGS.get( | ||
| self.quantization_config, "CUSTOM_QCONFIG" | ||
| self.quantization_config, "UNREGISTRED_QCONFIG" |
There was a problem hiding this comment.
Typo: "UNREGISTERED_QCONFIG"
| continue | ||
| if qspec.is_dynamic != key.is_dynamic: | ||
| continue | ||
| return val |
There was a problem hiding this comment.
Should we add a check for qspec.ch_axis?
| "//executorch/backends/arm:constants", | ||
| "//executorch/backends/arm:ethosu", | ||
| "//executorch/backends/arm:vgf", | ||
| "//executorch/backends/cortex_m/quantizer:quantizer", |
There was a problem hiding this comment.
Pulling this in exposed that the cortex_m/quantizer:quantizer is broken on main. Here's summary of what needs to change:
backends/cortex_m/quantizer/TARGETS — add missing srcs and deps:
python_library(
name = "quantizer",
srcs = [
"__init__.py",
"node_finders.py", # MISSING
"operator_configs.py", # NEEDS REMOVING
"pattern_checkers.py", # MISSING
"pattern_matcher.py", # MISSING
"quantization_configs.py",
"quantizer.py",
"quantizer_reporter.py", # MISSING
"quantizer_support.py", # MISSING
],
deps = [
"//caffe2:torch",
"//executorch/backends/arm:common", # MISSING
"//executorch/backends/arm:constants", # MISSING
"//executorch/backends/arm/quantizer:quantization_annotator", # MISSING
"//executorch/backends/arm/quantizer:quantization_config",
"//pytorch/ao:torchao",
"fbsource//third-party/pypi/tabulate:tabulate", # MISSING
],
)
I'll put together a separate PR, but feel free to incorporate into this one to unblock.
Allows initializing TOSA/EthosU/Vgf quantizers with use_composable_quantizer=True to use a new implementation of the quantizer following the Cortex-M. See
#17701 for more details.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell