public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/18438] New: vectorizer failed for vector matrix multiplication
@ 2004-11-12  1:29 giovannibajo at libero dot it
  2004-11-12  2:43 ` [Bug tree-optimization/18438] " pinskia at gcc dot gnu dot org
  2005-09-20 17:47 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2004-11-12  1:29 UTC (permalink / raw)
  To: gcc-bugs

Vectorizer fails to handle this:


------------------------------------------------------------
#define NUMPOINTS 50000

#define align(x) __attribute__((align(x)))

typedef float align(16) MATRIX[3][3];

static float points[NUMPOINTS][4];
static align(16) float opoints[NUMPOINTS][4];
static bool flags[NUMPOINTS];
static MATRIX gmatrix;


void RotateVectors (void)
{
  int i, r;

  for (r = 0; r < 4; r++)
  {
    for (i = 0; i < NUMPOINTS; i++)
    {
      opoints[i][0] =     gmatrix[0][0] * points[i][0]
                        + gmatrix[0][1] * points[i][1]
                        + gmatrix[0][2] * points[i][2];
      opoints[i][1] =     gmatrix[1][0] * points[i][0]
                        + gmatrix[1][1] * points[i][1]
                        + gmatrix[1][2] * points[i][2];
      opoints[i][2] =     gmatrix[2][0] * points[i][0]
                        + gmatrix[2][1] * points[i][1]
                        + gmatrix[2][2] * points[i][2];
      flags[i] = true;
    }
  }
}
------------------------------------------------------------
loop at bench.cc:52: not vectorized: complicated access pattern.
loop at bench.cc:52: bad data access.

-- 
           Summary: vectorizer failed for vector matrix multiplication
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
  2004-11-12  1:29 [Bug tree-optimization/18438] New: vectorizer failed for vector matrix multiplication giovannibajo at libero dot it
@ 2004-11-12  2:43 ` pinskia at gcc dot gnu dot org
  2005-09-20 17:47 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-12  2:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-12 02:43 -------
Confirmed, ICC can do this but does not because it is not very inefficient to do it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-12 02:43:35
               date|                            |


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


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
  2004-11-12  1:29 [Bug tree-optimization/18438] New: vectorizer failed for vector matrix multiplication giovannibajo at libero dot it
  2004-11-12  2:43 ` [Bug tree-optimization/18438] " pinskia at gcc dot gnu dot org
@ 2005-09-20 17:47 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-20 17:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-20 17:47 -------
t.c:20: note: not vectorized: mixed data-types
t.c:20: note: can't determine vectorization factor.

Removing flags[i] = true;
we get:
t.c:20: note: not consecutive access
t.c:20: note: not vectorized: complicated access pattern.


-- 


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


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
       [not found] <bug-18438-4@http.gcc.gnu.org/bugzilla/>
  2011-05-22 16:19 ` steven at gcc dot gnu.org
  2012-07-13  8:43 ` rguenth at gcc dot gnu.org
@ 2013-03-27 11:27 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-27 11:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-27 11:27:31 UTC ---
The issue is that we cannot use a vector v4sf store to &opoints[i][0]
as opoints[i][4] is not stored to.  Such "masked" store (or "interleaved
store with gaps") is not supported by SLP.


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
       [not found] <bug-18438-4@http.gcc.gnu.org/bugzilla/>
  2011-05-22 16:19 ` steven at gcc dot gnu.org
@ 2012-07-13  8:43 ` rguenth at gcc dot gnu.org
  2013-03-27 11:27 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-13  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53947

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-13 08:43:04 UTC ---
Link to vectorizer missed-optimization meta-bug.


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
       [not found] <bug-18438-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-22 16:19 ` steven at gcc dot gnu.org
  2012-07-13  8:43 ` rguenth at gcc dot gnu.org
  2013-03-27 11:27 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu.org @ 2011-05-22 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2006-09-19 07:10:15         |2011-05-22 17:40:15

--- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> 2011-05-22 15:40:28 UTC ---
Still not vectorized in recent GCC 
t.c:20: note: not vectorized: complicated access pattern.
t.c:22: note: not vectorized: complicated access pattern.


     1    typedef unsigned int bool;
     2    #define true 1
     3     
     4    #define NUMPOINTS 50000
     5     
     6    #define align(x) __attribute__((align(x)))
     7     
     8    typedef float align(16) MATRIX[3][3];
     9     
    10    static float points[NUMPOINTS][4];
    11    static align(16) float opoints[NUMPOINTS][4];
    12    static bool flags[NUMPOINTS];
    13    static MATRIX gmatrix;
    14     
    15     
    16    void RotateVectors (void)
    17    {
    18      int i, r;
    19     
    20      for (r = 0; r < 4; r++)
    21      {
    22        for (i = 0; i < NUMPOINTS; i++)
    23        {
    24          opoints[i][0] =     gmatrix[0][0] * points[i][0]
    25                            + gmatrix[0][1] * points[i][1]
    26                            + gmatrix[0][2] * points[i][2];
    27          opoints[i][1] =     gmatrix[1][0] * points[i][0]
    28                            + gmatrix[1][1] * points[i][1]
    29                            + gmatrix[1][2] * points[i][2];
    30          opoints[i][2] =     gmatrix[2][0] * points[i][0]
    31                            + gmatrix[2][1] * points[i][1]
    32                            + gmatrix[2][2] * points[i][2];
    33          flags[i] = true;
    34        }
    35      }
    36    }
    37    

"GCC: (GNU) 4.6.0 20110312 (experimental) [trunk revision 170907]"


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
       [not found] <bug-18438-253@http.gcc.gnu.org/bugzilla/>
  2006-09-19  7:10 ` irar at il dot ibm dot com
  2007-01-05  0:37 ` giovannibajo at libero dot it
@ 2007-01-07  7:40 ` irar at il dot ibm dot com
  2 siblings, 0 replies; 9+ messages in thread
From: irar at il dot ibm dot com @ 2007-01-07  7:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from irar at il dot ibm dot com  2007-01-07 07:40 -------
On the todo list.

BTW, vectorization of strided accesses was committed to the mainline 4.3.

Ira


-- 


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


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
       [not found] <bug-18438-253@http.gcc.gnu.org/bugzilla/>
  2006-09-19  7:10 ` irar at il dot ibm dot com
@ 2007-01-05  0:37 ` giovannibajo at libero dot it
  2007-01-07  7:40 ` irar at il dot ibm dot com
  2 siblings, 0 replies; 9+ messages in thread
From: giovannibajo at libero dot it @ 2007-01-05  0:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from giovannibajo at libero dot it  2007-01-05 00:37 -------
Thanks Ira. What about store with gaps?


-- 


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


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

* [Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication
       [not found] <bug-18438-253@http.gcc.gnu.org/bugzilla/>
@ 2006-09-19  7:10 ` irar at il dot ibm dot com
  2007-01-05  0:37 ` giovannibajo at libero dot it
  2007-01-07  7:40 ` irar at il dot ibm dot com
  2 siblings, 0 replies; 9+ messages in thread
From: irar at il dot ibm dot com @ 2006-09-19  7:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from irar at il dot ibm dot com  2006-09-19 07:10 -------
> t.c:20: note: not vectorized: mixed data-types
> t.c:20: note: can't determine vectorization factor.
>
> Removing flags[i] = true;

Multiple data-types vectorization is already supported in the autovect branch,
and the patches for mainline (starting from
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00941.html) will be committed as
soon as 4.3 is open.  


> we get:
> t.c:20: note: not consecutive access
> t.c:20: note: not vectorized: complicated access pattern.

Vectorization of strided accesses is also already implemented in the autovect
branch (and will be committed to the mainline 4.3). However, this case contains
stores with gaps (stores to opoints[i][0], opoints[i][1], and opoints[i][2],
without a store to opoints[i][3]), and only loads with gaps are currently
supported.

Therefore, this loop will be vectorizable in the autovect branch (and soon in
the mainline 4.3) if a store to opoints[i][3] is added.

Ira


-- 

irar at il dot ibm dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm dot com
   Last reconfirmed|2005-12-21 03:49:03         |2006-09-19 07:10:15
               date|                            |


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


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

end of thread, other threads:[~2013-03-27 11:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-12  1:29 [Bug tree-optimization/18438] New: vectorizer failed for vector matrix multiplication giovannibajo at libero dot it
2004-11-12  2:43 ` [Bug tree-optimization/18438] " pinskia at gcc dot gnu dot org
2005-09-20 17:47 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18438-253@http.gcc.gnu.org/bugzilla/>
2006-09-19  7:10 ` irar at il dot ibm dot com
2007-01-05  0:37 ` giovannibajo at libero dot it
2007-01-07  7:40 ` irar at il dot ibm dot com
     [not found] <bug-18438-4@http.gcc.gnu.org/bugzilla/>
2011-05-22 16:19 ` steven at gcc dot gnu.org
2012-07-13  8:43 ` rguenth at gcc dot gnu.org
2013-03-27 11:27 ` rguenth 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).