[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1086533: onednn: fix ftbfs on riscv64 again



Source: onednn
Version: 3.5.3-4
Severity: serious 
Tags: ftbfs patch
User: debian-riscv@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-riscv@lists.debian.org

Dear Maintainer,

Thanks for reminding the ftbfs on riscv64.

It seems some workaround in #1080206 does not work with root cause
in fact, it is just fail to detect <riscv_vector.h> so
CAN_COMPILE_RVV_INTRINSICS is empty. but when switch to gcc-14 IIRC,
toolchain can detect the header file then enable
CAN_COMPILE_RVV_INTRINSICS.

But this will lead to fail:

```bash

FAILED: src/cpu/rv64/CMakeFiles/dnnl_cpu_riscv.dir/rvv_nchw_pooling.cpp.o
/usr/bin/clang++ -DDNNL_DLL -DDNNL_DLL_EXPORTS -DDNNL_ENABLE_CPU_ISA_HINTS -DDNNL_ENABLE_MAX_CPU_ISA -DDNNL_RISCV_USE_RVV_INTRINSICS -DDNNL_RV64=1 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/include -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/src -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fdiagnostics-color=always  -Wdate-time -D_FORTIFY_SOURCE=2 -fvisibility-inlines-hidden  -Wall -Wno-unknown-pragmas -fvisibility=internal   -fPIC -Wformat -Wformat-security -fstack-protector-all   -Wno-pass-failed  -O2 -g -DNDEBUG -std=c++11 -MD -MT src/cpu/rv64/CMakeFiles/dnnl_cpu_riscv.dir/rvv_nchw_pooling.cpp.o -MF src/cpu/rv64/CMakeFiles/dnnl_cpu_riscv.dir/rvv_nchw_pooling.cpp.o.d -o src/cpu/rv64/CMakeFiles/dnnl_cpu_riscv.dir/rvv_nchw_pooling.cpp.o -c /<<PKGBUILDDIR>>/src/cpu/rv64/rvv_nchw_pooling.cpp
/<<PKGBUILDDIR>>/src/cpu/rv64/rvv_nchw_pooling.cpp:60:46: error: use of undeclared identifier 'vsetvl_e32m8'
   60 |                         size_t cycleLength = vsetvl_e32m8(size);
      |                                              ^

```
See: https://buildd.debian.org/status/fetch.php?pkg=onednn&arch=riscv64&ver=3.5.3-4&stamp=1730296251&raw=0

I do not have much understanding about RVV api, but after consulting
with gcc expert, we suspect that there is something wrong with these
calls. Given upstream fixing(if so) will be time consuming and our 
currently buildd machines(Unmatched) does not support rvv yet, so we 
disable rvv on it again explicitly. Meanwhile, this upload will align
with other architectures from toolchain's view.

I have tested the patch on my Unmatched.

Could you apply it when next upload? TIA.

#1080206: https://bugs.debian.org/1080206

-- 
Regards,
--
  Bo YU

diff -Nru onednn-3.5.3/debian/changelog onednn-3.5.3/debian/changelog
--- onednn-3.5.3/debian/changelog	2024-08-28 16:14:37.000000000 +0000
+++ onednn-3.5.3/debian/changelog	2024-08-29 15:18:05.000000000 +0000
@@ -1,3 +1,11 @@
+onednn (3.5.3-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Enable DONEDNN_CPU_RUNTIME=SEQ on riscv64 build it with clang. 
+    (Closes: #-1)
+
+ -- Bo YU <tsu.yubo@gmail.com>  Thu, 29 Aug 2024 15:18:05 +0000
+
 onednn (3.5.3-1) unstable; urgency=medium
 
   [ Shengqi Chen ]
diff -Nru onednn-3.5.3/debian/control onednn-3.5.3/debian/control
--- onednn-3.5.3/debian/control	2024-08-28 15:58:46.000000000 +0000
+++ onednn-3.5.3/debian/control	2024-08-29 15:18:05.000000000 +0000
@@ -7,7 +7,8 @@
                debhelper-compat (= 13),
                libtbb-dev,
                ninja-build,
-               libsimde-dev (>= 0.7.0)
+               libsimde-dev (>= 0.7.0),
+	       clang-17 [riscv64],
 Standards-Version: 4.7.0.1
 Homepage: https://github.com/oneapi-src/oneDNN
 Rules-Requires-Root: no
diff -Nru onednn-3.5.3/debian/patches/add-primitive-header-on-rv64.patch onednn-3.5.3/debian/patches/add-primitive-header-on-rv64.patch
--- onednn-3.5.3/debian/patches/add-primitive-header-on-rv64.patch	1970-01-01 00:00:00.000000000 +0000
+++ onednn-3.5.3/debian/patches/add-primitive-header-on-rv64.patch	2024-08-29 15:18:05.000000000 +0000
@@ -0,0 +1,15 @@
+Description: Add missing include common/primitive.hpp
+Applied-Upstream: https://github.com/oneapi-src/oneDNN/pull/2053
+Last-Update: 2024-08-29
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/cpu/rv64/rvv_nchw_pooling.hpp
++++ b/src/cpu/rv64/rvv_nchw_pooling.hpp
+@@ -19,6 +19,7 @@
+ #define RV64_NCHW_POOLING_HPP
+ 
+ #include "cpu/cpu_pooling_pd.hpp"
++#include "common/primitive.hpp"
+ 
+ namespace dnnl {
+ namespace impl {
diff -Nru onednn-3.5.3/debian/patches/series onednn-3.5.3/debian/patches/series
--- onednn-3.5.3/debian/patches/series	2024-08-28 15:58:46.000000000 +0000
+++ onednn-3.5.3/debian/patches/series	2024-08-29 15:18:05.000000000 +0000
@@ -0,0 +1 @@
+add-primitive-header-on-rv64.patch
diff -Nru onednn-3.5.3/debian/rules onednn-3.5.3/debian/rules
--- onednn-3.5.3/debian/rules	2024-08-28 16:14:22.000000000 +0000
+++ onednn-3.5.3/debian/rules	2024-08-29 15:18:05.000000000 +0000
@@ -5,6 +5,13 @@
 export DEB_LDFLAGS_MAINT_APPEND  = -Wl,--as-needed
 #export CLICOLOR_FORCE=ON
 
+ifneq (,$(filter $(DEB_BUILD_ARCH), riscv64))
+export DEB_BUILD_MAINT_OPTIONS += optimize=-lto
+
+export CC=clang-17
+export CXX=clang++-17
+endif
+
 %:
 	dh $@ -Scmake+ninja
 
@@ -12,7 +19,9 @@
 override_dh_auto_configure:
 	dh_auto_configure -- \
 		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-		-DONEDNN_ARCH_OPT_FLAGS=""
+		-DONEDNN_ARCH_OPT_FLAGS="" \
+		$(if $(filter riscv64,$(DEB_BUILD_ARCH)),-DONEDNN_CPU_RUNTIME=SEQ -DDNNL_TARGET_ARCH=RV64,)
+		
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))

Attachment: signature.asc
Description: PGP signature


Reply to: