diff mbox series

[meta-oe,2/2] tbb: enable NUMA/Hybrid CPU support

Message ID 20231130052007.2573333-2-naveen.kumar.saini@intel.com
State Under Review
Headers show
Series [meta-oe,1/2] tbb: upgrade 2021.9.0 -> 2021.11.0 | expand

Commit Message

Naveen Saini Nov. 30, 2023, 5:20 a.m. UTC
oneTBB relies on HWLOC* to identify the underlying topology
of the system to optimize thread scheduling and memory allocation.

Ref:
https://oneapi-src.github.io/oneTBB/GSG/next_steps.html#hybrid-cpu-and-numa-support

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
 ....cmake-remove-cross-compiation-check.patch | 33 +++++++++++++++++++
 meta-oe/recipes-support/tbb/tbb_2021.11.0.bb  | 12 ++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/tbb/tbb/0001-hwloc_detection.cmake-remove-cross-compiation-check.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/tbb/tbb/0001-hwloc_detection.cmake-remove-cross-compiation-check.patch b/meta-oe/recipes-support/tbb/tbb/0001-hwloc_detection.cmake-remove-cross-compiation-check.patch
new file mode 100644
index 000000000..640b13170
--- /dev/null
+++ b/meta-oe/recipes-support/tbb/tbb/0001-hwloc_detection.cmake-remove-cross-compiation-check.patch
@@ -0,0 +1,33 @@ 
+From 7ffc1eba8596544d6e3af0fd5f4004fff6d56f84 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Wed, 29 Nov 2023 15:48:57 +0800
+Subject: [PATCH] hwloc_detection.cmake: remove cross-compiation check
+
+This check is preventing pkgconfig to
+search for hwloc under cross-compilation.
+
+pkgconfig able to find hwloc pkg from sysroot.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ cmake/hwloc_detection.cmake | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/cmake/hwloc_detection.cmake b/cmake/hwloc_detection.cmake
+index 47233b17..5a7e84c3 100644
+--- a/cmake/hwloc_detection.cmake
++++ b/cmake/hwloc_detection.cmake
+@@ -46,8 +46,6 @@ endforeach()
+ unset(HWLOC_TARGET_NAME)
+ 
+ if (NOT HWLOC_TARGET_EXPLICITLY_DEFINED AND
+-    # No hwloc auto detection for cross compilation
+-    NOT CMAKE_CROSSCOMPILING AND
+     NOT TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH
+ )
+     find_package(PkgConfig QUIET)
+-- 
+2.37.3
+
diff --git a/meta-oe/recipes-support/tbb/tbb_2021.11.0.bb b/meta-oe/recipes-support/tbb/tbb_2021.11.0.bb
index 1a1d9988b..f834726bd 100644
--- a/meta-oe/recipes-support/tbb/tbb_2021.11.0.bb
+++ b/meta-oe/recipes-support/tbb/tbb_2021.11.0.bb
@@ -8,22 +8,25 @@  LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=86d3f3a95c324c9479bd8986968f4327"
 
 DEPENDS:append:libc-musl = " libucontext"
+DEPENDS:append:class-target = " hwloc"
 
 PE = "1"
 
 BRANCH = "onetbb_2021"
 SRCREV = "8b829acc65569019edb896c5150d427f288e8aba"
 SRC_URI = "git://github.com/oneapi-src/oneTBB.git;protocol=https;branch=${BRANCH} \
+            file://0001-hwloc_detection.cmake-remove-cross-compiation-check.patch \
 "
 S = "${WORKDIR}/git"
 
-inherit cmake
+inherit cmake pkgconfig
 
 # test build fails, error: 'mallinfo mallinfo()' is deprecated
 EXTRA_OECMAKE += " \
                     -DTBB_TEST=OFF \
                     -DCMAKE_BUILD_TYPE=Release \
                 "
+
 # Hard-float 'd' ABI can't be used for a target that doesn't support the D instruction set extension (ignoring target-abi)
 # tmp-glibc/work/riscv64-oe-linux/tbb/1_2021.7.0-r0/recipe-sysroot-native/usr/bin/riscv64-oe-linux/riscv64-oe-linux-ld: /tmp/lto-llvm-264bc2.o: can't link soft-float modules with double-float modules
 # tmp-glibc/work/riscv64-oe-linux/tbb/1_2021.7.0-r0/recipe-sysroot-native/usr/bin/riscv64-oe-linux/riscv64-oe-linux-ld: failed to merge target specific data of file /tmp/lto-llvm-264bc2.o
@@ -49,4 +52,11 @@  LDFLAGS:append:libc-musl = " -lucontext"
 # The latest version of oneTBB does not support PPC
 COMPATIBLE_MACHINE:powerpc = "(!.*ppc).*"
 
+
+do_install:append:class-target() {
+    # fix for qa check buildpaths
+    sed -i "s#${RECIPE_SYSROOT}##g" ${D}${libdir}/cmake/TBB/TBBTargets.cmake
+}
+
+
 BBCLASSEXTEND = "native nativesdk"