Skip to content

Conversation

@ahmtox
Copy link
Contributor

@ahmtox ahmtox commented Jun 9, 2025

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@ahmtox ahmtox requested a review from SS-JIA as a code owner June 9, 2025 15:04
@pytorch-bot
Copy link

pytorch-bot bot commented Jun 9, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Unrelated Failure

As of commit 8005443 with merge base 8cfa858 (image):

NEW FAILURE - The following job has failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

//

// Helper function to get the name of a ScalarType for better error messages
std::string scalar_type_name(c10::ScalarType dtype) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this the same helper function you used for the quantized tests? if so, please refactor this into some utilities.

}
}

vkcompute::vkapi::ScalarType from_at_scalartype(c10::ScalarType at_scalartype) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above, refactor into common utilities

at::ScalarType dtype,
at::ScalarType out_dtype) {
auto out = at::empty_like(input, out_dtype);
// Convert at::ScalarType to executorch::ScalarType
Copy link
Contributor

Choose a reason for hiding this comment

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

you use this conversion here two times, and also in the quantized tests, please refactor into a utility function

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

@ahmtox ahmtox added the release notes: vulkan Changes to the Vulkan backend delegate label Jun 11, 2025
Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

Skeleton framework that is needed to build out the dequantize_per_tensor and dequantize_per_token operators based on cpu implementation

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D76267021

@facebook-github-bot facebook-github-bot merged commit 763269a into gh/ahmtox/13/base Jun 14, 2025
95 of 98 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/ahmtox/13/head branch June 14, 2025 03:46
kedarnath03 pushed a commit to kedarnath03/executorch that referenced this pull request Jun 25, 2025
Pull Request resolved: pytorch/executorch#11480

# Context
In this diff we plan on creating the skeleton test framework for dequantization. This is necessary as we need a reference to test our vulkan implementation of the dequantization 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_dequantize.cpp](https://github.com/pytorch/executorch/blob/main/kernels/quantized/cpu/op_dequantize.cpp) cpu implementation of the `dequantize_per_tensor`, and the `dequantize_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 `dequantize_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 (dequantize_per_tensor, and dequantize_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: 290376489
@exported-using-ghexport

Differential Revision: [D76267021](https://our.internmc.facebook.com/intern/diff/D76267021/)
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. fb-exported release notes: vulkan Changes to the Vulkan backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants