Skip to content

[Dynamo] modify IPEX backend#92067

Closed
jiayisunx wants to merge 5 commits intopytorch:masterfrom
jiayisunx:ipex_backend
Closed

[Dynamo] modify IPEX backend#92067
jiayisunx wants to merge 5 commits intopytorch:masterfrom
jiayisunx:ipex_backend

Conversation

@jiayisunx
Copy link
Copy Markdown
Collaborator

@jiayisunx jiayisunx commented Jan 12, 2023

  1. Combine the two backends ‘ipex_fp32’ and ‘ipex_bf16’ into one backend ‘ipex’.
  2. Modify IPEX backend to work in fake mode and symbolic mode.

cc @mlazos @soumith @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @chunyuan-w @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @desertfire

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Jan 12, 2023

🔗 Helpful Links

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

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

✅ No Failures

As of commit 82f1c37:
💚 Looks good so far! There are no failures yet. 💚

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

@jiayisunx jiayisunx marked this pull request as draft January 12, 2023 09:00
@jiayisunx jiayisunx requested a review from jgong5 January 29, 2023 05:56
@jiayisunx jiayisunx marked this pull request as ready for review January 29, 2023 05:57
@jiayisunx jiayisunx force-pushed the ipex_backend branch 3 times, most recently from a6b50cb to 6ab10d5 Compare January 30, 2023 01:22
@jiayisunx jiayisunx changed the title modify ipex backend [Dynamo] modify IPEX backend Jan 30, 2023
Copy link
Copy Markdown
Collaborator

@jgong5 jgong5 left a comment

Choose a reason for hiding this comment

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

Can you add PR description on why you made the changes and what you changed in brief?

self.assertEqual(r2.dtype, torch.float32)
for dynamic_shapes in [True, False]:
torch._dynamo.reset()
torch._dynamo.config.dynamic_shapes = dynamic_shapes
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you use with patch to make sure the configuration changes here won't impact others?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

return BACKENDS["ipex"](gm, example_inputs, **kwargs_ipex)
@create_backend
def ipex(subgraph):
import intel_extension_for_pytorch # type: ignore[import] # noqa: F401
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do "try-catch" and fall back to eager on exception?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I checked other backends like onnx backend, they also don't have fall back path. So I'm not sure if it needs to be added.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I saw the "tvm" backend does fallbacks. Anyway, at least, we'd better print a readable error message on import error?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

have added a readable error message, thanks!

@jiayisunx jiayisunx requested review from jansel and jgong5 January 30, 2023 06:15
try:
import intel_extension_for_pytorch # type: ignore[import] # noqa: F401
except ImportError:
log.exception("ipex backend fails. Cannot import intel_extension_for_pytorch")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How about "Unable to import Intel Extension for PyTorch (IPEX). Please install the right version of IPEX that matches the PyTorch version being used. Refer to https://github.com/intel/intel-extension-for-pytorch for details."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's better, thank you!

@jiayisunx jiayisunx requested a review from jgong5 February 1, 2023 01:52
@drisspg drisspg added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Feb 1, 2023
@jiayisunx
Copy link
Copy Markdown
Collaborator Author

@jansel, could you please help to review this PR? thanks!

jansel added a commit that referenced this pull request Feb 3, 2023
This is a copy of #92067 to
resolve the merge conflicts with the next PR in the stack.

[ghstack-poisoned]
jansel added a commit that referenced this pull request Feb 3, 2023
…)"


This is a copy of #92067 to resolve the merge conflicts with the next PR in the stack.  Go ahead and land #92067, then I can delete this one.

cc mlazos soumith voznesenskym yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx desertfire

[ghstack-poisoned]
jansel added a commit that referenced this pull request Feb 3, 2023
This is a copy of #92067 to resolve the merge conflicts with the next PR in the stack.  Go ahead and land #92067, then I can delete this one.

cc mlazos soumith voznesenskym yanboliang penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx desertfire

[ghstack-poisoned]
@jiayisunx
Copy link
Copy Markdown
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Feb 3, 2023
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged module: dynamo open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants