public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36841]  New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
@ 2008-07-15 18:10 rajiv dot adhikary at amd dot com
  2008-07-23  9:40 ` [Bug fortran/36841] " rguenth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: rajiv dot adhikary at amd dot com @ 2008-07-15 18:10 UTC (permalink / raw)
  To: gcc-bugs

For calculation involving multidimensional array multiplication followed by a
sum along first dimension,
    GCC performs the steps separately - the element-by-element array
multiplication is completed first.
    Function gfortran_sum_r8 is called next to calculate the sum.
    A better process would be to keep an accumulator updated as the
element-by-element array multiplication
    is carried out. This has following benefits:
    i. gfortran_sum_r8 call is eliminated.
    ii. there is no longer a need for temporary array to hold array
multiplication result.

    subroutine sum_test(Rx,Ry,Rz,nx,ny)
    implicit none
      integer(kind=kind(1)), intent(in) :: nx,ny
      real(kind=kind(1.0d0)), dimension(nx,ny), intent(in) :: Rx,Ry
      real(kind=kind(1.0d0)), dimension(ny), intent(out) :: Rz

      Rz = sum(Rx * Ry, 1)
    end subroutine sum_test


Other relevant information:
1. Compile flags: -O3 -ffast-math -m64 -march=amdfam10

2. gfortran version: gfortran -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /tmp/src/gcc-4.3.0/configure --prefix=/opt/amd/gcc-4.3.0
--enable-languages=c,c++,fortran --enable-stage1-checking
--with-as=/opt/amd/gcc-4.3.0/bin/as --with-ld=/opt/amd/gcc-4.3.0/bin/ld
--with-mpfr=/tmp/install/mpfr-2.3.0 --with-gmp=/tmp/install/gmp-4.2.2
Thread model: posix
gcc version 4.3.1 20080312 (prerelease) (GCC)

3. model name: AMD Phenom(tm) 8650 Triple-Core Processor
4. flags     : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm
3dnowext 3dnow constant_tsc pni cx16 popcnt lahf_lm cmp_legacy svm extapic
cr8_legacy altmovcr8 abm sse4a misalignsse 3dnowprefetch osvw


-- 
           Summary: Eliminate gfortran_sum_r8 call for calculation involving
                    multidimensional array multiplication followed by a sum
                    along first dimension
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rajiv dot adhikary at amd dot com


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
@ 2008-07-23  9:40 ` rguenth at gcc dot gnu dot org
  2010-09-12 16:14 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-07-23  9:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-07-23 09:40 -------
Confirmed.  The middle-end array work will address this in a generic way.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-07-23 09:40:10
               date|                            |


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
  2008-07-23  9:40 ` [Bug fortran/36841] " rguenth at gcc dot gnu dot org
@ 2010-09-12 16:14 ` jvdelisle at gcc dot gnu dot org
  2010-09-12 17:15 ` steven at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-09-12 16:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2010-09-12 16:14 -------
Is this something for the FE to do?


-- 


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
  2008-07-23  9:40 ` [Bug fortran/36841] " rguenth at gcc dot gnu dot org
  2010-09-12 16:14 ` jvdelisle at gcc dot gnu dot org
@ 2010-09-12 17:15 ` steven at gcc dot gnu dot org
  2010-09-12 19:56 ` dominiq at lps dot ens dot fr
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-09-12 17:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from steven at gcc dot gnu dot org  2010-09-12 17:14 -------
This is not a job for the FE.


-- 


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
                   ` (2 preceding siblings ...)
  2010-09-12 17:15 ` steven at gcc dot gnu dot org
@ 2010-09-12 19:56 ` dominiq at lps dot ens dot fr
  2010-09-12 21:24 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-09-12 19:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dominiq at lps dot ens dot fr  2010-09-12 19:56 -------
> This is not a job for the FE.

How could the middle-end do the job if __gfortran_sum_r8 is not
inlined/scalarized (see pr43829)?


-- 


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
                   ` (3 preceding siblings ...)
  2010-09-12 19:56 ` dominiq at lps dot ens dot fr
