public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "spop at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/40979] induct benchmark 60% slower when compiled with -fgraphite-identity
Date: Mon, 31 Jan 2011 18:53:00 -0000	[thread overview]
Message-ID: <bug-40979-4-bUfVk6StSc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-40979-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-31 18:12:38 UTC ---
Here is a reduced testcase from induct.f90 for the first loop
not vectorized with -fgraphite-identity:

module mqc_m
integer, parameter, private :: longreal = selected_real_kind(15,90)
contains
      subroutine mutual_ind_quad_cir_coil (m, l12)
      real (kind = longreal), dimension(9), save :: w2gauss, w1gauss
      real (kind = longreal) :: l12_lower, numerator
      real (kind = longreal), dimension(3) :: current_vector, coil_current_vec
      w2gauss(1) = 16.0_longreal/81.0_longreal
      w1gauss(5) = 0.3302393550_longreal
      do i = 1, 2*m
          do j = 1, 9
              do k = 1, 9
                  numerator = w1gauss(j) * w2gauss(k) *                        
            &
                                                
dot_product(coil_current_vec,current_vector)
                  l12_lower = l12_lower + numerator
              end do
          end do
      end do
      l12 = l12_lower
      end subroutine mutual_ind_quad_cir_coil
end module mqc_m

The problem seems to be that graphite introduces a
Commutative_Associative_Reduction array that confuses the vectorizer.

I looked at how to improve translate_scalar_reduction_to_array in
order to avoid the creation of the temporary array, but it seems to be
difficult as the result is written to memory under a different type
than the reduction itself: l12_lower is a real whereas l12 is an
integer:

    l12_lower_200 = some_computation;
    # l12_lower_9 = PHI <l12_lower_16(D)(2), l12_lower_200(9)>
    D.1585_43 = (integer(kind=4)) l12_lower_9;
    # .MEM_48 = VDEF <.MEM_47>
    *l12_44(D) = D.1585_43;

so we cannot use *l12_44(D) as a data reference in the loop to perform
the reduction as it does not have the same precision as l12_lower: it
seems to me that we cannot avoid creating the temporary array.

The solution could be to clean up the temporary arrays after graphite.


  parent reply	other threads:[~2011-01-31 18:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-40979-4@http.gcc.gnu.org/bugzilla/>
2011-01-26 10:45 ` dominiq at lps dot ens.fr
2011-01-26 14:43 ` howarth at nitro dot med.uc.edu
2011-01-31 18:53 ` spop at gcc dot gnu.org [this message]
2011-01-31 19:36 ` dominiq at lps dot ens.fr
2011-02-01 11:35 ` rguenth at gcc dot gnu.org
2011-02-01 11:45 ` rguenth at gcc dot gnu.org
2011-02-01 16:47 ` spop at gcc dot gnu.org
2011-02-01 17:18 ` rguenth at gcc dot gnu.org
2011-02-01 17:23 ` sebpop at gmail dot com
2011-02-01 17:51 ` sebpop at gmail dot com
2011-02-01 18:22 ` dominiq at lps dot ens.fr
2011-02-01 21:19 ` howarth at nitro dot med.uc.edu
2011-02-01 21:22 ` spop at gcc dot gnu.org
2011-02-02 15:53 ` spop at gcc dot gnu.org
2011-02-02 15:59 ` spop at gcc dot gnu.org
2009-08-06  0:19 [Bug middle-end/40979] New: " howarth at nitro dot med dot uc dot edu
2009-08-06  0:23 ` [Bug middle-end/40979] " spop at gcc dot gnu dot org
2009-08-12 14:58 ` spop at gcc dot gnu dot org
2009-08-13  2:26 ` howarth at nitro dot med dot uc dot edu
2009-08-14 11:59 ` dominiq at lps dot ens dot fr
2009-12-14 19:24 ` spop at gcc dot gnu dot org
2010-02-25 15:23 ` dominiq at lps dot ens dot fr
2010-02-25 17:26 ` dominiq at lps dot ens dot fr
2010-03-10  1:57 ` howarth at nitro dot med dot uc dot edu
2010-03-15 14:21 ` dominiq at lps dot ens dot fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-40979-4-bUfVk6StSc@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).