pytorch / pytorch/executorch

qd8-f16 quantization in xnnpack

Open
#6,510 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: xnnpack need-user-input triaged
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

I've recently read this tf-lite blogpost about faster inference with xnnpack, and would like to try it out in executorch.

I can see that there are qd8-f16 (and -f32) kernels being compiled when I compile xnnpack, but I'm not quite sure how to quantize my model with that config.

I guess that I would need a QuantizationSpec for activations that specifies the dtype. Is it enough to simply make a QuantizationSpec(dtype=torch.float16) and then use the other code from get_symmetric_quantization_config (torch.ao./../.xnnpack_quantizer) with is_dynamic=True?

cc @digantdesai @mcr229

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the QuantizationSpec usage and the get_symmetric_quantization_config and xnnpack_quantizer entry points mentioned in the issue, including how is_dynamic is handled. Determine whether qd8-f16 quantization is currently exposed by executorch and identify the expected configuration and validation path. Done should include a documented, working way to quantize a model with this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.