KEMBAR78
PyTorch VS2022 official build Windows binary illegal instruction on AVX2(max ISA level) CPU · Issue #145702 · pytorch/pytorch · GitHub
Skip to content

PyTorch VS2022 official build Windows binary illegal instruction on AVX2(max ISA level) CPU #145702

@xuhancn

Description

@xuhancn

🐛 Describe the bug

Background

This issue is re-submit of #145042, because of we taked about this issue and we think the original issue will make us confuse it is a XPU related issue. But acturally it is a CPU only issue.

Reproduce steps:

  1. It is easy step to reproduce it, just switch Windows CPU build to VS2022. Reference to [don't merge] use vs2022 build windows cpu wheel. #143791
  2. Add ciflow/binaries tag to trigger nightly binary build.
  3. Download wheel-py3_10-cpu wheel from Artifacts page https://github.com/pytorch/pytorch/actions/runs/12972478091?pr=143791
  4. Install the wheel to the CPU, which max ISA level is AVX2.
  5. Run the reproduce code via pytest:
# cpu_vs2022_inst_issue.py
import torch
class TestClass:
    def test_grid_sampler_2d(self):
        torch.manual_seed(0)
        b = torch.rand(2, 13, 10, 2, dtype=torch.float64)
        a = torch.rand(2, 3, 5, 20, dtype=torch.float64)
        torch.grid_sampler_2d(a, b, interpolation_mode=0, padding_mode=0, align_corners=False)

command line:

pytest -v cpu_vs2022_inst_issue.py

Root cause

Image

I debugged it via WinDBG, the reason is VS2022 genarated AVX512 instruction, and it is run on the client CPU, which max ISA level is AVX2.

Additional information

  1. This issue is not impact on currenct PyTorch officical binaries, because of current PyTorch official binaries built by VS2019.
  2. The PyTorch CI can't test this issue, due to the CI runs on server CPU, which is support AVX512.
  3. I tried to reproduce it on my local VS2022 build environment, but it is can't reproduce. I think it only occurred issue on PyTorch official build environment.
  4. I just open this issue for track it, to avoid to upgrade VS2022 and occurred this issue, in the further.
  5. It is not impact on official PyTorch binary, so I will add low priority tag.

cc @ezyang @gchanan @zou3519 @kadeng @msaroufim @malfet @seemethere @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10

Metadata

Metadata

Labels

high prioritymodule: buildBuild system issuesmodule: cpuCPU specific problem (e.g., perf, algorithm)module: crashProblem manifests as a hard crash, as opposed to a RuntimeErrormodule: windowsWindows support for PyTorchtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions