Skip to content

Conversation

@AdrianLundell
Copy link
Collaborator

@AdrianLundell AdrianLundell commented Nov 19, 2025

Currently only support for NHWC memory format.
Adds weights-per-tensor quantization as default quantization.

Generalizes the CortexMPassManager to work with any pass with exported_program as init arg to support using both XNNPackPasses and ArmPasses.

Refactors the QuantizedLinearFusionPass to become a more general CovertToCortexMPass for replacing Aten ops with corresponding Cortex-M ops.

cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai

Currently only support for NHWC memory format.
Adds weights-per-tensor quantization as default quantization.

Generalizes the CortexMPassManager to work with any pass
with exported_program as init arg to support using both
XNNPackPasses and ArmPasses.

Refactors the QuantizedLinearFusionPass to become a more general
CovertToCortexMPass for replacing Aten ops with corresponding
Cortex-M ops.

Note that this pass and quantized_op_fusion_pass
have the same function except that the former uses call() and
the latter uses the call_operator() function. This is likely to
be refactored in a future patch.

Signed-off-by: Adrian Lundell <[email protected]>
Change-Id: I7f809550bcc706f5b08bf1597a519b66801489af
@AdrianLundell AdrianLundell added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label Nov 19, 2025
@AdrianLundell AdrianLundell added the release notes: none Do not include this in the release notes label Nov 19, 2025
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 19, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 19, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15896

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit 5e56eb0 with merge base 3374ff8 (image):

BROKEN TRUNK - The following jobs failed but were 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.

Copy link
Collaborator

@zingo zingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, just make sure all Arm tests pass before merge I see some fail but might just be flakey and a retest or rebase might help (I have not checked).

Edit: Seem to have failed in initial setup, re-trigger a test run now.

@AdrianLundell
Copy link
Collaborator Author

Unrelated failures

FAILED exir/backend/test/test_debug_handle_map.py::TestBackendDebugHandle::test_lowered_the_whole_model - UnboundLocalError: local variable 'qnn_compile_spec_buffer' referenced before assignment
Falsifying example: test_lowered_the_whole_model(
    self=<test_debug_handle_map.TestBackendDebugHandle testMethod=test_lowered_the_whole_model>,
    unlift=False,
)

You can reproduce this example by temporarily adding @reproduce_failure('6.84.2', b'AAA=') as a decorator on your test case
FAILED exir/backend/test/test_lowered_backend_module.py::TestBackendAPI::test_emit_lowered_backend_module - UnboundLocalError: local variable 'qnn_compile_spec_buffer' referenced before assignment
FAILED exir/backend/test/test_lowered_backend_module.py::TestBackendAPI::test_emit_nested_lowered_backend_module - UnboundLocalError: local variable 'qnn_compile_spec_buffer' referenced before assignment

@AdrianLundell AdrianLundell merged commit 213d24c into pytorch:main Nov 20, 2025
142 of 144 checks passed
@zingo
Copy link
Collaborator

zingo commented Nov 20, 2025

This might have caused some problems
I spot this in in the merged test suite in the hud on this commit:
https://hud.pytorch.org/hud/pytorch/executorch/main/1?per_page=50&name_filter=arm-backend
test: [failure] trunk / test-arm-backend (test_model_smollm2-135M) / linux-job

2025-11-20T12:16:32.2533021Z CALL: python3 -m examples.arm.aot_arm_compiler --delegate --model_name=smollm2 --target=ethos-u85-128 --output=arm_test/test_model/smollm2_arm_delegate_ethos-u85-128 --bundleio --system_config=Ethos_U85_SYS_DRAM_Mid --memory_mode=Dedicated_Sram_384KB --quantize --intermediate=arm_test/test_model/smollm2_arm_delegate_ethos-u85-128
2025-11-20T12:16:32.2534668Z Traceback (most recent call last):
2025-11-20T12:16:32.2535212Z   File "/opt/conda/envs/py_3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
2025-11-20T12:16:32.2535809Z     return _run_code(code, main_globals, None,
2025-11-20T12:16:32.2536323Z   File "/opt/conda/envs/py_3.10/lib/python3.10/runpy.py", line 86, in _run_code
2025-11-20T12:16:32.2537110Z     exec(code, run_globals)
2025-11-20T12:16:32.2538043Z   File "/pytorch/executorch/examples/arm/aot_arm_compiler.py", line 38, in <module>
2025-11-20T12:16:32.2538808Z     from executorch.backends.cortex_m.passes.quantized_linear_fusion_pass import (
2025-11-20T12:16:32.2540048Z ModuleNotFoundError: No module named 'executorch.backends.cortex_m.passes.quantized_linear_fusion_pass'
2025-11-20T12:16:32.2542347Z ERROR called:  python3 -m examples.arm.aot_arm_compiler --delegate --model_name=smollm2 --target=ethos-u85-128 --output=arm_test/test_model/smollm2_arm_delegate_ethos-u85-128 --bundleio --system_config=Ethos_U85_SYS_DRAM_Mid --memory_mode=Dedicated_Sram_384KB --quantize --intermediate=arm_test/test_model/smollm2_arm_delegate_ethos-u85-128
2025-11-20T12:16:32.2543984Z Failed with: 1
2025-11-20T12:16:32.2556122Z ##[error]Process completed with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants