public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33293]  New: inlining std::inner_product()
@ 2007-09-03 16:47 simon dot marshall at misys dot com
  2007-09-03 17:20 ` [Bug libstdc++/33293] " pcarlini at suse dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: simon dot marshall at misys dot com @ 2007-09-03 16:47 UTC (permalink / raw)
  To: gcc-bugs

I use std::inner_product() to do the vector multiplication when performing
matrix multiplication.  This involves calling std::inner_product() within 2
nested loops (one across all rows, one across all columns).  Unfortunately,
g++-4.1.2 will not, it seems, inline the call even at -O5.  If I provide my own
version with an inline hint, it improves the speed of my matrix multiplication
by ~15%, which is not to be sniffed at.

I suppose my questions would be:

(a) erm, do you need proof?

(b) should the compiler do the inlining regardless (ie, it's a compiler issue),
or should the declaration of std::inner_product give a hint with the inline
keyword (and perhaps also other functions)?

Simon.


-- 
           Summary: inlining std::inner_product()
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon dot marshall at misys dot com
  GCC host triplet: sparc-sun-solaris2.8


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/33293] inlining std::inner_product()
  2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
@ 2007-09-03 17:20 ` pcarlini at suse dot de
  2007-09-03 17:48 ` paolo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pcarlini at suse dot de @ 2007-09-03 17:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pcarlini at suse dot de  2007-09-03 17:20 -------
Note, in GCC any -Ox, x > 3 is identical to -O3.

Anyway, I think we can safely add inline to std::accumulate and
std::inner_product.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
          Component|c++                         |libstdc++
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-09-03 17:20:12
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/33293] inlining std::inner_product()
  2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
  2007-09-03 17:20 ` [Bug libstdc++/33293] " pcarlini at suse dot de
@ 2007-09-03 17:48 ` paolo at gcc dot gnu dot org
  2007-09-03 17:50 ` pcarlini at suse dot de
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-09-03 17:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo at gcc dot gnu dot org  2007-09-03 17:48 -------
Subject: Bug 33293

Author: paolo
Date: Mon Sep  3 17:48:31 2007
New Revision: 128053

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128053
Log:
2007-09-03  Paolo Carlini  <pcarlini@suse.de>

        PR libstdc++/33293
        * include/bits/stl_numeric.h (accumulate, inner_product):
        Add inline function-specifier.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_numeric.h


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/33293] inlining std::inner_product()
  2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
  2007-09-03 17:20 ` [Bug libstdc++/33293] " pcarlini at suse dot de
  2007-09-03 17:48 ` paolo at gcc dot gnu dot org
@ 2007-09-03 17:50 ` pcarlini at suse dot de
  2007-09-04  8:01 ` simon dot marshall at misys dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pcarlini at suse dot de @ 2007-09-03 17:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2007-09-03 17:50 -------
Fixed for 4.3.0.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/33293] inlining std::inner_product()
  2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
                   ` (2 preceding siblings ...)
  2007-09-03 17:50 ` pcarlini at suse dot de
@ 2007-09-04  8:01 ` simon dot marshall at misys dot com
  2007-09-04  8:42 ` pcarlini at suse dot de
  2007-09-04  8:43 ` simon dot marshall at misys dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simon dot marshall at misys dot com @ 2007-09-04  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from simon dot marshall at misys dot com  2007-09-04 08:01 -------
Many thanks for the quick response.  Any chance it could make it into 4.2.2?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/33293] inlining std::inner_product()
  2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
                   ` (3 preceding siblings ...)
  2007-09-04  8:01 ` simon dot marshall at misys dot com
@ 2007-09-04  8:42 ` pcarlini at suse dot de
  2007-09-04  8:43 ` simon dot marshall at misys dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pcarlini at suse dot de @ 2007-09-04  8:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pcarlini at suse dot de  2007-09-04 08:41 -------
The patch itself is trivial but in our experience changing the inlining
patterns can have far reaching and unpredictable fall-outs. Thus, better not
touching the release branches, sorry.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/33293] inlining std::inner_product()
  2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
                   ` (4 preceding siblings ...)
  2007-09-04  8:42 ` pcarlini at suse dot de
@ 2007-09-04  8:43 ` simon dot marshall at misys dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simon dot marshall at misys dot com @ 2007-09-04  8:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from simon dot marshall at misys dot com  2007-09-04 08:43 -------
OK, thanks.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-09-04  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-03 16:47 [Bug c++/33293] New: inlining std::inner_product() simon dot marshall at misys dot com
2007-09-03 17:20 ` [Bug libstdc++/33293] " pcarlini at suse dot de
2007-09-03 17:48 ` paolo at gcc dot gnu dot org
2007-09-03 17:50 ` pcarlini at suse dot de
2007-09-04  8:01 ` simon dot marshall at misys dot com
2007-09-04  8:42 ` pcarlini at suse dot de
2007-09-04  8:43 ` simon dot marshall at misys dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).