Skip to content

Add some basic xnnpack recipes #10035

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 1 commit into
base: gh/tarun292/5/base
Choose a base branch
from

Conversation

tarun292
Copy link
Contributor

@tarun292 tarun292 commented Apr 10, 2025

Copy link

pytorch-bot bot commented Apr 10, 2025

🔗 Helpful Links

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

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

❌ 62 New Failures, 11 Unrelated Failures

As of commit 910ac24 with merge base 1facfa9 (image):

NEW FAILURES - The following jobs have failed:

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.

@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 Apr 10, 2025
@facebook-github-bot
Copy link
Contributor

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

Copy link

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

is_per_channel=True, is_dynamic=True
)
quantizer.set_global(operator_config)
DuplicateDynamicQuantChainPass
Copy link
Contributor

Choose a reason for hiding this comment

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

i've actually done some work to remove the need for this. I guess it's ok to have for now as it should still work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove it if not needed?


)

def get_dynamic_quant_recipe() -> ExportRecipe:
Copy link
Contributor

Choose a reason for hiding this comment

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

organizationally maybe quant recipes can be in a separate folder?

Copy link
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

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

Looks good. Stamping, left some comments.

)
from executorch.exir import ExportRecipe

def get_generic_fp32_cpu_recipe() -> ExportRecipe:
Copy link
Contributor

Choose a reason for hiding this comment

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

if namespaced to XNNPACK then cpu may not be needed?

Suggested change
def get_generic_fp32_cpu_recipe() -> ExportRecipe:
def get_fp32_recipe() -> ExportRecipe:

Comment on lines +45 to +46
"FP32_CPU_ACCELERATED_RECIPE": get_generic_fp32_cpu_recipe,
"DYNAMIC_QUANT_CPU_ACCELERATED_RECIPE": get_dynamic_quant_recipe,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
"FP32_CPU_ACCELERATED_RECIPE": get_generic_fp32_cpu_recipe,
"DYNAMIC_QUANT_CPU_ACCELERATED_RECIPE": get_dynamic_quant_recipe,
"FP32_RECIPE": get_fp32_recipe,
"DYNAMIC_QUANT_RECIPE": get_dynamic_quant_recipe,

name = "fp32_recipe",
quantizer = None,
partitioners=[XnnpackPartitioner()],

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +20 to +22
quantizer = XNNPACKQuantizer()
operator_config = get_symmetric_quantization_config(is_per_channel=False)
quantizer.set_global(operator_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
quantizer = XNNPACKQuantizer()
operator_config = get_symmetric_quantization_config(is_per_channel=False)
quantizer.set_global(operator_config)

is_per_channel=True, is_dynamic=True
)
quantizer.set_global(operator_config)
DuplicateDynamicQuantChainPass
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove it if not needed?

operator_config = get_symmetric_quantization_config(is_per_channel=False)
quantizer.set_global(operator_config)
return ExportRecipe(
name = "fp32_recipe",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
name = "fp32_recipe",
name = "fp32",

Comment on lines +13 to +17
def setUp(self) -> None:
super().setUp()

def tearDown(self) -> None:
super().tearDown()
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need these?

example_inputs=example_inputs,
export_recipe=get_xnnpack_recipe("FP32_CPU_ACCELERATED_RECIPE")
)
export_session.export()
Copy link
Contributor

Choose a reason for hiding this comment

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

will this raise? should we catch it?

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants