public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37131]  New: inline matmul for small matrix sizes
@ 2008-08-15 19:24 tkoenig at gcc dot gnu dot org
  2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 29+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-08-15 19:24 UTC (permalink / raw)
  To: gcc-bugs

Ouch.

This is a factor of 20 for this simple test case on my computer.

$ cat foo.f90
program main
  real, dimension(3,3) :: a,b,c
  call random_number(a)
  call random_number(b)
  do i=1,10**8
    c = matmul(a,b)
    a(1,1) = a(1,1) + b(1,1) - c(1,1)
  end do
  print *,c
end program main

$ gfortran -O3 foo.f90
$ time ./a.out
  0.34224379      0.27477881      0.48155165      0.76788843      0.65491939   
   1.2103429      0.38770726      0.38460296      0.87301219

real    0m20.733s
user    0m19.585s
sys     0m0.000s
$ cat bar.f90
program main
  real, dimension(3,3) :: a,b,c
  call random_number(a)
  call random_number(b)
  do i=1,10**8
    forall (i=1:3)
      forall (j=1:3)
        c(i,j) = sum(a(i,:) * b(:,j))
      end forall
    end forall
    a(1,1) = a(1,1) + b(1,1) - c(1,1)
  end do
  print *,c
end program main

$ gfortran -O3 bar.f90
$ time ./a.out
  0.34224379      0.27477881      0.48155165      0.76788843      0.65491939   
   1.2103429      0.38770726      0.38460296      0.87301219

real    0m1.075s
user    0m1.060s
sys     0m0.000s
$


-- 
           Summary: inline matmul for small matrix sizes
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

end of thread, other threads:[~2021-10-23 22:11 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-37131-4@http.gcc.gnu.org/bugzilla/>
2011-01-02 23:20 ` [Bug fortran/37131] inline matmul for small matrix sizes tkoenig at gcc dot gnu.org
2014-10-03 19:56 ` mikael at gcc dot gnu.org
2015-01-11 16:12 ` tkoenig at gcc dot gnu.org
2015-04-18 23:09 ` tkoenig at gcc dot gnu.org
2015-04-18 23:17 ` tkoenig at gcc dot gnu.org
2015-04-20 11:45 ` tkoenig at gcc dot gnu.org
2015-04-30 22:13 ` tkoenig at gcc dot gnu.org
2015-05-01  7:15 ` schwab@linux-m68k.org
2015-05-01  8:32 ` ubizjak at gmail dot com
2015-05-01 11:25 ` dominiq at lps dot ens.fr
2015-05-01 13:16 ` mikael at gcc dot gnu.org
2015-05-02 11:31 ` schwab@linux-m68k.org
2015-05-03 18:10 ` tkoenig at gcc dot gnu.org
2015-05-06 20:24 ` tkoenig at gcc dot gnu.org
2015-05-06 21:33 ` tkoenig at gcc dot gnu.org
2015-05-12  6:38 ` tkoenig at gcc dot gnu.org
2015-05-21 19:05 ` tkoenig at gcc dot gnu.org
2021-10-23 22:11 ` sandra at gcc dot gnu.org
2008-08-15 19:24 [Bug fortran/37131] New: " tkoenig at gcc dot gnu dot org
2008-08-16 22:56 ` [Bug fortran/37131] " pinskia at gcc dot gnu dot org
2008-08-23 13:20 ` tkoenig at gcc dot gnu dot org
2008-11-29 16:20 ` burnus at gcc dot gnu dot org
2008-12-04 20:00 ` tkoenig at gcc dot gnu dot org
2008-12-09 22:13 ` tkoenig at gcc dot gnu dot org
2010-05-14  9:15 ` tkoenig at gcc dot gnu dot org
2010-06-04 22:32 ` tkoenig at gcc dot gnu dot org
2010-06-05  6:55 ` paul dot richard dot thomas at gmail dot com
2010-06-05  8:49 ` tkoenig at gcc dot gnu dot org
2010-06-05  9:31 ` mikael at gcc dot gnu dot org
2010-06-05 18:27 ` tkoenig at netcologne dot de

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