vvchernov commented on code in PR #15685:
URL: https://github.com/apache/tvm/pull/15685#discussion_r1321006825


##########
python/tvm/target/x86.py:
##########
@@ -16,127 +16,19 @@
 # under the License.
 """Common x86 related utilities"""
 from .._ffi import register_func
-from .target import Target
+from . import _ffi_api
 
 
-@register_func("tvm.target.x86.target_has_sse41")
-def target_has_sse41(target):
-    return (
-        target_has_sse42(target)
-        or target_has_avx(target)
-        or target_has_avx2(target)
-        or target_has_avx512(target)
-        or target_has_vnni(target)
-        or target
-        in {
-            "btver2",
-            "penryn",
-        }
-    )
-
-
-@register_func("tvm.target.x86.target_has_sse42")
-def target_has_sse42(target):
-    return (
-        target_has_avx(target)
-        or target_has_avx2(target)
-        or target_has_avx512(target)
-        or target_has_vnni(target)
-        or target
-        in {
-            "silvermont",
-            "slm",
-            "goldmont",
-            "goldmont-plus",
-            "tremont",
-            "nehalem",
-            "corei7",
-            "westmere",
-            "bdver1",
-            "bdver2",
-            "bdver3",
-            "x86-64-v2",
-        }
-    )
-
-
-@register_func("tvm.target.x86.target_has_avx")
-def target_has_avx(target):
-    return (
-        target_has_avx2(target)
-        or target_has_avx512(target)
-        or target_has_vnni(target)
-        or target in {"sandybridge", "corei7-avx", "ivybridge", "core-avx-i"}
-    )
-
-
-@register_func("tvm.target.x86.target_has_avx2")
-def target_has_avx2(target):
-    return (
-        target_has_avx512(target)
-        or target_has_vnni(target)
-        or target
-        in {
-            "haswell",
-            "core-avx2",
-            "broadwell",
-            "skylake",
-            "bdver4",
-            "znver1",
-            "znver2",
-            "znver3",
-            "x86-64-v3",
-        }
-    )
-
-
-@register_func("tvm.target.x86.target_has_avx512")
-def target_has_avx512(target):
-    return target in {
-        "skylake-avx512",
-        "skx",
-        "knl",
-        "knm",
-        "x86-64-v4",
-        "cannonlake",
-        # explicit enumeration of VNNI capable due to collision with alderlake
-        "cascadelake",
-        "icelake-client",
-        "icelake-server",
-        "rocketlake",
-        "tigerlake",
-        "cooperlake",
-        "sapphirerapids",
-    }
-
-
-@register_func("tvm.target.x86.target_has_vnni")
-def target_has_vnni(target):
-    return target in {
-        "cascadelake",
-        "icelake-client",
-        "icelake-server",
-        "rocketlake",
-        "tigerlake",
-        "cooperlake",
-        "sapphirerapids",
-        "alderlake",
-    }
-
-
-@register_func("tvm.target.x86.target_has_amx")
-def target_has_amx(target):
-    return target in {
-        "sapphirerapids",
-    }
+@register_func("tvm.target.x86.target_has_feature")
+def target_has_feature(feature, target=None):
+    return _ffi_api.llvm_x86_has_feature(feature, target)
 
 
 @register_func("tvm.topi.x86.utils.get_simd_32bit_lanes")
 def get_simd_32bit_lanes():
-    mcpu = Target.current().mcpu
     fp32_vec_len = 4
-    if target_has_avx512(mcpu):
+    if target_has_feature("avx512bw"):

Review Comment:
   Are you sure that it should be check on avx512bw only? Here and below in the 
code



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to