Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18869
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 9 New Failures, 2 Cancelled Jobs, 4 Pending, 3 Unrelated FailuresAs of commit 796d6ff with merge base 2c545f8 ( NEW FAILURES - The following jobs have failed:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Pull request overview
Adds uint8 input/output quantization support for Arm TOSA-based backends by representing unsigned semantics via TOSA RESCALE flags (while keeping internal tensors signless int8), plus plumbing to preserve IO Q/DQ nodes when requested.
Changes:
- Add uint8 IO quantization config and tests validating IO-only uint8 and numeric correctness across TOSA/VGF/Ethos-U55 flows.
- Extend TOSA RESCALE op (fake + lowering) with
input_unsigned/output_unsignedflags and maptorch.uint8to TOSA INT8 dtype. - Add
preserve_io_quantizationcompile spec option and propagate it through pipelines; extend Ethos-U runtime input type support to uint8.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| backends/arm/tosa/partitioner.py | Adds compile-spec-driven IO Q/DQ detagging and rejects partitions with invalid internal uint8 tensors. |
| backends/arm/tosa/mapping.py | Maps torch.uint8 to TOSA INT8 (unsigned semantics via RESCALE flags). |
| backends/arm/tosa/dialect/ops/rescale.py | Extends RESCALE schema and validation for unsigned IO semantics. |
| backends/arm/_passes/insert_rescales_pass.py | Folds dq→q into RESCALE and threads unsigned flags; enforces “uint8 at IO only”. |
| backends/arm/operators/op_tosa_rescale.py | Plumbs unsigned flags into flatbuffer RESCALE attributes and visitor parsing. |
| backends/arm/common/arm_compile_spec.py | Adds preserve_io_quantization to compile specs with parsing/roundtrip + warning behavior. |
| backends/arm/runtime/EthosUBackend.cpp | Allows uint8 (ScalarType::Byte) inputs in runtime IO validation. |
| backends/arm/quantizer/arm_quantizer.py | Adds get_uint8_io_quantization_config() and exports it. |
| backends/arm/quantizer/arm_quantizer_utils.py | Adjusts shared-qspec clique logic to avoid pulling uint8 IO qspecs into shared propagation. |
| backends/arm/test/common.py | Adds preserve_io_quantization option to VGF compile spec helper. |
| backends/arm/test/tester/test_pipeline.py | Plumbs preserve_io_quantization through test pipeline configuration. |
| backends/arm/test/quantizer/test_uint8_io_quantization.py | New test ensuring uint8 IO quantization config applies at IO. |
| backends/arm/test/passes/test_ioquantization_pass.py | Adds extensive end-to-end and pass-level tests for uint8 IO behavior. |
| backends/arm/test/misc/test_rescale_range.py | Adds unsigned zero-point range validation tests for RESCALE. |
| backends/arm/test/misc/test_compile_spec.py | Adds tests for preserve_io_quantization roundtrip and warning behavior. |
Comments suppressed due to low confidence (1)
backends/arm/tosa/dialect/ops/rescale.py:38
- The function docstring is no longer a real docstring because
tosa_spec = get_context_spec()appears before the triple-quoted string. This makes the string a no-op expression and drops the doc from introspection/tools. Move the docstring to be the first statement inRESCALE(and assigntosa_specafter it).
tosa_spec = get_context_spec()
"""Casts the input tensor to dtype `dtype` to produce the correct tensor
meta for a _rescale op.
Additionally validates TOSA constraints of a RESCALE op.
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @digantdesai this adds files and you might want to tests is from a buck2 perspective |
Add support for IO tensors only to be uint8. In conjuction with the QuantizeInput and QuantizeOutput pass this adds the possibility to give inputs of uint8 dtype to the model directly. Change-Id: Icc08ac242e5c980f2abd484eb0e7661418873ab7 Signed-off-by: Per Åstrand <per.astrand@arm.com>
SharedQspecQuantizer can propagate the IO quantization spec into internal nodes when using the composable quantizer. For uint8 IO this violates the TOSA constraint that uint8 is only allowed at IO boundaries. Skip IO-based qspec anchors for uint8 so internal nodes stay int8 while preserving shared qspec behavior elsewhere. Change-Id: Ie068de0c46426f386c86d9c295459011e906f335 Signed-off-by: Per Åstrand <per.astrand@arm.com>
Add an option to preserve the quantization on IO. Useful for keeping input and output tensors quantized when backend supports both +INT and +FP. Change-Id: Ibf6177e70c2abd9f64151553cb94698591a77acc Signed-off-by: Per Åstrand <per.astrand@arm.com>
Change-Id: Ie943e1de816d981c0f09d9bd3683881c03e3000c Signed-off-by: Per Åstrand <per.astrand@arm.com>
Summary
Add support for quantization to uint8 for input and output tensors.
Test plan
Tested through CI
cc @digantdesai @freddan80 @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell