Bug#1068749: onednn: please enable Arm Compute Library integration on arm64
Source: onednn
Version: 3.1.1-2
Severity: wishlist
Tags: patch
Hi,
Please consider enabling Arm Compute Library integration on arm64, see proposed
patch attached.
Arm Compute Library (ACL) ACL is an open-source library for machine
learning applications and provides AArch64 optimized implementations of
core functions.
Thanks,
Emanuele
diff -Nru onednn-3.1.1/debian/changelog onednn-3.1.1/debian/changelog
--- onednn-3.1.1/debian/changelog 2024-01-01 02:12:13.000000000 +0100
+++ onednn-3.1.1/debian/changelog 2024-04-10 10:44:19.000000000 +0200
@@ -1,3 +1,11 @@
+onednn (3.1.1-3) UNRELEASED; urgency=medium
+
+ * d/patches/arm64-use-acl.patch: Use Arm Compute Library on arm64.
+ * d/patches/acl-no-core.patch: Do not search for obsolete library
+ libarm_compute_core.
+
+ -- Emanuele Rocca <ema@debian.org> Wed, 10 Apr 2024 10:44:19 +0200
+
onednn (3.1.1-2) unstable; urgency=medium
* Upload to unstable.
diff -Nru onednn-3.1.1/debian/control onednn-3.1.1/debian/control
--- onednn-3.1.1/debian/control 2023-12-29 19:11:31.000000000 +0100
+++ onednn-3.1.1/debian/control 2024-04-10 10:44:19.000000000 +0200
@@ -7,6 +7,7 @@
debhelper-compat (= 13),
libtbb-dev,
ninja-build,
+ libarm-compute-dev [arm64],
libsimde-dev (>= 0.7.0)
Standards-Version: 4.6.0
Homepage: https://github.com/oneapi-src/oneDNN
diff -Nru onednn-3.1.1/debian/patches/acl-no-core.patch onednn-3.1.1/debian/patches/acl-no-core.patch
--- onednn-3.1.1/debian/patches/acl-no-core.patch 1970-01-01 01:00:00.000000000 +0100
+++ onednn-3.1.1/debian/patches/acl-no-core.patch 2024-04-10 10:44:19.000000000 +0200
@@ -0,0 +1,32 @@
+commit 2b7d892a6a29b07a3c2f0377b84ae130f7847f51
+Author: Fadi Arafeh <fadi.arafeh@arm.com>
+Date: Mon Nov 27 11:49:47 2023 +0000
+
+ cmake: aarch64: Remove linking to libarm_compute_core when building with Arm Compute Library
+
+ The library libarm_compute_core was removed from ACL in v23.08
+ and in order to get core functionality it is only necessary
+ now to link against libarm_compute.
+
+Index: onednn-3.1.1/cmake/FindACL.cmake
+===================================================================
+--- onednn-3.1.1.orig/cmake/FindACL.cmake
++++ onednn-3.1.1/cmake/FindACL.cmake
+@@ -57,16 +57,10 @@ if(ACL_FOUND)
+ PATH_SUFFIXES lib build
+ )
+
+- find_library(ACL_CORE_LIBRARY
+- NAMES arm_compute_core
+- PATHS ENV ACL_ROOT_DIR
+- PATH_SUFFIXES build
+- )
+-
+ list(APPEND ACL_INCLUDE_DIRS
+ ${ACL_INCLUDE_DIR} ${ACL_EXTRA_INCLUDE_DIR})
+ list(APPEND ACL_LIBRARIES
+- ${ACL_LIBRARY} ${ACL_GRAPH_LIBRARY} ${ACL_CORE_LIBRARY})
++ ${ACL_LIBRARY} ${ACL_GRAPH_LIBRARY})
+ endif()
+
+
diff -Nru onednn-3.1.1/debian/patches/arm64-use-acl.patch onednn-3.1.1/debian/patches/arm64-use-acl.patch
--- onednn-3.1.1/debian/patches/arm64-use-acl.patch 1970-01-01 01:00:00.000000000 +0100
+++ onednn-3.1.1/debian/patches/arm64-use-acl.patch 2024-04-10 10:43:05.000000000 +0200
@@ -0,0 +1,68 @@
+From d8458feb5c40ed2c4efc908db02cc6057b0e6165 Mon Sep 17 00:00:00 2001
+From: Emanuele Rocca <ema@debian.org>
+Date: Mon, 8 Apr 2024 19:08:40 +0200
+Subject: [PATCH] build: cpu: aarch64: use installed Arm Compute Library
+ (#1846)
+
+Co-authored-by: Nathan Sircombe <nathan.sircombe@arm.com>
+
+Index: onednn-3.1.1/cmake/FindACL.cmake
+===================================================================
+--- onednn-3.1.1.orig/cmake/FindACL.cmake
++++ onednn-3.1.1/cmake/FindACL.cmake
+@@ -24,14 +24,12 @@
+ find_path(ACL_INCLUDE_DIR
+ NAMES arm_compute/graph.h
+ PATHS ENV ACL_ROOT_DIR
+- NO_DEFAULT_PATH
+ )
+
+ find_library(ACL_LIBRARY
+ NAMES arm_compute
+ PATHS ENV ACL_ROOT_DIR
+- PATH_SUFFIXES build
+- NO_DEFAULT_PATH
++ PATH_SUFFIXES lib build
+ )
+
+ include(FindPackageHandleStandardArgs)
+@@ -56,7 +54,7 @@ if(ACL_FOUND)
+ find_library(ACL_GRAPH_LIBRARY
+ NAMES arm_compute_graph
+ PATHS ENV ACL_ROOT_DIR
+- PATH_SUFFIXES build
++ PATH_SUFFIXES lib build
+ )
+
+ find_library(ACL_CORE_LIBRARY
+Index: onednn-3.1.1/src/cpu/platform.cpp
+===================================================================
+--- onednn-3.1.1.orig/src/cpu/platform.cpp
++++ onednn-3.1.1/src/cpu/platform.cpp
+@@ -1,7 +1,7 @@
+ /*******************************************************************************
+ * Copyright 2020-2023 Intel Corporation
+ * Copyright 2020 FUJITSU LIMITED
+-* Copyright 2022 Arm Ltd. and affiliates
++* Copyright 2022-2024 Arm Ltd. and affiliates
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -37,8 +37,6 @@
+ #if DNNL_AARCH64_USE_ACL
+ // For checking if fp16 isa is supported on the platform
+ #include "arm_compute/core/CPP/CPPTypes.h"
+-// For setting the number of threads for ACL
+-#include "src/common/cpuinfo/CpuInfo.h"
+ #endif
+ #endif
+
+@@ -197,7 +195,7 @@ unsigned get_num_cores() {
+ #if DNNL_X64
+ return x64::cpu().getNumCores(Xbyak::util::CoreLevel);
+ #elif DNNL_AARCH64_USE_ACL
+- return arm_compute::cpuinfo::num_threads_hint();
++ return aarch64::cpu().getNumCores(Xbyak_aarch64::util::CoreLevel);
+ #else
+ return 1;
+ #endif
diff -Nru onednn-3.1.1/debian/patches/series onednn-3.1.1/debian/patches/series
--- onednn-3.1.1/debian/patches/series 2023-09-12 02:18:02.000000000 +0200
+++ onednn-3.1.1/debian/patches/series 2024-04-10 10:43:33.000000000 +0200
@@ -1 +1,3 @@
fix-gcc13-ftbfs.patch
+arm64-use-acl.patch
+acl-no-core.patch
diff -Nru onednn-3.1.1/debian/rules onednn-3.1.1/debian/rules
--- onednn-3.1.1/debian/rules 2023-12-29 19:11:03.000000000 +0100
+++ onednn-3.1.1/debian/rules 2024-04-10 10:44:19.000000000 +0200
@@ -5,14 +5,21 @@
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
#export CLICOLOR_FORCE=ON
+CMAKE_OPTIONS = -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DONEDNN_ARCH_OPT_FLAGS=""
+
+# Enable integration with Arm Compute Library on arm64
+ifeq ($(DEB_TARGET_ARCH),arm64)
+ export ACL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu
+ CMAKE_OPTIONS += -DONEDNN_AARCH64_USE_ACL=ON
+endif
+
%:
dh $@ -Scmake+ninja
# https://oneapi-src.github.io/oneDNN/dev_guide_build.html
override_dh_auto_configure:
- dh_auto_configure -- \
- -DCMAKE_BUILD_TYPE=RelWithDebInfo \
- -DONEDNN_ARCH_OPT_FLAGS=""
+ dh_auto_configure -- $(CMAKE_OPTIONS)
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
Reply to: