Source: onetbb
Version: 2021.11.0-2
Severity: normal
Tags: FTBFS patch
User: debian-loonga...@lists.debian.org
Usertags: loong64

Dear maintainers,

Compiling the onetbb failed for loong64 in the Debian Package Auto-Building environment.
The error log is as follows,
```
99% tests passed, 1 tests failed out of 137

Total Test time (real) = 233.63 sec

The following tests FAILED:
    133 - test_malloc_whitebox (Failed)
Errors while running CTest
FAILED: CMakeFiles/test.util
```
The full log can be found at https://buildd.debian.org/status/logs.php?pkg=onetbb&ver=2021.11.0-2&arch=loong64.

For loongarch64, the size of the huge page I got from /proc/meminfo is 32768 kB.
```
$ cat /proc/meminfo |grep Hugepagesize
Hugepagesize:      32768 kB
$ uname -m
loongarch64
```

I have adjusted the page size of HUGE_PAGE_SIZE for loongarch64 in onetbb package.
I have built successfully on my local ENV and test cases passed.
```
137/137 Test #137: test_malloc_new_handler .................. Passed    0.04 sec
100% tests passed, 0 tests failed out of 137
Total Test time (real) = 332.60 sec
```

The pull request for loongarch64 has been merged in onetbb upstream.
https://github.com/oneapi-src/oneTBB/pull/850/files.
https://github.com/oneapi-src/oneTBB/pull/1230/files.

Meanwhile, you can also consider the patch I attached.
Your opinions are welcome.

Thanks,
Dandan Zhang

Description: Adjust HUGE_PAGE_SIZE size for loongarch64 
Last-Update: 2024-05-10

--- onetbb-2021.11.0.orig/src/tbbmalloc/tbbmalloc_internal.h
+++ onetbb-2021.11.0/src/tbbmalloc/tbbmalloc_internal.h
@@ -102,7 +102,11 @@ void suppress_unused_warning( const T& )
 /*
  * Default huge page size
  */
+#if defined __loongarch64
+static const size_t HUGE_PAGE_SIZE = 32 * 1024 * 1024;
+#else
 static const size_t HUGE_PAGE_SIZE = 2 * 1024 * 1024;
+#endif
 
 /********** End of global default constants *********/
 
--- onetbb-2021.11.0.orig/test/tbbmalloc/test_malloc_whitebox.cpp
+++ onetbb-2021.11.0/test/tbbmalloc/test_malloc_whitebox.cpp
@@ -1257,7 +1257,11 @@ void TestTHP() {
     scalable_allocation_mode(USE_HUGE_PAGES, 1);
     REQUIRE_MESSAGE(hugePages.isEnabled, "Huge pages should be enabled via scalable_allocation_mode");
 
+#if defined __loongarch64
+    const int HUGE_PAGE_SIZE = 32 * 1024 * 1024;
+#else
     const int HUGE_PAGE_SIZE = 2 * 1024 * 1024;
+#endif
 
     // allocCount transparent huge pages should be allocated
     const int allocCount = 10;

Reply via email to