Skip to content
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

Enable x86 CPU vectorization on windows [submodule sleef] #118980

Closed
wants to merge 6 commits into from

Conversation

xuhancn
Copy link
Collaborator

@xuhancn xuhancn commented Feb 2, 2024

Enable VEC on Windows OS.

  1. Fix some type defination gap between Windows and Linux.
  2. Fix some operator not support on Windows, such as [], /.
  3. Enable static sleef library build on Windows.
  4. Disable unsupported function overloading on MSVC.
  5. Upgrade submodule sleef lib, which fixed build issue on Windows.
  6. Fixed bazel build issues.
  7. Fix test app not link to sleef on Windows.

Note: If rebuild fail after pulled this PR, please sync sleef submodule by run:

git submodule sync
git submodule update --init --recursive

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @frank-wei

Copy link

pytorch-bot bot commented Feb 2, 2024

🔗 Helpful Links

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

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

❌ 1 New Failure, 2 Unrelated Failures

As of commit 4336fb0 with merge base a001b4b (image):

NEW FAILURE - The following job has 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.

@github-actions github-actions bot added the module: cpu CPU specific problem (e.g., perf, algorithm) label Feb 2, 2024
aten/src/ATen/native/cpu/GridSamplerKernel.cpp Outdated Show resolved Hide resolved
aten/src/ATen/native/cpu/GridSamplerKernel.cpp Outdated Show resolved Hide resolved
aten/src/ATen/native/cpu/GridSamplerKernel.cpp Outdated Show resolved Hide resolved
aten/src/ATen/native/cpu/GridSamplerKernel.cpp Outdated Show resolved Hide resolved
@xuhancn xuhancn added module: intel Specific to x86 architecture intel This tag is for PR from Intel labels Feb 5, 2024
@xuhancn xuhancn self-assigned this Feb 5, 2024
@xuhancn xuhancn added the module: windows Windows support for PyTorch label Feb 5, 2024
@xuhancn xuhancn requested a review from jgong5 February 5, 2024 09:50
@xuhancn xuhancn marked this pull request as ready for review February 5, 2024 09:50
@ezyang
Copy link
Contributor

ezyang commented Feb 6, 2024

@pytorchbot merge

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

Merge failed

Reason: 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.

Details for Dev Infra team Raised by workflow job

@xuhancn
Copy link
Collaborator Author

xuhancn commented Feb 6, 2024

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Feb 6, 2024
@xuhancn
Copy link
Collaborator Author

xuhancn commented Feb 6, 2024

@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: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@ezyang
Copy link
Contributor

ezyang commented Feb 6, 2024

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: .github/workflows/pull.yml / linux-jammy-py3-clang12-executorch / test (executorch, 1, 1, linux.2xlarge)

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

@xuhancn
Copy link
Collaborator Author

xuhancn commented Mar 29, 2024

merge PR avoid code getting stale, @huydhn please update fb_code sleef to shibatch/sleef@60e76d2, it should be works well. CC: @malfet

@atalman
Copy link
Contributor

atalman commented Mar 30, 2024

@pytorchbot revert -m "Breaks internal build" -c ghfirst

@atalman
Copy link
Contributor

atalman commented Mar 30, 2024

Please note multiple jobs are broken. here are some of the errors:

xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:495:16: error: cannot initialize a parameter of type '__m256 (*)(__m256)' with an lvalue of type 'const __m256 (__m256)': different return type ('__m256' (vector of 8 'float' values) vs 'const __m256' (vector of 8 'float' values))
    return map(Sleef_logf8_u10);
               ^~~~~~~~~~~~~~~
