From db8ea663c7a53e5f5afc8a5341f6add9e721d649 Mon Sep 17 00:00:00 2001 From: Martin Klacer Date: Fri, 6 Mar 2026 16:45:01 +0000 Subject: [PATCH 1/2] kleidiai: add cpu feature detection to CI run script Signed-off-by: Martin Klacer Change-Id: I663adc3a7691a98e7dac5488962c13cc344f034a --- ci/run.sh | 56 ++++++++++++++++++++++-- requirements/requirements-tool_bench.txt | 3 +- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/ci/run.sh b/ci/run.sh index 96755ea13e3..dc62f3b251d 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -135,14 +135,62 @@ fi if [ -n "${GG_BUILD_KLEIDIAI}" ]; then echo ">>===== Enabling KleidiAI support" + # Detect candidate arch options for the current CPU + I8MM="" + FP16="" + SME="" + SVE="" + if [ "$(uname -s)" == "Darwin" ]; then + # Detect i8mm + if [ $(sysctl -n hw.optional.arm.FEAT_I8MM) -eq 1 ]; then + I8MM="+i8mm" + fi + # Detect FP16 + if [ $(sysctl -n hw.optional.arm.FEAT_FP16) -eq 1 ]; then + FP16="+fp16" + fi + # Detect SME version + if [ $(sysctl -n hw.optional.arm.FEAT_SME2) -eq 1 ]; then + SME="+sme2" + elif [ $(sysctl -n hw.optional.arm.FEAT_SME) -eq 1 ]; then + SME="+sme" + fi + # Disable SVE on Darwin + SVE="+nosve" + elif [ "$(uname -s)" == "Linux" ]; then + # Detect i8mm + if grep "i8mm" /proc/cpuinfo -q; then + I8MM="+i8mm" + fi + # Detect FP16 + if grep "fphp" /proc/cpuinfo -q; then + FP16="+fp16" + fi + # Detect SME version + if grep "sme2" /proc/cpuinfo -q; then + SME="+sme2" + elif grep "sme" /proc/cpuinfo -q; then + SME="+sme" + fi + # Detect SVE version if allowed + if [ -z ${GG_BUILD_NO_SVE} ]; then + if grep "sve2" /proc/cpuinfo -q; then + SVE="+sve2" + elif grep "sve" /proc/cpuinfo -q; then + SVE="+sve" + fi + + fi + fi + + # Configure usable candidates based on CPU options CANDIDATES=( - "armv9-a+dotprod+i8mm+sve2" - "armv9-a+dotprod+i8mm" - "armv8.6-a+dotprod+i8mm" + "armv9-a+dotprod${FP16}${I8MM}${SME}${SVE}" + "armv8.6-a+dotprod${FP16}${I8MM}${SME}${SVE}" + "armv8.2-a+dotprod${FP16}${I8MM}${SME}${SVE}" "armv8.2-a+dotprod" ) CPU="" - for cpu in "${CANDIDATES[@]}"; do if echo 'int main(){}' | ${CXX:-c++} -march="$cpu" -x c++ - -c -o /dev/null >/dev/null 2>&1; then CPU="$cpu" diff --git a/requirements/requirements-tool_bench.txt b/requirements/requirements-tool_bench.txt index 3bb74fb9d01..94e28006f79 100644 --- a/requirements/requirements-tool_bench.txt +++ b/requirements/requirements-tool_bench.txt @@ -1,7 +1,8 @@ aiohttp~=3.9.3 pytest~=8.3.3 huggingface_hub>=0.34.0,<1.0 -matplotlib~=3.10.0 +matplotlib~=3.10.0; python_version>="3.10" +matplotlib>=3.9.0; python_version<"3.10" numpy~=1.26.4 openai~=2.14.0 pandas~=2.2.3 From b1f856af724afde2380223e1ae6e05399c6a8fe2 Mon Sep 17 00:00:00 2001 From: Martin Klacer Date: Wed, 11 Mar 2026 15:24:43 +0000 Subject: [PATCH 2/2] kleidiai: revert unrelated requirements change Signed-off-by: Martin Klacer --- requirements/requirements-tool_bench.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements/requirements-tool_bench.txt b/requirements/requirements-tool_bench.txt index 94e28006f79..3bb74fb9d01 100644 --- a/requirements/requirements-tool_bench.txt +++ b/requirements/requirements-tool_bench.txt @@ -1,8 +1,7 @@ aiohttp~=3.9.3 pytest~=8.3.3 huggingface_hub>=0.34.0,<1.0 -matplotlib~=3.10.0; python_version>="3.10" -matplotlib>=3.9.0; python_version<"3.10" +matplotlib~=3.10.0 numpy~=1.26.4 openai~=2.14.0 pandas~=2.2.3