Skip to content

Conversation

@ZhiweiYan-96
Copy link
Collaborator

@ZhiweiYan-96 ZhiweiYan-96 commented Nov 3, 2024

Motivation

This PR is a precursor to #133080. The PR extracts common logics in convolution and quantized convolution into Utils.cpp. With such modification, these two operators could share codes like input format querying, op layout querying.

Stack from ghstack (oldest at bottom):

cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 3, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit dd2ec92 with merge base ffb9790 (image):
💚 Looks good so far! There are no failures yet. 💚

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

[ghstack-poisoned]
[ghstack-poisoned]
@ZhiweiYan-96 ZhiweiYan-96 added topic: not user facing topic category ciflow/xpu Run XPU CI tasks ciflow/trunk Trigger trunk jobs on your pull request labels Nov 4, 2024
[ghstack-poisoned]
@guangyey
Copy link
Collaborator

guangyey commented Nov 4, 2024

Is it OK to add aten/src/ATen/native/mkldnn/xpu/*.cpp and aten/src/ATen/native/mkldnn/xpu/*.h to

'aten/src/ATen/native/mps/**/*.metal',

I think we need this autoformat.

#include <ATen/ATen.h>
#include <ATen/Tensor.h>
#include <ATen/core/Tensor.h>
#include <iostream>
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do we need this code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

has removed, thanks for suggestions

Copy link
Collaborator

@EikanWang EikanWang left a comment

Choose a reason for hiding this comment

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

Overall, LGTM

auto dims = adims.data();
auto data_type = static_cast<dnnl_data_type_t>(
get_onednn_dtype(src, /*allow_undef*/ true));
get_onednn_dtype_include_double(src, /*allow_undef*/ false));
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the motivation behind true->false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be a bug fixing from IPEX by @Stonepia , changing this into false would trigger runtime error if met out-of-expectation error. Otherwise, the error might be hidden.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is because that if we allow_undef = true, this data_type might be undef, then the consecutive call like below will get wrong result, and cause silent fail.

// when data_type is undef, the md will be something like `0x1`
dnnl_memory_desc_create_with_strides(&md, ndims, dims, data_type, strides);

Copy link
Collaborator

Choose a reason for hiding this comment

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

So, pls. add comments here to describe the tricky change.

@EikanWang
Copy link
Collaborator

@ZhiweiYan-96 , pls. add detailed descriptions to help reviewers understand your changes.

@ZhiweiYan-96
Copy link
Collaborator Author

ZhiweiYan-96 commented Nov 4, 2024

Is it OK to add aten/src/ATen/native/mkldnn/xpu/*.cpp and aten/src/ATen/native/mkldnn/xpu/*.h to

'aten/src/ATen/native/mps/**/*.metal',

I think we need this autoformat.

hi, @guangyey The number of PRs (8 prs) in current stack exceeds the recommendation of ghstack, I would create another PR to enable formatting.

[ghstack-poisoned]
@ZhiweiYan-96 ZhiweiYan-96 requested a review from guangyey November 4, 2024 07:55
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@ZhiweiYan-96
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Command git -C /home/runner/work/pytorch/pytorch cherry-pick -x c964050d39a91d5c18b9f5b4e57cf7d2626e7e3a returned non-zero exit code 1

Auto-merging aten/src/ATen/native/mkldnn/xpu/Conv.cpp
CONFLICT (content): Merge conflict in aten/src/ATen/native/mkldnn/xpu/Conv.cpp
Auto-merging aten/src/ATen/native/mkldnn/xpu/detail/Conv.cpp
CONFLICT (content): Merge conflict in aten/src/ATen/native/mkldnn/xpu/detail/Conv.cpp
Auto-merging aten/src/ATen/native/mkldnn/xpu/detail/Deconv.cpp
CONFLICT (content): Merge conflict in aten/src/ATen/native/mkldnn/xpu/detail/Deconv.cpp
Auto-merging aten/src/ATen/native/mkldnn/xpu/detail/Utils.cpp
CONFLICT (content): Merge conflict in aten/src/ATen/native/mkldnn/xpu/detail/Utils.cpp
Auto-merging aten/src/ATen/native/mkldnn/xpu/detail/Utils.h
CONFLICT (content): Merge conflict in aten/src/ATen/native/mkldnn/xpu/detail/Utils.h
error: could not apply c964050d39... [Intel GPU] Extract common utils for conv&qconv
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Details for Dev Infra team Raised by workflow job

@ZhiweiYan-96
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
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

zhangxiaoli73 pushed a commit to zhangxiaoli73/pytorch that referenced this pull request Nov 13, 2024
# Motivation
This PR is a precursor to pytorch#133080. The PR extracts common logics in convolution and quantized convolution into `Utils.cpp`. With such modification, these two operators could share codes like input format querying, op layout querying.

Pull Request resolved: pytorch#139580
Approved by: https://github.com/EikanWang, https://github.com/guangyey, https://github.com/malfet
ghstack dependencies: pytorch#139721
zero000064 pushed a commit to zero000064/pytorch that referenced this pull request Nov 14, 2024
# Motivation
This PR is a precursor to pytorch#133080. The PR extracts common logics in convolution and quantized convolution into `Utils.cpp`. With such modification, these two operators could share codes like input format querying, op layout querying.

Pull Request resolved: pytorch#139580
Approved by: https://github.com/EikanWang, https://github.com/guangyey, https://github.com/malfet
ghstack dependencies: pytorch#139721
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
# Motivation
This PR is a precursor to pytorch#133080. The PR extracts common logics in convolution and quantized convolution into `Utils.cpp`. With such modification, these two operators could share codes like input format querying, op layout querying.

Pull Request resolved: pytorch#139580
Approved by: https://github.com/EikanWang, https://github.com/guangyey, https://github.com/malfet
ghstack dependencies: pytorch#139721
@github-actions github-actions bot deleted the gh/ZhiweiYan-96/35/head branch December 12, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks Merged module: cpu CPU specific problem (e.g., perf, algorithm) open source topic: not user facing topic category

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants