Ship the quantized kernels as their own library - #21595
Open
shoumikhin wants to merge 2 commits into
Open
Conversation
Contributor
Author
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21595
Note: Links to docs will display an error until the docs builds have been completed. ❌ 164 New Failures, 19 Pending, 2 Unrelated Failures, 7 Unclassified FailuresAs of commit 47c1a47 with merge base efd6b55 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A model quantized before export needs the quantized operator kernels
registered when it runs. Those kernels were only ever built into the Python
extension, so a C++ application had nothing to link and could not run such a
model from an installed package. The only way to get them was to build
ExecuTorch from source and link the target directly, which is what the
embedded examples in this repo do.
The registration library was built as a static archive. That is awkward to
ship, because the kernels register themselves from a static initializer and
an initializer in an archive is discarded unless the consumer opts into
whole-archive linking. Build it as a shared library instead, the same way the
merged CPU kernel set already is, and install it:
The library is named after the component that selects it, so the pair reads
together: executorch::kernels_quantized resolves to
libexecutorch_kernels_quantized.so. The code generation helper would
otherwise name it after its internal target, which would not match.
Nothing else in the wheel links this library, so it also has to be named as a
build target explicitly, or it is declared but never built and packaging
looks for a file that does not exist.
Note that a quantized model delegated to XNNPACK does not need this: that
delegate claims the quantize and dequantize operators itself, so nothing is
left for the CPU kernels to run. These are for a quantized model running on
plain CPU, or on a backend that does not claim those operators.
Tested by building a wheel and installing it into a clean environment, with
imports confirmed to resolve to the installed package rather than a checkout:
thread pool and the merged CPU kernels.
libexecutorch.so.1 rather than carrying its own copy of the core.
the out variants of quantize_per_tensor and dequantize_per_tensor. None were
present beforehand.
the same 19 kernels registered at startup, which confirms the library is
retained on the link line even though the application references no symbol
from it directly.
resolves them through this shared library instead of a static archive.