Onednn: Build failure in v1.7 with gcc 5.4

Created on 12 Nov 2020  路  11Comments  路  Source: oneapi-src/oneDNN

This failure was raised In pytorch CI

Nov 12 14:45:22 -- The CXX compiler identification is GNU 5.4.0
Nov 12 14:45:22 -- The C compiler identification is GNU 5.4.0
Nov 12 14:46:53 In file included from /var/lib/jenkins/workspace/third_party/ideep/mkl-dnn/src/cpu/x64/cpu_isa_traits.hpp:40:0,
Nov 12 14:46:53                  from /var/lib/jenkins/workspace/third_party/ideep/mkl-dnn/src/cpu/x64/jit_avx512_core_bf16cvt.hpp:25,
Nov 12 14:46:53                  from /var/lib/jenkins/workspace/third_party/ideep/mkl-dnn/src/cpu/x64/jit_avx512_common_resampling.cpp:25:
Nov 12 14:46:53 /var/lib/jenkins/workspace/third_party/ideep/mkl-dnn/src/cpu/x64/xbyak/xbyak.h: In member function 'constexpr void Xbyak::RegExp::verify() const':
Nov 12 14:46:53 /var/lib/jenkins/workspace/third_party/ideep/mkl-dnn/src/cpu/x64/xbyak/xbyak.h:332:43: error: call to non-constexpr function 'void Xbyak::local::SetError(int)'
Nov 12 14:46:53  #define XBYAK_THROW(err) { local::SetError(err); return; }
Nov 12 14:46:53                                            ^
Nov 12 14:46:53 /var/lib/jenkins/workspace/third_party/ideep/mkl-dnn/src/cpu/x64/xbyak/xbyak.h:924:30: note: in expansion of macro 'XBYAK_THROW'
Nov 12 14:46:53    if (base_.getBit() >= 128) XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER)
Nov 12 14:46:53                               ^
Nov 12 14:46:53 third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/build.make:86: recipe for target 'third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/jit_avx512_common_resampling.cpp.o' failed
Nov 12 14:46:53 make[2]: *** [third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/jit_avx512_common_resampling.cpp.o] Error 1
Nov 12 14:46:53 CMakeFiles/Makefile2:3446: recipe for target 'third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/all' failed
Nov 12 14:46:53 make[1]: *** [third_party/ideep/mkl-dnn/src/cpu/x64/CMakeFiles/dnnl_cpu_x64.dir/all] Error 2
Nov 12 14:46:53 make[1]: *** Waiting for unfinished jobs....
bug

Most helpful comment

Thanks for the report, @pinzhenx and @CaoZhongZ!

The fix is promoted internally. We will make a point release tomorrow or early next week.
Meanwhile, I also opened a PR to upstream the fix to Xbyak: https://github.com/herumi/xbyak/pull/114.

All 11 comments

Seems to be bug of gcc 5.4.0 ... Can we work it around in the xbyak header?

@CaoZhongZ

@pinzhenx, we have GCC 5.4 in validation and I do not see any fails. What additional compiler flags Pytorch passess to oneDNN build?

Seems PyTorch is built with -std=c++14, while we use -std=c++11 only.

@emfomenk Thanks for your reply. Any quick fix for that or do we have to wait for the upstream fix?

There are 3 ways:

  1. We disable constexpr from this only problematic function verify() [1]. Then upstream the change to Xbyak.

    • I was able to successfully build the library with this change.

  2. We disable constexpr in Xbyak altogether, as we currently don't really test the library with -std=c++14. Probably an overkill.
  3. PyTorch disables -std=c++14 when builds oneDNN. Unfavorable option.

I think we better pursue the option 1.


[1]

diff --git a/src/cpu/x64/xbyak/xbyak.h b/src/cpu/x64/xbyak/xbyak.h
index dcd921390..d1c5d6146 100644
--- a/src/cpu/x64/xbyak/xbyak.h
+++ b/src/cpu/x64/xbyak/xbyak.h
@@ -919,7 +919,7 @@ public:
        const Reg& getIndex() const { return index_; }
        int getScale() const { return scale_; }
        size_t getDisp() const { return disp_; }
-       XBYAK_CONSTEXPR void verify() const
+       void verify() const
        {
                if (base_.getBit() >= 128) XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER)
                if (index_.getBit() && index_.getBit() <= 64) {

Late to party. So I just add fun fact I found. GCC 5 did not support relaxed rules for c++14 constexpr function. https://gcc.gnu.org/projects/cxx-status.html#cxx14

I don't think this so.

Language Feature | Proposal | Available in GCC? | SD-6 Feature Test
-- | -- | -- | --
Relaxing requirements on constexpr functions | N3652 | 5 | __cpp_constexpr >= 201304

The page says gcc-5 has this feature. But it seems there are some limitations that were removed overtime. We are just unlucky that this particular one was removed only in gcc-6.

I see, it's a bug.

Thanks for the report, @pinzhenx and @CaoZhongZ!

The fix is promoted internally. We will make a point release tomorrow or early next week.
Meanwhile, I also opened a PR to upstream the fix to Xbyak: https://github.com/herumi/xbyak/pull/114.

Fixed in master (c9f36e3a777336f671e450816ba31b3ca22fd440) and rls-v1.7 (7aed236906b1f7a05c0917e5257a1af05e9ff683).

Was this page helpful?
0 / 5 - 0 ratings