Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Sony Vector Math library and SIMD math library open sourced
PostPosted: Sat Jul 28, 2007 1:19 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3126
Location: California, USA
Sony Computer Entertainment Inc. contributed Vector Math library and SIMD math library as open source under the BSD license. Bullet physics SDK will be the main repository. Vector Math was previously only available to licensed PlayStation 3 developers.

Vector Math provides linear algebra useful for 3D graphics (vector, matrix, quaternion). SIMD implementations for PowerPC PPU, Cell SPU and x86 SSE are available, next to a portable generic scalar version. You can read the overview document on-line. Reference manuals and documentation is included in the doc folder.
Repository:
http://bullet.svn.sourceforge.net/viewv ... thlibrary/

SIMD math library provides 4-way SIMD implementations of common math functions like cos4f, sin4f, floor4f, fabs4f etc. Vector Math depends on this lower level C library on PPU and SPU.
Repository:
http://bullet.svn.sourceforge.net/viewv ... thlibrary/

Both libraries are included in the Bullet distribution under the Bullet/Extras folder, available from Bullet 2.55. Download Bullet physics SDK.

Feedback, patches for Vector Math and SIMD math library are welcome in this forum.
Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: Sony Vector Math library and SIMD math library open sourced
PostPosted: Wed Mar 04, 2009 4:08 pm 
Offline

Joined: Wed Mar 04, 2009 2:50 pm
Posts: 1
That's a very good news for everybody looking for a well written math lib, especially the SoA one which is quite rare.

Anyway, it seems to me that I'm facing an issue:
- The sse implementation of boolInVec uses for the == operator the _mm_cmpeq_ps intrinsic (vectormathlibrary\include\vectormath\SSE\cpp\boolInVec.h line 207).
- The __m128 argument stores either 0xfffffff or 0x0 to reflect a boolean value (respectively true or false). See constructor boolInVec::boolInVec(bool scalar) line 139.
- As seen as a float value, 0xfffffff is a NAN.
- According to sse instruction specifications (that I found here : http://www.cs.cmu.edu/~410/doc/intel-isr.pdf), _mm_cmpeq_ps always returns false when comparing NANs.

Thus comparing 2 boolInVec that are initialized to "true" with the == operator returns false, which is not the expected result.

I've experimented this behavior with those 3 lines of code:
Code:
   
int i = 0xffffffff;
__m128 a = _mm_set1_ps(*(float*)&i);
__m128 c = _mm_cmpeq_ps(a, a);


You'll notice that c equals 0x0 instead of the expected 0xffffffff.

Am I wrong?

Guillaume


Top
 Profile  
 
 Post subject: Re: Sony Vector Math library and SIMD math library open sourced
PostPosted: Thu Jun 04, 2009 12:05 am 
Offline

Joined: Thu Sep 18, 2008 1:44 am
Posts: 2
When you compare two numbers in SIMD, you should be always aware of the type of entities you compare. VMX and modern SSE allows you to treat register contents as integers, masks or floats freely, but it doesn't mean you can magically add two numbers when they're float and int. Or compare two masks as if they were floats.

cmpeq_ps will compare two floating-point numbers. If you have masks in your registers, it is logically a wrong operation to perform. Comparing masks bit-wise would be a NOT-XOR operation, for example.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group