[Mlir-commits] [mlir] [mlir][test] Make SME e2e tests require an emulator (PR #86489)
Mehdi Amini
llvmlistbot at llvm.org
Mon Apr 1 11:01:43 PDT 2024
================
@@ -13,6 +13,104 @@ set(MLIR_CMAKE_DIR
# Passed to lit.site.cfg.py.in to set up the path where to find libraries.
set(MLIR_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+# Checks whether the specified hardware capability is supported by the host
+# Linux system. This is implemented by checking auxiliary vector feature
+# provided by the Linux kernel.
+#
+# check_hwcap(
+# hwcap_spec
+# output_var
+# )
+#
+# hwcap_spec - HWCAP value to check - these are defined in hwcap.h in the Linux
+# kernel.
+#
+# output_var - Output variable to use to save the results (TRUE for supported,
+# FALSE for not supported).
+#
+# EXAMPLES:
+#
+# check_hwcap("HWCAP2_SME" SME_EMULATOR_REQUIRED)
+#
+function(check_hwcap hwcap_spec output)
+ set(hwcap_test_src
+ [====[
+ #include <asm/hwcap.h>
+ #include <sys/auxv.h>
+
+ int main(void)
+ {
+ long hwcaps = getauxval(AT_<HWCAP_VEC>);
+ return (hwcaps & <HWCAP_SPEC>) != 0;
+ }
+ ]====]
+ )
----------------
joker-eph wrote:
I thought you'd write some inline ASM performing a simple SVE operation and check that it does not crash, so that you wouldn't depend on any header.
I'm fine with this though.
https://github.com/llvm/llvm-project/pull/86489
More information about the Mlir-commits
mailing list