xplat/caffe2/aten/src/ATen/native/cpu/UnaryOpsKernel.cpp:157:52: note: in instantiation of member function 'at::vec::Vectorized16<c10::BFloat16>::log' requested here
                return (x_vec / (kOneVec - x_vec)).log();
                                                   ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:281:58: note: passing argument to parameter 'vop' here
  Vectorized<T> map(SLEEF_CONST __m256 (*SLEEF_CONST_OLD vop)(__m256)) const {
                                                         ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:495:16: error: cannot initialize a parameter of type '__m256 (*)(__m256)' with an lvalue of type 'const __m256 (__m256)': different return type ('__m256' (vector of 8 'float' values) vs 'const __m256' (vector of 8 'float' values))
    return map(Sleef_logf8_u10);
               ^~~~~~~~~~~~~~~
xplat/caffe2/aten/src/ATen/native/cpu/UnaryOpsKernel.cpp:157:52: note: in instantiation of member function 'at::vec::Vectorized16<c10::Half>::log' requested here
                return (x_vec / (kOneVec - x_vec)).log();
                                                   ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:281:58: note: passing argument to parameter 'vop' here
  Vectorized<T> map(SLEEF_CONST __m256 (*SLEEF_CONST_OLD vop)(__m256)) const {
                                                         ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:510:16: error: cannot initialize a parameter of type '__m256 (*)(__m256)' with an lvalue of type 'const __m256 (__m256)': different return type ('__m256' (vector of 8 'float' values) vs 'const __m256' (vector of 8 'float' values))
    return map(Sleef_sinhf8_u10);
               ^~~~~~~~~~~~~~~~
xplat/caffe2/aten/src/ATen/native/cpu/UnaryOpsKernel.cpp:371:60: note: in instantiation of member function 'at::vec::Vectorized16<c10::BFloat16>::sinh' requested here
        [=](Vectorized<scalar_t> self_vec){return self_vec.sinh();});
                                                           ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:281:58: note: passing argument to parameter 'vop' here
  Vectorized<T> map(SLEEF_CONST __m256 (*SLEEF_CONST_OLD vop)(__m256)) const {
                                                         ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:510:16: error: cannot initialize a parameter of type '__m256 (*)(__m256)' with an lvalue of type 'const __m256 (__m256)': different return type ('__m256' (vector of 8 'float' values) vs 'const __m256' (vector of 8 'float' values))
    return map(Sleef_sinhf8_u10);
               ^~~~~~~~~~~~~~~~
xplat/caffe2/aten/src/ATen/native/cpu/UnaryOpsKernel.cpp:371:60: note: in instantiation of member function 'at::vec::Vectorized16<c10::Half>::sinh' requested here
        [=](Vectorized<scalar_t> self_vec){return self_vec.sinh();});
                                                           ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:281:58: note: passing argument to parameter 'vop' here
  Vectorized<T> map(SLEEF_CONST __m256 (*SLEEF_CONST_OLD vop)(__m256)) const {
                                                         ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:516:16: error: cannot initialize a parameter of type '__m256 (*)(__m256)' with an lvalue of type 'const __m256 (__m256)': different return type ('__m256' (vector of 8 'float' values) vs 'const __m256' (vector of 8 'float' values))
    return map(Sleef_coshf8_u10);
               ^~~~~~~~~~~~~~~~
xplat/caffe2/aten/src/ATen/native/cpu/UnaryOpsKernel.cpp:380:60: note: in instantiation of member function 'at::vec::Vectorized16<c10::BFloat16>::cosh' requested here
        [=](Vectorized<scalar_t> self_vec){return self_vec.cosh();});
                                                           ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:281:58: note: passing argument to parameter 'vop' here
  Vectorized<T> map(SLEEF_CONST __m256 (*SLEEF_CONST_OLD vop)(__m256)) const {
                                                         ^
xplat/caffe2/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h:516:16: error: cannot initialize a parameter of type '__m256 (*)(__m256)' with an lvalue of type 'const __m256 (__m256)': different return type ('__m256' (vector of 8 'float' values) vs 'const __m256' (vector of 8 'float' values))
    return map(Sleef_coshf8_u10);
               ^~~~~~~~~~~~~~~~
xplat/caffe2/aten/src/ATen/native/cpu/UnaryOpsKernel.cpp:380:60: note: in instantiation of member function 'at::vec::Vectorized16<c10::Half>::cosh' requested here
        [=](Vectorized<scalar_t> self_vec){return self_vec.cosh();});

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Mar 30, 2024
…18980)"

This reverts commit d94db5f.

Reverted #118980 on behalf of https://github.com/atalman due to Breaks internal build ([comment](#118980 (comment)))
@pytorchmergebot
Copy link
Collaborator

@xuhancn your PR has been successfully reverted.

@xuhancn
Copy link
Collaborator Author

xuhancn commented Mar 30, 2024

@pytorchmergebot 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: 1 jobs have failed, first few of them are: trunk / linux-focal-rocm6.0-py3.8 / build

Details for Dev Infra team Raised by workflow job

@xuhancn
Copy link
Collaborator Author

xuhancn commented Mar 31, 2024

@pytorchmergebot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 3 checks: pull / linux-jammy-py3.8-gcc11 / test (default, 2, 3, linux.2xlarge), pull / linux-jammy-py3.8-gcc11 / test (default, 3, 3, linux.2xlarge), linux-binary-libtorch-cxx11-abi / libtorch-rocm6_0-shared-with-deps-cxx11-abi-build / build

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

@huydhn
Copy link
Contributor

huydhn commented Mar 31, 2024

@atalman I'm importing the sleef module to unblocking this internally, I have the diff to import sleef at D55567582. We can rebase this on top to see if it fixes the build issue.

ozanMSFT added a commit to iremyux/pytorch that referenced this pull request Apr 19, 2024
sanketpurandare pushed a commit to sanketpurandare/pytorch that referenced this pull request Apr 22, 2024
…8980)

Enable VEC on Windows OS.
1. Fix some type defination gap between Windows and Linux.
2. Fix some operator not support on Windows, such as [], /.
3. Enable static sleef library build on Windows.
4. Disable unsupported function overloading on MSVC.
5. Upgrade submodule sleef lib, which fixed build issue on Windows.
6. Fixed bazel build issues.
7. Fix test app not link to sleef on Windows.

Note: If rebuild fail after pulled this PR, please sync `sleef` submodule by run:
```cmd
git submodule sync
git submodule update --init --recursive
```

Pull Request resolved: pytorch#118980
Approved by: https://github.com/jgong5, https://github.com/ezyang, https://github.com/malfet
pytorch-bot bot pushed a commit that referenced this pull request Apr 22, 2024
Subsequent PR to #118980, fix sleef build warning.

submodule sleef, include this sleef PR: shibatch/sleef#514

Pull Request resolved: #122168
Approved by: https://github.com/jgong5, https://github.com/ezyang
pytorch-bot bot pushed a commit that referenced this pull request Apr 22, 2024
…18980)"

This reverts commit 2b06098.

Reverted #118980 on behalf of https://github.com/zou3519 due to This caused build failures for 2+ pytorch devs, so we're reverting it to be safe ([comment](#118980 (comment)))
sanketpurandare pushed a commit to sanketpurandare/pytorch that referenced this pull request Apr 22, 2024
sanketpurandare pushed a commit to sanketpurandare/pytorch that referenced this pull request Apr 22, 2024
…8980)

Enable VEC on Windows OS.
1. Fix some type defination gap between Windows and Linux.
2. Fix some operator not support on Windows, such as [], /.
3. Enable static sleef library build on Windows.
4. Disable unsupported function overloading on MSVC.
5. Upgrade submodule sleef lib, which fixed build issue on Windows.
6. Fixed bazel build issues.
7. Fix test app not link to sleef on Windows.

Note: If rebuild fail after pulled this PR, please sync `sleef` submodule by run:
```cmd
git submodule sync
git submodule update --init --recursive
```

Pull Request resolved: pytorch#118980
Approved by: https://github.com/jgong5, https://github.com/ezyang, https://github.com/malfet
pytorch-bot bot pushed a commit that referenced this pull request Apr 22, 2024
Enable VEC on Windows OS.
1. Fix some type defination gap between Windows and Linux.
2. Fix some operator not support on Windows, such as [], /.
3. Enable static sleef library build on Windows.
4. Disable unsupported function overloading on MSVC.
5. Upgrade submodule sleef lib, which fixed build issue on Windows.
6. Fixed bazel build issues.
7. Fix test app not link to sleef on Windows.

Pull Request resolved: #118980
Approved by: https://github.com/jgong5, https://github.com/ezyang, https://github.com/malfet
pytorch-bot bot pushed a commit that referenced this pull request Apr 22, 2024
…18980)"

This reverts commit aa74a8b.

Reverted #118980 on behalf of https://github.com/huydhn due to Sorry for revert your change one more time but the hard part is that it breaks lot of internal builds ([comment](#118980 (comment)))
iremyux added a commit to iremyux/pytorch that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/binaries_libtorch Trigger binary build and upload jobs for libtorch on the PR ciflow/trunk Trigger trunk jobs on your pull request intel This tag is for PR from Intel Merged module: cpu CPU specific problem (e.g., perf, algorithm) module: intel Specific to x86 architecture module: windows Windows support for PyTorch open source Reverted topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet