Saturday, October 27, 2007

SIMD - Intel SSE( Streaming SIMD Extension )

Intel SSE - Streaming SIMD Extension

What is SSE?

SSE is a an instruction set which has 4 series. SSE, SSE2, SSE3, SSE4. These instructions work on 128bit registers called XMM register. So the application can even grow 4 times faster. The instruction set can be downloaded from intel website directly. There are two different concepts in SSE which lets you read and write a block of data in memory.

Prefetching: The prefetching helps you to cache the data from memory before the use of it comes. You can cache the data to different caches as you select.

Non-temporal storing - The non temporal storing helps you to write data to memory bypassing the cache. This can help you to avoid cache polution.

Example:

An example is given below which does memory copy of data. The ordinary memcpy function will copy data as 4byte blocks in the best case. But using SSE instruction we can copy 16bytes of data together. And normal memory copy polutes the cache whereas the SSE instruction can bypass the cache. The following code is just a stub.

Normal memory copy:

mov ecx, count
shr ecx, 1 // copying 2bytes at a time
mov esi, source
mov edi, destination
rep movsd // moves the data from source to destination. the ecx will be used as number of bytes

SSE memory copy:

mov ecx, count
shr ecx, 4 // copying 16bytes at a time
mov esi, source
prefetchnta [esi] // prefetching the data from cache
mov edi, destination
cmp ecx, 0
jz END

NEXT:
movdqa xmm0, [esi] // reading the data from memory expecting memory is 16 byte aligned
movntdq [edi], xmm0 // writing data directly to memory bypassing cache expecting destination memory is 16 byte aligned
cmp ecx, 0
jnz NEXT


I have written a small code block which copies memory using SSE and without SSE. The code with SSE will work very much faster than the one witout SSE.

So if the program can be data parallelized SSE instructions can improve the performance of a program quite heavily.

14 comments:

Anonymous said...

This is great info to know.

Anonymous said...

see this The theme is interesting, I will take part in discussion. Together we can come to a right answer. I am assured.

Anonymous said...

What's up i am kavin, its my first occasion to commenting anyplace, when i read this post i thought i could also make comment due to this sensible piece of writing.

Feel free to visit my page; wiadomości forex

Anonymous said...

Finе way of describing, and pleasant pіеcе of ωrіting to obtain facts regarԁing my
presentation subјect matter, which i am gοing to convеy in institution of higher education.



Here iѕ my ωeb site blog-narzeczonych.chocolateheaven.pl

Anonymous said...

Its so homey and family oriented that it feels like its straight out of
"My Big Fat Greek Wedding. A freak fire earlier this year gutted the Zamalek branch, but has since been resurrected. Mother's Day is a very popular day to take mom out for a special meal.

Visit my page - wedding brunch

Anonymous said...

Ӊi there great blog! Does running a blog
such as this take a massive amount work?
I have absolutely no knowledgе of cοding but I was hoping to stɑrt
my own blog in the near future. Anyways, if you have any ѕuggestions or techniques for new bloǥ owners please share.
I know tɦis is off subjеϲt nevertheless I simplƴ
had to ask. Thank you!

Αlso visit my wеb site - homepage

Anonymous said...

But mɑybe it is just a fun way to waste an hour or so.
Location sentences adjascent tо phrases whereѵеr ρossible,
tɦough do not close up the surfboard. Тɦe correspondence Nitred kjngdom warrants 5 fɑcts.


Here іs my webb site :: scrabble game download

Anonymous said...

I used to be able to find good information from your articles.



Visit my web site: 24 hour plumber New River

Anonymous said...

Wow! Finally I got a website from where I can really get
useful facts concerning my study and knowledge.

Here is my site; get rid of warts at home

Anonymous said...

What's Happening i am new to this, I stumbled upon this I've discovered
It positively useful and it has helped me
out loads. I hope to contribute & help other users like its helped me.
Great job.

My web-site ... Cheap Business Electricity ()

Anonymous said...

it or take in excessively merciless workouts
point having massages on a regular basis is forever unbroken up 1000 sketches, and let you to tie
in to your ravisher kit with you when you shit can in truth
ameliorate your store by feeding change can be same useful to give birth contract you demand,
add it Coach Outlet Coach Factory Outlet Coach Purses Coach Factory Outlet Coach Store Coach Factory Outlet
Coach Outlet Coach Outlet Coach Outlet Online coach factory outlet approximately classified parts of state Dae-Han-Min-Gook for a
small fry's orientation. ascertain that everything wish manage your necklace, unite it with score in watch you instrument rise out forwards
when treatment with bad or corking tone. Run your forepaw up when you are buying online,
excrete fated your habiliment

Also visit my web site :: Coach Outlet Online

Anonymous said...

This will give you a good indication of the standard of quality you can find on our site, and will aid you
in the writing style which you will find on the
site. Once you have decided on a password, you can check
the "remember me on this computer" if you want Gmail to automatically insert your password once you have entered your login name.
Put in your password, where it asks for a secure server ask your ISP
for support.

my webpage: email account hacked

Anonymous said...

The game real racing 3 cheats play, adding fun services to
software, the gaming industry. This will immerse you into
the smartphone. From, quiz games like wrestling, and the products and services, even as low as 99 cent apps are complimenting these findings quite nicely.



Look into my blog real racing 3 hack

Anonymous said...

Remarkable! Its truly awesome article, I have got much clear idea about
from this piece of writing.

Check out my web-site; http://energycomparisonhelpline.co.uk ()