[Mlir-commits] [mlir] [mlir][ArmNeon] Enable native I8MM integration testing on Darwin (PR #216098)
Federico Bruzzone
llvmlistbot at llvm.org
Tue Aug 18 11:10:02 PDT 2026
https://github.com/FedericoBruzzone updated https://github.com/llvm/llvm-project/pull/216098
>From 20580fb344400c5ef549d9559c61f9ead703ffd9 Mon Sep 17 00:00:00 2001
From: Federico Bruzzone <federico.bruzzone.i at gmail.com>
Date: Thu, 13 Aug 2026 17:57:58 +0200
Subject: [PATCH 1/4] [mlir][ArmNeon] Enable native I8MM integration testing on
Darwin
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
---
.../modules/MLIRCheckHardwareFeatures.cmake | 31 +++++++++++++++++--
.../CPU/ArmNeon/vector-contract-i8mm.mlir | 2 --
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake b/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake
index 3aea591d885f7..00555c0b53ced 100644
--- a/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake
+++ b/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake
@@ -26,6 +26,31 @@ function(check_sme_support_on_darwin output)
set(${output} ${local_result} PARENT_SCOPE)
endfunction(check_sme_support_on_darwin)
+# Checks whether I8MM is supported by the host Darwin (macOS) system. This is
+# implemented via `sysctl`, since Darwin has no equivalent of Linux's
+# auxiliary vector feature bits (hwcap).
+#
+# check_i8mm_support_on_darwin(
+# output_var
+# )
+function(check_i8mm_support_on_darwin output)
+ execute_process(
+ COMMAND sysctl -n hw.optional.arm.FEAT_I8MM
+ OUTPUT_VARIABLE sysctl_output
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET
+ RESULT_VARIABLE sysctl_result
+ )
+
+ if(sysctl_result EQUAL 0 AND sysctl_output STREQUAL "1")
+ set(local_result TRUE)
+ else()
+ set(local_result FALSE)
+ endif()
+ message(STATUS "Checking whether I8MM is supported by the host system (via sysctl hw.optional.arm.FEAT_I8MM): ${local_result}")
+ set(${output} ${local_result} PARENT_SCOPE)
+endfunction(check_i8mm_support_on_darwin)
+
# 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.
@@ -115,9 +140,11 @@ function(check_emulator mlir_e2e_tests hwcap_spec emulator_exec)
if(APPLE AND hwcap_spec STREQUAL "HWCAP2_SME")
check_sme_support_on_darwin(emulator_not_required)
+ elseif(APPLE AND hwcap_spec STREQUAL "HWCAP2_I8MM")
+ check_i8mm_support_on_darwin(emulator_not_required)
elseif(APPLE)
- # No Darwin mapping for anything other than SME (yet); conservatively
- # assume an emulator is required.
+ # No Darwin mapping for anything else (yet); conservatively assume an
+ # emulator is required.
set(emulator_not_required FALSE)
else()
check_hwcap(${hwcap_spec} emulator_not_required)
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
index f6012bbd3d0b2..dd96dbae2a09e 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
@@ -1,5 +1,3 @@
-// REQUIRES: arm-emulator
-
// DEFINE: %{compile} = mlir-opt %s \
// DEFINE: --convert-vector-to-scf --convert-scf-to-cf --convert-vector-to-llvm='enable-arm-neon enable-arm-i8mm' \
// DEFINE: --expand-strided-metadata --convert-to-llvm --finalize-memref-to-llvm \
>From a973fcf42deeb474f9ce75642f5c312384449737 Mon Sep 17 00:00:00 2001
From: Federico Bruzzone <federico.bruzzone.i at gmail.com>
Date: Tue, 18 Aug 2026 01:29:00 +0200
Subject: [PATCH 2/4] Address comments
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
---
.../Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
index dd96dbae2a09e..b4dbc664f7ed9 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
@@ -1,3 +1,5 @@
+// REQUIRES: mlir_arm_i8mm_tests
+
// DEFINE: %{compile} = mlir-opt %s \
// DEFINE: --convert-vector-to-scf --convert-scf-to-cf --convert-vector-to-llvm='enable-arm-neon enable-arm-i8mm' \
// DEFINE: --expand-strided-metadata --convert-to-llvm --finalize-memref-to-llvm \
>From 0226c8a1918ae201bb366d5d03ab4544b6d96a34 Mon Sep 17 00:00:00 2001
From: Federico Bruzzone <federico.bruzzone.i at gmail.com>
Date: Tue, 18 Aug 2026 20:04:34 +0200
Subject: [PATCH 3/4] Address comment
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
---
mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake b/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake
index 00555c0b53ced..567fbdb9d93ee 100644
--- a/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake
+++ b/mlir/cmake/modules/MLIRCheckHardwareFeatures.cmake
@@ -121,8 +121,8 @@ endfunction(check_hwcap)
# emulator_exec
# )
#
-# mlir_e2e_tests - MLIR CMake variables corresponding to the group of e2e tests
-# to check
+# mlir_e2e_tests - Name of the MLIR CMake variable to gate on; also used to
+# name the flag in the error message below.
# hwcap_spec - HWCAP value to check. This should correspond to the hardware
# capabilities required by the tests to be checked. Possible
# values are defined in hwcap.h in the Linux kernel.
>From cd7008516eddea7b80495cfe9ad74ea88e36c68f Mon Sep 17 00:00:00 2001
From: Federico Bruzzone <federico.bruzzone.i at gmail.com>
Date: Tue, 18 Aug 2026 20:09:27 +0200
Subject: [PATCH 4/4] [mlir][ArmNeon] Rename MLIR_RUN_ARM_I8MM_TESTS to
MLIR_RUN_ARM_NEON_TESTS; add missing lit.local.cfg
MLIR_RUN_ARM_I8MM_TESTS was misleading: both NEON and SVE have I8MM
variants, so the name didn't say which dialect's tests it gates. Renamed
to MLIR_RUN_ARM_NEON_TESTS (and the derived lit feature to
mlir_arm_neon_tests) to match the MLIR_RUN_ARM_SVE_TESTS/
MLIR_RUN_ARM_SME_TESTS naming convention. The hwcap check passed to
check_emulator() is unchanged (still "HWCAP2_I8MM"), so this is a pure
rename, not a behavior change.
Also add the lit.local.cfg for Linalg/CPU/ArmNeon/ that was missing
relative to its ArmSVE/ArmSME siblings, gating the whole directory on
the (renamed) build flag. matmul-i8.mlir's now-redundant per-file
REQUIRES is dropped in favor of the directory-level gate, matching
ArmSVE's style. vector-contract-i8mm.mlir (no directory-level gate of
its own) keeps its per-file REQUIRES, updated to the new name.
Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
---
mlir/test/CMakeLists.txt | 6 +++---
.../Integration/Dialect/Linalg/CPU/ArmNeon/lit.local.cfg | 9 +++++++++
.../Dialect/Linalg/CPU/ArmNeon/matmul-i8.mlir | 2 --
.../Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir | 2 +-
mlir/test/Integration/lit.local.cfg | 2 +-
mlir/test/lit.site.cfg.py.in | 6 +++---
6 files changed, 17 insertions(+), 10 deletions(-)
create mode 100644 mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/lit.local.cfg
diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt
index c2c426bc320bf..68644204bab4d 100644
--- a/mlir/test/CMakeLists.txt
+++ b/mlir/test/CMakeLists.txt
@@ -40,13 +40,13 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
option(MLIR_RUN_CUDA_SM90_TESTS "Run CUDA H100 tests.")
option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE tests.")
option(MLIR_RUN_ARM_SME_TESTS "Run Arm SME tests.")
- option(MLIR_RUN_ARM_I8MM_TESTS "Run Arm I8MM tests.")
+ option(MLIR_RUN_ARM_NEON_TESTS "Run Arm Neon tests.")
# Check whether an emulator is required - if yes then make sure that it's
# been set.
check_emulator(MLIR_RUN_ARM_SVE_TESTS "HWCAP_SVE" ARM_EMULATOR_EXECUTABLE)
check_emulator(MLIR_RUN_ARM_SME_TESTS "HWCAP2_SME" ARM_EMULATOR_EXECUTABLE)
- check_emulator(MLIR_RUN_ARM_I8MM_TESTS "HWCAP2_I8MM" ARM_EMULATOR_EXECUTABLE)
+ check_emulator(MLIR_RUN_ARM_NEON_TESTS "HWCAP2_I8MM" ARM_EMULATOR_EXECUTABLE)
# The native target may not be enabled when cross compiling, raise an error.
if(NOT MLIR_ENABLE_EXECUTION_ENGINE)
@@ -84,7 +84,7 @@ llvm_canonicalize_cmake_booleans(
MLIR_RUN_X86_TESTS
MLIR_RUN_ARM_SVE_TESTS
MLIR_RUN_ARM_SME_TESTS
- MLIR_RUN_ARM_I8MM_TESTS
+ MLIR_RUN_ARM_NEON_TESTS
MLIR_RUN_CUDA_SM80_TESTS
MLIR_RUN_CUDA_SM80_LT_TESTS
MLIR_RUN_CUDA_SM90_TESTS
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/lit.local.cfg b/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/lit.local.cfg
new file mode 100644
index 0000000000000..698fc7483d72e
--- /dev/null
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/lit.local.cfg
@@ -0,0 +1,9 @@
+import sys
+
+# ArmNeon tests must be enabled via build flag.
+if not config.mlir_run_arm_neon_tests:
+ config.unsupported = True
+
+# No JIT on win32.
+if sys.platform == "win32":
+ config.unsupported = True
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/matmul-i8.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/matmul-i8.mlir
index 70798738045ab..1a6f315cd2da4 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/matmul-i8.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmNeon/matmul-i8.mlir
@@ -1,5 +1,3 @@
-// REQUIRES: mlir_arm_i8mm_tests
-
// DEFINE: %{compile} = mlir-opt %s \
// DEFINE: -transform-interpreter -test-transform-dialect-erase-schedule \
// DEFINE: -cse -canonicalize -convert-vector-to-scf \
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir b/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
index b4dbc664f7ed9..1568c77465f7c 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/ArmNeon/vector-contract-i8mm.mlir
@@ -1,4 +1,4 @@
-// REQUIRES: mlir_arm_i8mm_tests
+// REQUIRES: mlir_arm_neon_tests
// DEFINE: %{compile} = mlir-opt %s \
// DEFINE: --convert-vector-to-scf --convert-scf-to-cf --convert-vector-to-llvm='enable-arm-neon enable-arm-i8mm' \
diff --git a/mlir/test/Integration/lit.local.cfg b/mlir/test/Integration/lit.local.cfg
index fc287f4ac878e..5578abcdb0ac6 100644
--- a/mlir/test/Integration/lit.local.cfg
+++ b/mlir/test/Integration/lit.local.cfg
@@ -13,7 +13,7 @@ def configure_aarch64_mcr_cmd():
if not (
config.mlir_run_arm_sve_tests
or config.mlir_run_arm_sme_tests
- or config.mlir_run_arm_i8mm_tests
+ or config.mlir_run_arm_neon_tests
):
config.substitutions.append(("%mcr_aarch64_cmd", mcr_cmd))
return
diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in
index 67bffb8f6e3cf..cfab27aceb88b 100644
--- a/mlir/test/lit.site.cfg.py.in
+++ b/mlir/test/lit.site.cfg.py.in
@@ -55,9 +55,9 @@ config.mlir_run_arm_sve_tests = @MLIR_RUN_ARM_SVE_TESTS@
if config.mlir_run_arm_sve_tests:
config.available_features.add("mlir_arm_sve_tests")
config.mlir_run_arm_sme_tests = @MLIR_RUN_ARM_SME_TESTS@
-config.mlir_run_arm_i8mm_tests = @MLIR_RUN_ARM_I8MM_TESTS@
-if config.mlir_run_arm_i8mm_tests:
- config.available_features.add("mlir_arm_i8mm_tests")
+config.mlir_run_arm_neon_tests = @MLIR_RUN_ARM_NEON_TESTS@
+if config.mlir_run_arm_neon_tests:
+ config.available_features.add("mlir_arm_neon_tests")
config.mlir_run_x86_tests = @MLIR_RUN_X86_TESTS@
config.mlir_run_riscv_vector_tests = "@MLIR_RUN_RISCV_VECTOR_TESTS@"
config.mlir_run_cuda_tensor_core_tests = @MLIR_RUN_CUDA_TENSOR_CORE_TESTS@
More information about the Mlir-commits
mailing list