forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quantization oneDNN backend only support VNNI CPU (pytorch#103653)
**Summary** - Update the quantization document that default qconfig with oneDNN backend is recommended to be used on CPUs with Vector Neural Network Instruction support. - Add the warning message when user uses default qconfig with oneDNN backend on CPU without Vector Neural Network Instruction support. Pull Request resolved: pytorch#103653 Approved by: https://github.com/jgong5, https://github.com/malfet
- Loading branch information
1 parent
7b3242d
commit 9832cfb
Showing
11 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <ATen/cpu/Utils.h> | ||
#include <cpuinfo.h> | ||
|
||
namespace at { | ||
namespace cpu { | ||
|
||
bool is_cpu_support_vnni() { | ||
return cpuinfo_initialize() && cpuinfo_has_x86_avx512vnni(); | ||
} | ||
|
||
} // namespace cpu | ||
} // namespace at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <c10/macros/Export.h> | ||
|
||
namespace at { | ||
namespace cpu { | ||
|
||
// Detect if CPU support Vector Neural Network Instruction. | ||
TORCH_API bool is_cpu_support_vnni(); | ||
|
||
} // namespace cpu | ||
} // namespace at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from torch.types import _bool | ||
|
||
# Defined in torch/csrc/cpu/Module.cpp | ||
|
||
def _is_cpu_support_vnni() -> _bool: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
from . import amp | ||
import torch | ||
|
||
def _is_cpu_support_vnni() -> bool: | ||
r"""Returns a bool indicating if CPU supports VNNI.""" | ||
return torch._C._cpu._is_cpu_support_vnni() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <ATen/cpu/Utils.h> | ||
#include <torch/csrc/cpu/Module.h> | ||
#include <torch/csrc/utils/pybind.h> | ||
|
||
namespace torch { | ||
namespace cpu { | ||
|
||
void initModule(PyObject* module) { | ||
auto m = py::handle(module).cast<py::module>(); | ||
|
||
auto cpu = m.def_submodule("_cpu", "cpu related pybind."); | ||
cpu.def("_is_cpu_support_vnni", at::cpu::is_cpu_support_vnni); | ||
} | ||
|
||
} // namespace cpu | ||
} // namespace torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
#include <torch/csrc/python_headers.h> | ||
|
||
namespace torch { | ||
namespace cpu { | ||
|
||
void initModule(PyObject* module); | ||
|
||
} // namespace cpu | ||
} // namespace torch |