Skip to content

[ET-VK][Ops] quantize ops skeleton test framework #11672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: gh/ahmtox/23/orig
Choose a base branch
from

Conversation

pytorchbot
Copy link
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #11366 by @ahmtox
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/ahmtox/8/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/ahmtox/8/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/ahmtox/23/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/ahmtox/8/orig
@diff-train-skip-merge

Pull Request resolved: #11366

# Context
In this diff we plan on creating the skeleton test framework for quantization. This is necessary as we need a reference to test our vulkan implementation of the quantization operator against an existing cpu implementation. This test framework is heavily inspired by [sdpa_test.cpp](https://github.com/pytorch/executorch/blob/main/backends/vulkan/test/op_tests/sdpa_test.cpp). We make use of the [op_quantize.cpp](https://github.com/pytorch/executorch/blob/main/kernels/quantized/cpu/op_quantize.cpp) cpu implementation of the `quantize_per_tensor`, and the `quantize_per_token` operators.

An explanation for the operator is included where the actual vulkan implementation is created in a future diff along this stack.
# Changes
The main thing in this difference is the creation of a new test framework `quantize_test.cpp`, and also including it in targets.bzl such that we can properly call the test. As this is inspired by sdpa_test.cpp, we also follow a similar format. First we have forward declarations of the functions that we wish to test against (quantize_per_tensor, and quantize_per_token). Then we also have wrappers for the functions without context, and finally wrappers for the ATen implementations of the same operators using the `WRAP_TO_ATEN` macro. We don't need context as this is merely for testing. We also have a utility function to test the quantize arguments that will be used when actually using the vulkan implementation. This utility function is just for a sanity check.
ghstack-source-id: 290376488
@exported-using-ghexport

Differential Revision: [D75959066](https://our.internmc.facebook.com/intern/diff/D75959066/)
@pytorchbot pytorchbot requested a review from SS-JIA as a code owner June 14, 2025 03:46
Copy link

pytorch-bot bot commented Jun 14, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit 005a6ac with merge base 56392aa (image):

NEW FAILURES - The following jobs have failed:

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

@facebook-github-bot facebook-github-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 Jun 14, 2025
@ahmtox ahmtox self-requested a review June 14, 2025 03:57
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants