public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52473] New: CSHIFT slow - inline it?
@ 2012-03-03 20:00 burnus at gcc dot gnu.org
2012-04-10 15:22 ` [Bug fortran/52473] " burnus at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-03 20:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52473
Bug #: 52473
Summary: CSHIFT slow - inline it?
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
For the program http://www.cita.utoronto.ca/~pen/MHD/mhd.f90 GCC produces
relatively slow code:
$ gfortran -Ofast mhd.f90; time ./a.out > /dev/null
real 0m0.534s
$ pathf95 -O3 mhd.f90; time ./a.out > /dev/null
real 0m0.169s
Which is 3.2 times faster. A closer analyis shows that it is sufficient to
compile the functions advectbyzx, tvd1 and tvdb with pathf95 to gain the same
speed. If one only compiles advectbyzx and tvd1 (and the rest with gfortran)
the speed is 0m0.301s.
The performance difference seems to be due to the calls to _gfortran_cshift0_4.
Expected: CSHIFT should be inlined (at least for a scalar SHIFT) - as pathf95
and ifort do.
* * *
13.7.43 CSHIFT (ARRAY, SHIFT [, DIM])
Description. Circular shift of an array.Description. Circular shift of an
array.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/52473] CSHIFT slow - inline it?
2012-03-03 20:00 [Bug fortran/52473] New: CSHIFT slow - inline it? burnus at gcc dot gnu.org
@ 2012-04-10 15:22 ` burnus at gcc dot gnu.org
2012-04-11 12:52 ` burnus at gcc dot gnu.org
2013-06-16 12:06 ` dominiq at lps dot ens.fr
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-10 15:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52473
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-10 15:22:30 UTC ---
Cf. also http://gcc.gnu.org/ml/fortran/2012-04/msg00041.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/52473] CSHIFT slow - inline it?
2012-03-03 20:00 [Bug fortran/52473] New: CSHIFT slow - inline it? burnus at gcc dot gnu.org
2012-04-10 15:22 ` [Bug fortran/52473] " burnus at gcc dot gnu.org
@ 2012-04-11 12:52 ` burnus at gcc dot gnu.org
2013-06-16 12:06 ` dominiq at lps dot ens.fr
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-11 12:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52473
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at gcc dot gnu.org
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-11 12:51:34 UTC ---
*** Bug 52934 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/52473] CSHIFT slow - inline it?
2012-03-03 20:00 [Bug fortran/52473] New: CSHIFT slow - inline it? burnus at gcc dot gnu.org
2012-04-10 15:22 ` [Bug fortran/52473] " burnus at gcc dot gnu.org
2012-04-11 12:52 ` burnus at gcc dot gnu.org
@ 2013-06-16 12:06 ` dominiq at lps dot ens.fr
2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-16 12:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52473
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-16
Ever confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I don't have access to pathf95, but the following test (modified for some IDRIS
benchmarks)
subroutine test_cshift()
!-----------------------------------------------------------------
! Test de la fonction intrinsèque "cshift"
!-----------------------------------------------------------------
implicit none
integer, parameter :: n=ordre
integer :: i,j
integer, dimension(n) :: vect=(/ (-i, i=1,n) /)
real(kind=prec),dimension(n,n) :: t,td,t2,t1
real(kind=prec) :: cste
call impression_entete("test_cshift")
print *, "Order of matrix:", n
!---- Initialisations --------------------------
cste=exp(1._prec)
t(:,:) = reshape( &
source=(/ (i*cste,i=1,n*n) /) , shape = (/ n,n /) )
td(:,:) = 0._prec
call cpu_time( val_temps(1) )
td(:,:) = cshift(array=t(:,:), shift=vect(:), dim=1)
call cpu_time( val_temps(2) )
t1(:,:) = td(:,:)
call temps_consomme("test_cshift> 1) CSHIFT")
!---- Décalage selon les lignes via des boucles --------------------
td(:,:) = 0._prec
call cpu_time( val_temps(1) )
do j=1,n
do i=n+vect(j),1,-1
td(i-vect(j),j) = t(i,j)
end do
do i=1,-vect(j)
td(i,j)=t(n+vect(j)+i,j)
end do
end do
call cpu_time( val_temps(2) )
t2(:,:) = td(:,:)
call temps_consomme("test__cshift> 2) DO loop")
if (sum(abs(t2-t1)) /= 0._prec) then
print *,'Mauvais résultats !!!!',sum(abs(t2-t1))
else
print *,'Results OK'
end if
end subroutine test_cshift
gives
====================
Call to test_cshift
====================
Order of matrix: 1000
test_cshift> 1) CSHIFT
Used CPU time ==> 7.624 ms
test__cshift> 2) DO loop
Used CPU time ==> 4.482 ms
Results OK
So CSHIFT is 50% slower than the DO loop.
Note that I get similar results for EOSHIFT and RESHAPE:
=====================
Call to test_eoshift
=====================
Order of matrix: 1000
test_eoshift> 1) EOSHIFT
Used CPU time ==> 7.443 ms
test__eoshift> 2) DO loop
Used CPU time ==> 3.775 ms
Results OK
=====================
Call to test_reshape
=====================
Order of matrix: 1000
test__reshape> 1) RESHAPE
Used CPU time ==> 10.624 ms
test__reshape> 2) DO loop
Used CPU time ==> 4.442 ms
Results OK
PR45689 should probably fixed at the same time.
>From gcc-bugs-return-424460-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jun 16 12:06:58 2013
Return-Path: <gcc-bugs-return-424460-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11959 invoked by alias); 16 Jun 2013 12:06:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11915 invoked by uid 48); 16 Jun 2013 12:06:55 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/45689] [F2003] Missing transformational intrinsic in the trans_func_f2003 list
Date: Sun, 16 Jun 2013 12:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-45689-4-VxjXv5IZ5e@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-45689-4@http.gcc.gnu.org/bugzilla/>
References: <bug-45689-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-06/txt/msg00839.txt.bz2
Content-length: 514
http://gcc.gnu.org/bugzilla/show_bug.cgi?idE689
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-16
Ever confirmed|0 |1
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Related or duplicate of PR52473.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-16 12:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-03 20:00 [Bug fortran/52473] New: CSHIFT slow - inline it? burnus at gcc dot gnu.org
2012-04-10 15:22 ` [Bug fortran/52473] " burnus at gcc dot gnu.org
2012-04-11 12:52 ` burnus at gcc dot gnu.org
2013-06-16 12:06 ` dominiq at lps dot ens.fr
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).