Bug 1996330

Summary: gcc: Incorrect always_inline diagnostic in LTO mode with #pragma GCC target("cpu=power10")
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 36CC: aoliva, bergner, chip.kerchner, dan, dmalcolm, dominik, fweimer, gduarte, jakub, junghans, jwakely, law, manisandro, mpolacek, msebor, mtasaka, ngompa13, nickc, richmattes, sergio, sipoyare, trpost, tuliom
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-21 13:08:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1071880, 1862368, 2163487    

Description Orion Poplawski 2021-08-21 22:56:17 UTC
Description of problem:

gdl is now failing to build on rawhide ppc64le with eigen3 3.4.0:

In file included from /usr/include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProduct.h:18,
                 from /usr/include/eigen3/Eigen/Core:350,
                 from /builddir/build/BUILD/gdl-1.0.0/src/includefirst.hpp:49,
                 from /builddir/build/BUILD/gdl-1.0.0/src/basegdl.hpp:21,
                 from /builddir/build/BUILD/gdl-1.0.0/src/nullgdl.hpp:21,
                 from /builddir/build/BUILD/gdl-1.0.0/src/basic_op.cpp:27:
/usr/include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h: In function 'Eigen::internal::ploadRhsMMA<float, float __vector(4)>(float const*, float __vector(4)&)void':
/usr/include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h:215:28: error: inlining failed in call to 'always_inline' 'Eigen::internal::ploadRhs<float, float __vector(4)>(float const*)float __vector(4)': target specific option mismatch
  215 | EIGEN_ALWAYS_INLINE Packet ploadRhs(const Scalar* rhs)
      |                            ^~~~~~~~

Version-Release number of selected component (if applicable):
eigen3-3.4.0-1.fc36

Comment 1 Mamoru TASAKA 2021-08-22 15:48:38 UTC
As I commented on:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/VKLO4JJ7VLZD5OOIE4IOFRA4RGH45PWT/

I think the relevant change is:
https://gitlab.com/libeigen/eigen/-/commit/c29935b323ffb0b903f640111f0a0b0440e94a2e

Now src/Core/arch/AltiVec/MatrixProductMMA.h contains "#pragma GCC target("cpu=power10")",
but Fedora rawhide build flags on ppc64le contains "-mcpu=power8 -mtune=power8", so there is
"target specific option mismatch", I guess.

The quickest workaround is to add "#define EIGEN_ALTIVEC_DISABLE_MMA" on 
Eigen/src/Core/arch/AltiVec/MatrixProduct.h , I think.

Comment 2 Florian Weimer 2021-08-24 08:53:50 UTC
Build command:

cd /home/test/gdl/gdl-1.0.0/build/src && /usr/bin/g++ -DHAVE_CONFIG_H -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/test/gdl/gdl-1.0.0/src -I/usr/include/tirpc -I/usr/lib64/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -I/usr/include/GraphicsMagick -I/usr/include/libgeotiff -I/usr/include/hdf -I/usr/include/python3.10 -I/usr/lib64/python3.10/site-packages/numpy/core/include -I/usr/include/udunits2 -I/usr/include/eigen3 -I/home/test/gdl/gdl-1.0.0 -I/home/test/gdl/gdl-1.0.0/build -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -fcommon -fopenmp -DNDEBUG -fPIE -std=gnu++11 -MD -MT src/CMakeFiles/gdl.dir/basic_op.cpp.o -MF CMakeFiles/gdl.dir/basic_op.cpp.o.d -o CMakeFiles/gdl.dir/basic_op.cpp.o -c /home/test/gdl/gdl-1.0.0/src/basic_op.cpp

The error only happens with LTO, as far as I can see.

Comment 4 Dan Horák 2021-08-24 13:06:31 UTC
There shouldn't be a conflict with the default -mcpu=power8, because the pragma is adding another (parallel) implementation for -mcpu=power10 that will be resolved during startup via the IFUNC mechanism.

Comment 5 Chip Kerchner 2021-08-24 15:35:18 UTC
This seems to be an issue with the compiler (GCC11) and the `-flto` flag.  Please file this issue with gcc.gnu.org/bugzilla.  This works fine without the flag.

Comment 6 Florian Weimer 2021-08-25 09:43:41 UTC
Thanks. Reported as an upstream gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102059

Comment 7 Mamoru TASAKA 2021-08-26 11:47:56 UTC
So seeing the upstream gcc comment, this is going to be error not only with -flto, but also without -flto ?

Comment 8 Florian Weimer 2021-08-26 11:53:53 UTC
(In reply to Mamoru TASAKA from comment #7)
> So seeing the upstream gcc comment, this is going to be error not only with
> -flto, but also without -flto ?

Maybe, we don't know yet. It's possible that Eigen needs to change to enable MMA instead of POWER10.

Comment 9 Christoph Junghans 2021-09-10 18:06:43 UTC
Same in https://bugzilla.redhat.com/show_bug.cgi?id=2001592

Comment 10 Dan Horák 2022-01-26 20:29:09 UTC
looking at the GCC bug this should be fixed in GCC 12

Comment 11 Sandro Mani 2022-01-28 09:17:01 UTC
Don't know if it is related to the issue at hand here, but without the mma patch, eigen3 still fails to build on ppc64le with

/builddir/build/BUILD/eigen-3.4.0/unsupported/Eigen/../../Eigen/src/Core/util/BlasUtil.h:227:46: error: inlining failed in call to 'always_inline' 'Eigen::internal::blas_data_mapper<double, long, 0, 0, 1>::storePacketBlock<double __vector(2), 4>(long, long, Eigen::internal::PacketBlock<double __vector(2), 4> const&) constvoid': target specific option mismatch

See https://koji.fedoraproject.org/koji/taskinfo?taskID=82058013

Comment 12 Ben Cotton 2022-02-08 20:23:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 13 Sandro Mani 2022-07-21 13:08:43 UTC
Fixed according to upstream bug, eigen rebuilt successfully without the mma patch.

Comment 15 Florian Weimer 2023-01-24 12:18:00 UTC
(In reply to Sergio Basto from comment #14)
> Now we see this bug on EL9 , How we reach RHEL team ? 

This bug has been fixed in el9 as far as possible, please see the two bugs I just linked.

Comment 16 Neal Gompa 2023-01-24 12:36:47 UTC
(In reply to Florian Weimer from comment #15)
> (In reply to Sergio Basto from comment #14)
> > Now we see this bug on EL9 , How we reach RHEL team ? 
> 
> This bug has been fixed in el9 as far as possible, please see the two bugs I
> just linked.

So this looks like it'll be fixed in RHEL 9.2, right?

Comment 17 Sergio Basto 2023-03-22 01:44:55 UTC
when this is fixed we should revisited packages affected (movit and openbabel) and remove the workaround added.