Arm backend: TOSAQuantizerV2 fixes - #20031

Merged
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1253855-fixes
Jun 5, 2026
Merged

Arm backend: TOSAQuantizerV2 fixes#20031
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1253855-fixes

Conversation

@AdrianLundell

@AdrianLundellAdrianLundell commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Port of fixes from pytorch#19758 to simplify merging.
Change-Id: Ia6bd94daadb290958dbc2a41fd3851526a92a9d3
- MyPy lintter error
- Fix documentation
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Change-Id: I3f9858f911feba14a18dba03a593a6d40ec611c5
CopilotAI review requested due to automatic review settings June 4, 2026 16:22
@AdrianLundellAdrianLundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: none Do not include this in the release notes labels Jun 4, 2026
@pytorch-bot

pytorch-botBot commented Jun 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 1 Cancelled Job

As of commit 334e6ff with merge base ac3003e (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-clameta-claBot 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 Jun 4, 2026
@github-actionsgithub-actionsBot added the module: arm Issues related to arm backend label Jun 4, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a set of targeted fixes to the Arm backend’s TOSA/VGF quantization flow (extracted from earlier work), primarily improving correctness of quantization annotations for parameters, shared-qspec clusters, and fixed-qparam inputs, plus small docs/test updates.

Changes:

  • Restrict weight/bias annotation to true parameterized ops (conv/linear family) to avoid mis-quantizing constant operands of non-parameter ops.
  • Extend/adjust quantization behavior: add support entries for additional ops, add fixed-qparams handling for select trig ops, and improve shared-qspec handling for while_loop with additional_inputs.
  • Update Arm getting-started docs and adjust/extend test coverage (including Cortex-M portable int8 shared-qspec op coverage).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
examples/models/llama/tests/test_export_llama_lib.pyRemoves unused torch import and loosens assertions about quantizer internals.
docs/source/backends/arm-vgf/tutorials/vgf-getting-started.mdClarifies AOT compiler usage for quick tests vs production API.
docs/source/backends/arm-ethos-u/tutorials/ethos-u-getting-started.mdSame tutorial clarification as VGF doc.
backends/cortex_m/test/misc/test_portable_int8.pyAdds shared-qspec coverage for additional indexing ops (index_put_, index_copy, etc.).
backends/arm/scripts/docgen/docgen.pyRefines docstring-to-bullets conversion to only bullet first-level arg lines.
backends/arm/quantizer/quantizer_support.pyUpdates supported pattern list (adds RNN/LSTM/GRU, trig ops, einsum; removes hardsigmoid from fused activations).
backends/arm/quantizer/quantization_config.pyAdds fixed-qparams input qspec selection for specific trig ops via FixedQParamsQuantizationSpec.
backends/arm/quantizer/quantization_annotator.pyTightens typing for op sets and exposes fixed-input-qspec mapping used by config.
backends/arm/quantizer/arm_quantizer_utils.pyFixes parameter handling by identifying weights/biases by actual use (arg position + allowed targets) and adds while_loop shared-qspec handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +304 to +310
"index_put_": OpCase(
torch.ops.aten.index_put_.default,
_build_module(
lambda x, y: torch.ops.aten.index_put_.default(
x, (torch.tensor([1, 3]),), torch.tensor([1.0, 2.0]), False
)
),
Comment on lines +324 to +330
"index_copy_": OpCase(
torch.ops.aten.index_copy_.default,
_build_module(
lambda x, y: torch.ops.aten.index_copy_.default(
x, 0, torch.tensor([0, 2]), y
)
),
@rascani

Copy link
Copy Markdown
Contributor

The failing size tests likely just need a branch update. WebGPU are pre-existing.

@AdrianLundell
AdrianLundell merged commit 5563ee9 into pytorch:mainJun 5, 2026
485 of 491 checks passed
Gasoonjia pushed a commit that referenced this pull request Jun 8, 2026
Break out fixes from #19758 as discussed in #19966
---------
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Co-authored-by: RJ Ascani <rja@meta.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunkCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.module: armIssues related to arm backendpartner: armFor backend delegation, kernels, demo, etc. from the 3rd-party partner, Armrelease notes: noneDo not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@AdrianLundell@rascani
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Arm backend: TOSAQuantizerV2 fixes - #20031

Merged
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1253855-fixes
Jun 5, 2026
Merged

Arm backend: TOSAQuantizerV2 fixes#20031
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1253855-fixes

Conversation

@AdrianLundell

@AdrianLundellAdrianLundell commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Port of fixes from pytorch#19758 to simplify merging.
Change-Id: Ia6bd94daadb290958dbc2a41fd3851526a92a9d3
- MyPy lintter error
- Fix documentation
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Change-Id: I3f9858f911feba14a18dba03a593a6d40ec611c5
CopilotAI review requested due to automatic review settings June 4, 2026 16:22
@AdrianLundellAdrianLundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: none Do not include this in the release notes labels Jun 4, 2026
@pytorch-bot

pytorch-botBot commented Jun 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 1 Cancelled Job

As of commit 334e6ff with merge base ac3003e (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-clameta-claBot 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 Jun 4, 2026
@github-actionsgithub-actionsBot added the module: arm Issues related to arm backend label Jun 4, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a set of targeted fixes to the Arm backend’s TOSA/VGF quantization flow (extracted from earlier work), primarily improving correctness of quantization annotations for parameters, shared-qspec clusters, and fixed-qparam inputs, plus small docs/test updates.

Changes:

  • Restrict weight/bias annotation to true parameterized ops (conv/linear family) to avoid mis-quantizing constant operands of non-parameter ops.
  • Extend/adjust quantization behavior: add support entries for additional ops, add fixed-qparams handling for select trig ops, and improve shared-qspec handling for while_loop with additional_inputs.
  • Update Arm getting-started docs and adjust/extend test coverage (including Cortex-M portable int8 shared-qspec op coverage).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
examples/models/llama/tests/test_export_llama_lib.pyRemoves unused torch import and loosens assertions about quantizer internals.
docs/source/backends/arm-vgf/tutorials/vgf-getting-started.mdClarifies AOT compiler usage for quick tests vs production API.
docs/source/backends/arm-ethos-u/tutorials/ethos-u-getting-started.mdSame tutorial clarification as VGF doc.
backends/cortex_m/test/misc/test_portable_int8.pyAdds shared-qspec coverage for additional indexing ops (index_put_, index_copy, etc.).
backends/arm/scripts/docgen/docgen.pyRefines docstring-to-bullets conversion to only bullet first-level arg lines.
backends/arm/quantizer/quantizer_support.pyUpdates supported pattern list (adds RNN/LSTM/GRU, trig ops, einsum; removes hardsigmoid from fused activations).
backends/arm/quantizer/quantization_config.pyAdds fixed-qparams input qspec selection for specific trig ops via FixedQParamsQuantizationSpec.
backends/arm/quantizer/quantization_annotator.pyTightens typing for op sets and exposes fixed-input-qspec mapping used by config.
backends/arm/quantizer/arm_quantizer_utils.pyFixes parameter handling by identifying weights/biases by actual use (arg position + allowed targets) and adds while_loop shared-qspec handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +304 to +310
"index_put_": OpCase(
torch.ops.aten.index_put_.default,
_build_module(
lambda x, y: torch.ops.aten.index_put_.default(
x, (torch.tensor([1, 3]),), torch.tensor([1.0, 2.0]), False
)
),
Comment on lines +324 to +330
"index_copy_": OpCase(
torch.ops.aten.index_copy_.default,
_build_module(
lambda x, y: torch.ops.aten.index_copy_.default(
x, 0, torch.tensor([0, 2]), y
)
),
@rascani

Copy link
Copy Markdown
Contributor

The failing size tests likely just need a branch update. WebGPU are pre-existing.

@AdrianLundell
AdrianLundell merged commit 5563ee9 into pytorch:mainJun 5, 2026
485 of 491 checks passed
Gasoonjia pushed a commit that referenced this pull request Jun 8, 2026
Break out fixes from #19758 as discussed in #19966
---------
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Co-authored-by: RJ Ascani <rja@meta.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunkCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.module: armIssues related to arm backendpartner: armFor backend delegation, kernels, demo, etc. from the 3rd-party partner, Armrelease notes: noneDo not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@AdrianLundell@rascani
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Arm backend: TOSAQuantizerV2 fixes - #20031

Merged
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1253855-fixes
Jun 5, 2026
Merged

Arm backend: TOSAQuantizerV2 fixes#20031
AdrianLundell merged 3 commits into
pytorch:mainfrom
AdrianLundell:change-1253855-fixes

Conversation

@AdrianLundell

@AdrianLundellAdrianLundell commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Port of fixes from pytorch#19758 to simplify merging.
Change-Id: Ia6bd94daadb290958dbc2a41fd3851526a92a9d3
- MyPy lintter error
- Fix documentation
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Change-Id: I3f9858f911feba14a18dba03a593a6d40ec611c5
CopilotAI review requested due to automatic review settings June 4, 2026 16:22
@AdrianLundellAdrianLundell added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: none Do not include this in the release notes labels Jun 4, 2026
@pytorch-bot

pytorch-botBot commented Jun 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 2 New Failures, 1 Cancelled Job

As of commit 334e6ff with merge base ac3003e (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-clameta-claBot 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 Jun 4, 2026
@github-actionsgithub-actionsBot added the module: arm Issues related to arm backend label Jun 4, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR applies a set of targeted fixes to the Arm backend’s TOSA/VGF quantization flow (extracted from earlier work), primarily improving correctness of quantization annotations for parameters, shared-qspec clusters, and fixed-qparam inputs, plus small docs/test updates.

Changes:

  • Restrict weight/bias annotation to true parameterized ops (conv/linear family) to avoid mis-quantizing constant operands of non-parameter ops.
  • Extend/adjust quantization behavior: add support entries for additional ops, add fixed-qparams handling for select trig ops, and improve shared-qspec handling for while_loop with additional_inputs.
  • Update Arm getting-started docs and adjust/extend test coverage (including Cortex-M portable int8 shared-qspec op coverage).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
examples/models/llama/tests/test_export_llama_lib.pyRemoves unused torch import and loosens assertions about quantizer internals.
docs/source/backends/arm-vgf/tutorials/vgf-getting-started.mdClarifies AOT compiler usage for quick tests vs production API.
docs/source/backends/arm-ethos-u/tutorials/ethos-u-getting-started.mdSame tutorial clarification as VGF doc.
backends/cortex_m/test/misc/test_portable_int8.pyAdds shared-qspec coverage for additional indexing ops (index_put_, index_copy, etc.).
backends/arm/scripts/docgen/docgen.pyRefines docstring-to-bullets conversion to only bullet first-level arg lines.
backends/arm/quantizer/quantizer_support.pyUpdates supported pattern list (adds RNN/LSTM/GRU, trig ops, einsum; removes hardsigmoid from fused activations).
backends/arm/quantizer/quantization_config.pyAdds fixed-qparams input qspec selection for specific trig ops via FixedQParamsQuantizationSpec.
backends/arm/quantizer/quantization_annotator.pyTightens typing for op sets and exposes fixed-input-qspec mapping used by config.
backends/arm/quantizer/arm_quantizer_utils.pyFixes parameter handling by identifying weights/biases by actual use (arg position + allowed targets) and adds while_loop shared-qspec handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +304 to +310
"index_put_": OpCase(
torch.ops.aten.index_put_.default,
_build_module(
lambda x, y: torch.ops.aten.index_put_.default(
x, (torch.tensor([1, 3]),), torch.tensor([1.0, 2.0]), False
)
),
Comment on lines +324 to +330
"index_copy_": OpCase(
torch.ops.aten.index_copy_.default,
_build_module(
lambda x, y: torch.ops.aten.index_copy_.default(
x, 0, torch.tensor([0, 2]), y
)
),
@rascani

Copy link
Copy Markdown
Contributor

The failing size tests likely just need a branch update. WebGPU are pre-existing.

@AdrianLundell
AdrianLundell merged commit 5563ee9 into pytorch:mainJun 5, 2026
485 of 491 checks passed
Gasoonjia pushed a commit that referenced this pull request Jun 8, 2026
Break out fixes from #19758 as discussed in #19966
---------
Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
Co-authored-by: RJ Ascani <rja@meta.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunkCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.module: armIssues related to arm backendpartner: armFor backend delegation, kernels, demo, etc. from the 3rd-party partner, Armrelease notes: noneDo not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@AdrianLundell@rascani