Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPUThread.cpp: remove "__attribute__((always_inline))" #9891

Merged
merged 1 commit into from Mar 4, 2021

Conversation

drizzt
Copy link
Contributor

@drizzt drizzt commented Mar 3, 2021

cmp_rdata and mov_rdata are using __attribute__((always_inline)),
without inline, that is not supported on current g++ (see #1546).

Moreover __attribute__((always_inline)) is a noop if used without inline so
just remove it.

A proper fix is to move the 2 functions in an header file as static
(with FORCE_INLINE) so it can be correctly inlined by the compiler.

/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:195:13: warning: 'always_inline' function might not be inlinable [-Wattributes]
  195 | extern void mov_rdata(spu_rdata_t& _dst, const spu_rdata_t& _src)
      |             ^~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:139:13: warning: 'always_inline' function might not be inlinable [-Wattributes]
  139 | extern bool cmp_rdata(const spu_rdata_t& _lhs, const spu_rdata_t& _rhs)
      |             ^~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp: In member function 'spu_thread::do_putllc(spu_mfc_cmd const&)::{lambda()#1}::operator()() const::{lambda()#3}::operator()() const':
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:139:13: error: inlining failed in call to 'always_inline' 'cmp_rdata(std::byte const (&) [128], std::byte const (&) [128])': function body can be overwritten at link time
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:2842:17: note: called from here
 2842 |    if (cmp_rdata(rdata, super_data))
      |        ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:195:13: error: inlining failed in call to 'always_inline' 'mov_rdata(std::byte (&) [128], std::byte const (&) [128])': function body can be overwritten at link time
  195 | extern void mov_rdata(spu_rdata_t& _dst, const spu_rdata_t& _src)
      |             ^~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:2844:14: note: called from here
 2844 |     mov_rdata(super_data, to_write);
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:139:13: error: inlining failed in call to 'always_inline' 'cmp_rdata(std::byte const (&) [128], std::byte const (&) [128])': function body can be overwritten at link time
  139 | extern bool cmp_rdata(const spu_rdata_t& _lhs, const spu_rdata_t& _rhs)
      |             ^~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:2842:17: note: called from here
 2842 |    if (cmp_rdata(rdata, super_data))
      |        ~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:195:13: error: inlining failed in call to 'always_inline' 'mov_rdata(std::byte (&) [128], std::byte const (&) [128])': function body can be overwritten at link time
  195 | extern void mov_rdata(spu_rdata_t& _dst, const spu_rdata_t& _src)
      |             ^~~~~~~~~
/home/tredaell/dev/sources/fedora-copr/rpcs3/rpcs3/rpcs3/rpcs3/Emu/Cell/SPUThread.cpp:2844:14: note: called from here
 2844 |     mov_rdata(super_data, to_write);
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [rpcs3/Emu/CMakeFiles/rpcs3_emu.dir/build.make:969: rpcs3/Emu/CMakeFiles/rpcs3_emu.dir/Cell/SPUThread.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....

@drizzt
Copy link
Contributor Author

drizzt commented Mar 3, 2021

I need to check why it fails with your CI

@elad335
Copy link
Contributor

elad335 commented Mar 3, 2021

I think the failure to compile explains why it was this way.

@drizzt
Copy link
Contributor Author

drizzt commented Mar 3, 2021

Yes, but it doesn't work.
I mean, always_inline can't work without inline and it fails (see the log) on my system

cmp_rdata and mov_rdata are using __attribute__((always_inline)),
without inline, that is not supported on current g++ (see RPCS3#1546).

Moreover __attribute__((always_inline)) is a noop if used without inline so
just remove it.

A proper fix is to move the 2 functions in an header file as static
(with FORCE_INLINE) so it can be correctly inlined by the compiler.
@drizzt drizzt changed the title SPUThread.cpp: use FORCE_INLINE macro SPUThread.cpp: remove "__attribute__((always_inline))" Mar 3, 2021
@Nekotekina Nekotekina merged commit fa5a2b6 into RPCS3:master Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants