473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

sse

I am working on a project with alot of array manipulations (sin,cos,mult).
Does anyone know of a package utilizing simd (sse or mmx) to increase the
processing capability. ? (particularly for the sin/cos)

Gotta go fast!
Thanks,
Bill
Nov 16 '05 #1
11 5901
Just wanted to know.. what really is sse and how can it improve code
performance? Thanks

-Andre

bill wrote:
I am working on a project with alot of array manipulations (sin,cos,mult).
Does anyone know of a package utilizing simd (sse or mmx) to increase the
processing capability. ? (particularly for the sin/cos)

Gotta go fast!
Thanks,
Bill


Nov 16 '05 #2
Bill,

Take a look at http://www.codeproject.com/cpp/mmxintro.asp.

Regards,

George.

Nov 16 '05 #3
thanks - now I just need a few weeks to figure it out!

"George M. Garner Jr." <gm******@erols.com> wrote in message
news:ue**************@TK2MSFTNGP12.phx.gbl...
Bill,

Take a look at http://www.codeproject.com/cpp/mmxintro.asp.

Regards,

George.

Nov 16 '05 #4
bill wrote:
I am working on a project with alot of array manipulations
(sin,cos,mult). Does anyone know of a package utilizing simd (sse or
mmx) to increase the processing capability. ? (particularly for the
sin/cos)


IIRC, MMX/SSE/SSE2 won't help with the trig functions, but can definitely be
used to optimize matrix multiplication.

-cd
Nov 16 '05 #5
I've used SSE2 (Streaming SIMD Extensions) instructions for performance
critical loops in inline assembly blocks directly in my VC++ code.
I'm not an experinced SSE2 programmer, but I'll share my knoledge anyway.
There are other ways to get use of SSE2, see below.

If you want to use SSE2 instructions directly, Intels 'IA-32 Architecture
Software Developer's Manual' tells you about everything you need to know
when it comes to MMX/SSE/SSE2. You can get it
ftp://download.intel.com/design/Pent...s/24547012.pdf . -down to
very low-level though. No code examples either. -Takes a lot of coffee.
SSE2 is an extension to SSE and MMX. They all use the SIMD - 'single
instruction multiple data' -model. That means that with a single instruction
you can perform an operation on up to four 32-bit numbers - simultaniously.
Therefore using SIMD increases the speed significantly. You can use SIMD
instructions in cases where you need to perform the same operation on a
large amount of similar data, like video or 3D applications.

MMX: Instruction set that operates on 64 bit registers, for example
containing two 32 bit integers -simultaneously. Unfortunately MMX only
includes instructions that operates on integers.
The eight MMX registers are called MM0 - MM7 (An easy way to identify the
use of MMX in assembly code).

SSE: extends MMX so that you can also do floating point operations on 128
bit registers. With SSE you can operate on four 32 bit floating point
numbers, or two 64 bit double precision floating point numbers -
simultaneously. Came with the Intel P3 processors.
The eight SSE registers are called XMM0 - XMM7.

SSE2: Yet another extension. Includes all SSE operations but adds integer
operations. Now you can work with four 32 bit integers. Introduced with the
P4 processors.
SSE2 uses the same registers as SSE.

SSE2/SSE are processor specific. SSE instructions work only on Intel P3
processors and later. SSE2 instructions work only on Intel P4 processors and
not on AMD processors. The AMD eqvivalent to SSE/SSE2 is called '3DNow!'.
You can use SSE2 instructions directly in Visual Studio in an inline
assembly '__asm' block, as I have done in very performance dependent loops.

As said, there are also other ways to utilize the SSE2 registers, which I
have no experience of:
I think you can allow the compiler to use SIMD instructions when
interpreting your c++-code. I don't know how.
You can also use SIMD 'Intrinsics' which is C++ instructions that
specifically use SIMD instructions.
+... ?

regards, Teis

