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

[TOPI] VNNI support for int8 dense #10230

Merged
merged 19 commits into from
Feb 15, 2022
Prev Previous commit
Next Next commit
add vnni check
  • Loading branch information
masahi committed Feb 13, 2022
commit eb4740401eb02141279b6a2509eaf6a0a2ddcbd3
5 changes: 4 additions & 1 deletion python/tvm/topi/x86/dense_alter_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .dense import _default_dense_pack_config
from ..utils import get_const_tuple
from ..nn import dense_alter_layout
from .utils import target_has_vnni


@dense_alter_layout.register(["cpu", "arm_cpu"])
Expand All @@ -34,9 +35,11 @@ def _alter_dense_layout(attrs, inputs, tinfos, out_type):
out_dtype = out_type.dtype
M, K = get_const_tuple(data_tensor.shape)
N, _ = get_const_tuple(weight_tensor.shape)
mcpu = tvm.target.Target.current().mcpu

if (
"int8" in data_tensor.dtype
target_has_vnni(mcpu)
and "int8" in data_tensor.dtype
and weight_tensor.shape[0] % 16 == 0
and weight_tensor.shape[1] % 4 == 0
):
Expand Down