@ 2010-09-12 21:24 ` steven at gcc dot gnu dot org
  2010-09-13 10:18 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-09-12 21:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steven at gcc dot gnu dot org  2010-09-12 21:24 -------
OK, I thought you meant that this would be something for a separate Fortran
front end optimization pass.  Expanding SUM differently is a job for the FE,
yes.


-- 


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
                   ` (4 preceding siblings ...)
  2010-09-12 21:24 ` steven at gcc dot gnu dot org
@ 2010-09-13 10:18 ` jakub at gcc dot gnu dot org
  2010-09-13 17:14 ` mikael at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-13 10:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2010-09-13 10:18 -------
I believe just gfc_conv_intrinsic_arith needs to be adjusted so that it also
handles se->ss case, at least for optimize && !optimize_size.  Currently it
just handles the case where those intrinsics return a scalar.


-- 


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
                   ` (5 preceding siblings ...)
  2010-09-13 10:18 ` jakub at gcc dot gnu dot org
@ 2010-09-13 17:14 ` mikael at gcc dot gnu dot org
  2010-09-13 18:50 ` jakub at gcc dot gnu dot org
  2010-09-13 21:36 ` mikael at gcc dot gnu dot org
  8 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-09-13 17:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mikael at gcc dot gnu dot org  2010-09-13 17:14 -------
(In reply to comment #4)
> (see pr43829)
> 

I think it is a duplicate of (or close to) pr43829. 
Marked as depending on it so that I don't forget it. 


-- 

mikael at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |43829


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
                   ` (6 preceding siblings ...)
  2010-09-13 17:14 ` mikael at gcc dot gnu dot org
@ 2010-09-13 18:50 ` jakub at gcc dot gnu dot org
  2010-09-13 21:36 ` mikael at gcc dot gnu dot org
  8 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-13 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2010-09-13 18:50 -------
So, are you goint to take care of this?


-- 


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
  2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
                   ` (7 preceding siblings ...)
  2010-09-13 18:50 ` jakub at gcc dot gnu dot org
@ 2010-09-13 21:36 ` mikael at gcc dot gnu dot org
  8 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-09-13 21:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from mikael at gcc dot gnu dot org  2010-09-13 21:35 -------
(In reply to comment #8)
> So, are you goint to take care of this?
> 

Sure.


-- 

mikael at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mikael at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-07-23 09:40:10         |2010-09-13 21:35:52
               date|                            |


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


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

* [Bug fortran/36841] Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension
       [not found] <bug-36841-4@http.gcc.gnu.org/bugzilla/>
@ 2012-03-04 19:15 ` mikael at gcc dot gnu.org
  0 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-03-04 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
            Version|4.3.1                       |4.7.0
         Resolution|                            |DUPLICATE

--- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> 2012-03-04 19:13:53 UTC ---
(In reply to comment #7)
> (In reply to comment #4)
> > (see pr43829)
> > 
> 
> I think it is a duplicate of (or close to) pr43829. 
> Marked as depending on it so that I don't forget it. 

This is fixed for the 4.7.0 version.
Closing.

*** This bug has been marked as a duplicate of bug 43829 ***


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

end of thread, other threads:[~2012-03-04 19:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-15 18:10 [Bug fortran/36841] New: Eliminate gfortran_sum_r8 call for calculation involving multidimensional array multiplication followed by a sum along first dimension rajiv dot adhikary at amd dot com
2008-07-23  9:40 ` [Bug fortran/36841] " rguenth at gcc dot gnu dot org
2010-09-12 16:14 ` jvdelisle at gcc dot gnu dot org
2010-09-12 17:15 ` steven at gcc dot gnu dot org
2010-09-12 19:56 ` dominiq at lps dot ens dot fr
2010-09-12 21:24 ` steven at gcc dot gnu dot org
2010-09-13 10:18 ` jakub at gcc dot gnu dot org
2010-09-13 17:14 ` mikael at gcc dot gnu dot org
2010-09-13 18:50 ` jakub at gcc dot gnu dot org
2010-09-13 21:36 ` mikael at gcc dot gnu dot org
     [not found] <bug-36841-4@http.gcc.gnu.org/bugzilla/>
2012-03-04 19:15 ` mikael at gcc dot gnu.org

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).