"Andre" <fo********@hotmail.com> wrote in message
news:3F**************@hotmail.com...
Just wanted to know.. what really is sse and how can it improve code
performance? Thanks

-Andre

bill wrote:
I am working on a project with alot of array manipulations (sin,cos,mult). Does anyone know of a package utilizing simd (sse or mmx) to increase the processing capability. ? (particularly for the sin/cos)

Gotta go fast!
Thanks,
Bill

Nov 16 '05 #6
Teis Draiby wrote:
You can use SSE2 instructions directly in Visual Studio in an inline
assembly '__asm' block, as I have done in very performance dependent
loops.


Of course, inline assembly isn't always necessary. Often it is better to use
intrinsic functions (which are also documented with the SSE/SSE2 support in
Visual C++). The compiler is able to deal with intrinsic functions better
because it can do optimizations beyond what you could do with inline
assembly, and its more portable between different architectures.

Just my two cents. Cheerio!

--
Brandon Bray Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.
Nov 16 '05 #7
Carl Daniel [VC++ MVP] wrote:

IIRC, MMX/SSE/SSE2 won't help with the trig functions, but can
definitely be used to optimize matrix multiplication.


You're right. Although, there are some benefits to using the SSE/SSE2
registers for the trig functions rather than using the x87 FP stack. Over
time, the processors will optimize for register architectures. Already,
compilers handle register architectures better than stack architectures (as
evididenced in much better optimization for integer code). Anyways, some
trig routines supplied by Visual C++ will use SSE/SSE2 instructions after
first checking the CPU ID.

Don't forget that the compiler can also generate SSE/SSE2 instructions when
given either the /arch:SSE or /arch:SSE2 switches.

Hope that helps. Cheerio!

--
Brandon Bray Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.
Nov 16 '05 #8
Andre wrote:
Thanks a lot Teis, that helped :)

Just wondering... can we somehow use this in C# (or does the JIT
compiler have SSE support?) Thanks.


No direct support in C# at this time. Maybe in the future though. The only
way you could get at SSE-type technology from C# would be by calling native
C++ code (through COM interop, or PInvoke, or managed C++ IJW).

-cd
Nov 16 '05 #9
> Don't forget that the compiler can also generate SSE/SSE2 instructions
when
given either the /arch:SSE or /arch:SSE2 switches.


-I got an "Command line warning D4002 : ignoring unknown option
'/arch:SSE2".
Is Visual Studio C++ .NET 2000 able to recognize this switch?
Thanks Teis

Nov 16 '05 #10
> That's a new switch for VS.NET 2003.
Thank you!
Teis
Nov 16 '05 #11
Ahh, I was under the impression that you could do 4 doubles with SSE2. It
sticks in my mind that this is the case, but it only comes from reading
reviews or other things about the processor. I've never done SSE2 coding on
a P4, so your explanation of just being allowed to use two doubles in the
same register seems likely to me.

Niall

"Teis Draiby" <te*************@draiby.com> wrote in message
news:O0**************@TK2MSFTNGP11.phx.gbl...
Hi Niall,

The SSE instructions operate only on single precision floats (32 bit), SSE
does not operate on double precision floats. The SSE2 extensions are mainly features that allow integer operations. When it comes to floating point
operations, the only SSE2 features that han been added since SSE is the
ability to operate on two 64-bit double precision operands instead of four
32-bit single precision floating points operands. SSE2 uses the same 128-bit registers as SSE, so the sum of bits in the operands has to equal 128 bit.

I've looked it up in the documentation again so I am pretty sure this is
correct... Please correct me if not

regards, Teis
"Niall" <as**@me.com> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
Just a clarification, but it's my understanding that SSE only allowed the use of four single precision or two double precision operands per

operation,
while SSE2 allows the use of four double precision operands. I'm fairly

sure
this is correct, as I was trying to write some stuff for a ray tracer a
while back, but I had to convert all my doubles to floats to fit them in

the
registers (I only have a P3). I could be wrong, though.

Niall



Nov 16 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.