Skip to content

CPU Capability is being reported as AVX512 even if PyTorch is built without AVX512 ATen kernels #66712

@imaginary-person

Description

@imaginary-person

🐛 Critical bug

If a PyTorch release is built with a compiler that doesn't support all the AVX512 intrinsics in the codebase, then it won't have ATen AVX512 kernels, but at runtime, CPU capability would still be incorrectly returned as AVX512 on a machine that supports AVX512. It seems that PyTorch Linux releases are done on CentOS with gcc 7.3, so this bug would manifest in the 1.10 release, unless fixed. gcc versions below 9.0 don't support all the AVX512 intrinsics in the codebase, such as _mm512_set_epi8.
PyTorch nightly releases also seem to have this issue.

I'm sorry for having introduced this bug. 😞

To Reproduce

  1. Build from source with a compiler that doesn't support all the AVX512 intrinsics used in the codebase.
    gcc versions below 9 can be used to reproduce the issue on a machine that supports AVX512.
  2. ATen AVX512 kernels won't be compiled.
  3. Open a Python interpreter. Use print(torch.__config__.show())
  4. CPU Capability would be displayed as AVX512.

Expected behavior

If a binary is built with a compiler that doesn't support all the necessary AVX512 intrinsics, then it shouldn't report CPU Capability as AVX512 on a machine that supports all the required AVX512 instruction sets.

Environment

PyTorch Builder seems to be using CentOS with gcc 7.3 for releases, so nightly releases are being built without AVX512 support in ATen, but CPU Capability is still being displayed as AVX512 in print(torch.__config__.show()) .

  • PyTorch Version (e.g., 1.0):
    Nightly releases

Fix

There are two parts to this issue -

  1. To ensure that users are not misled, CPU Capability should be returned as AVX512 at runtime only if the binary was built with a compiler that supports all the AVX512 intrinsics in the codebase. I opened Binaries without AVX512 kernels shouldn't report CPU Capability as AVX512 on machines with AVX512 support #66703 for it.
  2. To ensure that AVX512 ATen kernels are included in the release binaries, can gcc version 9 or above be used instead in PyTorch Builder? Thanks!

cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @seemethere @malfet @pytorch/pytorch-dev-infra

Metadata

Metadata

Assignees

Labels

high prioritymodule: binariesAnything related to official binaries that we release to usersmodule: ciRelated to continuous integrationtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions