public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r
@ 2022-01-28  7:05 rguenth at gcc dot gnu.org
  2022-01-28  7:07 ` [Bug tree-optimization/104265] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-28  7:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104265

            Bug ID: 104265
           Summary: Missed vectorization in 526.blender_r
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Blenders hottest spot is rayobject_bb_intersect_test which can be summarized as

struct Isect {
    float start[3];
    float dir[3];
    float dist;
    float origstart[3];
    float origdir[3];
    int bv_index[6];
    float idot_axis[3];
    /* More stuff.  */
    void *userdata; /* aligns it to 8 */
};

int rayobject_bb_intersect_test (struct Isect *isec, const float *bb)
{
  float t1x = (bb[isec->bv_index[0]] - isec->start[0]) * isec->idot_axis[0];
  float t2x = (bb[isec->bv_index[1]] - isec->start[0]) * isec->idot_axis[0];
  float t1y = (bb[isec->bv_index[2]] - isec->start[1]) * isec->idot_axis[1];
  float t2y = (bb[isec->bv_index[3]] - isec->start[1]) * isec->idot_axis[1];
  float t1z = (bb[isec->bv_index[4]] - isec->start[2]) * isec->idot_axis[2];
  float t2z = (bb[isec->bv_index[5]] - isec->start[2]) * isec->idot_axis[2];

  if (t1x > t2y  || t2x < t1y  || t1x > t2z || t2x < t1z || t1y > t2z || t2y <
t1z) return 0;
  if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0;
  if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
  return 1;
}

at least on x86 with SSE4 (for some extra permutes) we can vectorize the
comparisons, carefully filling extra lanes of V4SF vectors with redundant
data from another lane starting with {t1x,t1y,t1z,} {t2x,t2y,t2z,}
vectors.  AOCC does this kind of vectorization and receives a nice 25%
uplift in performance from it.

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

* [Bug tree-optimization/104265] Missed vectorization in 526.blender_r
  2022-01-28  7:05 [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r rguenth at gcc dot gnu.org
@ 2022-01-28  7:07 ` rguenth at gcc dot gnu.org
  2022-01-28  9:50 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-28  7:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104265

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |104240
             Blocks|                            |53947
           Keywords|                            |missed-optimization

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
One of the issues is that the compares are not uniform in the IL but partly
if-combined.  That will make the matching process for the initial SLP seed
quite tedious.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104240
[Bug 104240] SLP discovery does not consider swapping comparisons

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

* [Bug tree-optimization/104265] Missed vectorization in 526.blender_r
  2022-01-28  7:05 [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r rguenth at gcc dot gnu.org
  2022-01-28  7:07 ` [Bug tree-optimization/104265] " rguenth at gcc dot gnu.org
@ 2022-01-28  9:50 ` marxin at gcc dot gnu.org
  2022-01-29  5:20 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-28  9:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104265

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2022-01-28
             Status|UNCONFIRMED                 |NEW
             Blocks|                            |26163
     Ever confirmed|0                           |1


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

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

* [Bug tree-optimization/104265] Missed vectorization in 526.blender_r
  2022-01-28  7:05 [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r rguenth at gcc dot gnu.org
  2022-01-28  7:07 ` [Bug tree-optimization/104265] " rguenth at gcc dot gnu.org
  2022-01-28  9:50 ` marxin at gcc dot gnu.org
@ 2022-01-29  5:20 ` pinskia at gcc dot gnu.org
  2022-05-02 11:17 ` rguenth at gcc dot gnu.org
  2022-08-30 21:09 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-29  5:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104265

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug tree-optimization/104265] Missed vectorization in 526.blender_r
  2022-01-28  7:05 [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-29  5:20 ` pinskia at gcc dot gnu.org
@ 2022-05-02 11:17 ` rguenth at gcc dot gnu.org
  2022-08-30 21:09 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-02 11:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104265
Bug 104265 depends on bug 104240, which changed state.

Bug 104240 Summary: SLP discovery does not consider swapping comparisons
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104240

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

* [Bug tree-optimization/104265] Missed vectorization in 526.blender_r
  2022-01-28  7:05 [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-05-02 11:17 ` rguenth at gcc dot gnu.org
@ 2022-08-30 21:09 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2022-08-30 21:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104265

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 53521
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53521&action=edit
Assembly code generated by aocc

FWITW, here is the assembler code as generated by aocc version 13.0.0 with -O3.

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

end of thread, other threads:[~2022-08-30 21:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28  7:05 [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r rguenth at gcc dot gnu.org
2022-01-28  7:07 ` [Bug tree-optimization/104265] " rguenth at gcc dot gnu.org
2022-01-28  9:50 ` marxin at gcc dot gnu.org
2022-01-29  5:20 ` pinskia at gcc dot gnu.org
2022-05-02 11:17 ` rguenth at gcc dot gnu.org
2022-08-30 21:09 ` tkoenig 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).