public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dario Bahena Tapia" <dario.mx@gmail.com>
To: "Dario Saccavino" <kathoum@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Why worse performace in euclidean distance with SSE2?
Date: Mon, 07 Apr 2008 16:09:00 -0000	[thread overview]
Message-ID: <3d104d6f0804070904s6d196a02gbe86990152cb33fa@mail.gmail.com> (raw)
In-Reply-To: <b6621a6e0804070708o57499d4bm18fb34e041689178@mail.gmail.com>

Oh you are correct ... that improved a lot. However, it still runs
slower than serial version, about 1 second more for the 10,000 data
example.

Thanks.

On Mon, Apr 7, 2008 at 9:08 AM, Dario Saccavino <kathoum@gmail.com> wrote:
> Hello Dario,
>
>  I haven't tried your code yet but I think you could get a good boost
>  if you replace the "sqrt_pd" call with "sqrt_sd", since you only need
>  the square root of a scalar.
>
>     Dario
>
>
>
>
>  >
>  >  inline static double dist_sse(int i,int j)
>  >  {
>  >   double d;
>  >   __m128d xmm0,xmm1;
>  >   xmm0 =_mm_load_pd(C[i]);
>  >   xmm1 = _mm_load_pd(C[j]);
>  >   xmm0 = _mm_sub_pd(xmm0,xmm1);
>  >   xmm1 = xmm0;
>  >   xmm0 = _mm_mul_pd(xmm0,xmm1);
>  >   xmm1 = _mm_shuffle_pd(xmm0, xmm0, _MM_SHUFFLE2(1, 1));
>  >   xmm0 = _mm_add_pd(xmm0,xmm1);
>  >   xmm0 = _mm_sqrt_pd(xmm0);
>  >   _mm_store_sd(&d,xmm0);
>  >   return rint(d);
>  >  }
>  >
>

WARNING: multiple messages have this Message-ID
From: "Dario Bahena Tapia" <dario.mx@gmail.com>
To: "Dario Saccavino" <kathoum@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Why worse performace in euclidean distance with SSE2?
Date: Mon, 07 Apr 2008 16:41:00 -0000	[thread overview]
Message-ID: <3d104d6f0804070904s6d196a02gbe86990152cb33fa@mail.gmail.com> (raw)
Message-ID: <20080407164100.ZwL-Mqmyj2mDwH8WRxD2rI9CXHhIOLMXGiW74kOXcbw@z> (raw)
In-Reply-To: <b6621a6e0804070708o57499d4bm18fb34e041689178@mail.gmail.com>

Oh you are correct ... that improved a lot. However, it still runs
slower than serial version, about 1 second more for the 10,000 data
example.

Thanks.

On Mon, Apr 7, 2008 at 9:08 AM, Dario Saccavino <kathoum@gmail.com> wrote:
> Hello Dario,
>
>  I haven't tried your code yet but I think you could get a good boost
>  if you replace the "sqrt_pd" call with "sqrt_sd", since you only need
>  the square root of a scalar.
>
>     Dario
>
>
>
>
>  >
>  >  inline static double dist_sse(int i,int j)
>  >  {
>  >   double d;
>  >   __m128d xmm0,xmm1;
>  >   xmm0 =_mm_load_pd(C[i]);
>  >   xmm1 = _mm_load_pd(C[j]);
>  >   xmm0 = _mm_sub_pd(xmm0,xmm1);
>  >   xmm1 = xmm0;
>  >   xmm0 = _mm_mul_pd(xmm0,xmm1);
>  >   xmm1 = _mm_shuffle_pd(xmm0, xmm0, _MM_SHUFFLE2(1, 1));
>  >   xmm0 = _mm_add_pd(xmm0,xmm1);
>  >   xmm0 = _mm_sqrt_pd(xmm0);
>  >   _mm_store_sd(&d,xmm0);
>  >   return rint(d);
>  >  }
>  >
>

  reply	other threads:[~2008-04-07 16:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-07 14:09 Dario Bahena Tapia
2008-04-07 15:23 ` Dario Saccavino
2008-04-07 16:09   ` Dario Bahena Tapia [this message]
2008-04-07 16:41     ` Dario Bahena Tapia
2008-04-07 16:05 ` jlh
2008-04-07 17:02   ` Dario Bahena Tapia
2008-04-07 23:42     ` Brian Budge
2008-04-08  2:15       ` Dario Bahena Tapia
2008-04-08  8:34 ` Zuxy Meng
2008-04-08 15:57   ` Dario Bahena Tapia

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=3d104d6f0804070904s6d196a02gbe86990152cb33fa@mail.gmail.com \
    --to=dario.mx@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kathoum@gmail.com \
    /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).