forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Noob questions about PPU SIMD setup

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
ffelagund



Joined: 16 Mar 2006
Posts: 14

PostPosted: Sun May 25, 2008 8:34 pm    Post subject: Noob questions about PPU SIMD setup Reply with quote

Hello,

I'm following IBM documents for Cell programming. Now I'm trying to compile some SIMD examples, but I'm totally lost for the next reasons:
My most inmediate problem: according with IBM docs, I have to use 'vector' type, and this type is totally unknown by the compiler. Also, I dont know what is the header file needed for the SIMD intrinsics (like vec_perm, vec_sums, etc)
The IBM document called: "Programming tutorial" from the Cell SDK 3.0 says the next: "You do not need to setup, to enter in a special mode, or to include a special header file".
Its obvious that this is not true, so, what should I do in order to use that types and intrinsics?

I'm running Yellow Dog 6 with the SDK 3.0, and this is exactly the code I'm trying to run:
Code:
union SumArray
{
   int i[4];
   vector signed int v;
};

int vect_sum( unsigned char bytes[] )
{
   SumArray sum;
   vector unsigned char vbytes;
   vector unsigned int zero =(unsigned int){0};
   vbytes = vec_perm( vec_ld(0, bytes), vector_ld( 16, bytes), vector_lvsl(0, bytes) );
   sum.v = vec_sums( (vector signed int) vec4_sum4s( vbytes,zero), (vector signed int) zero);
   return sum.i[3];
}


int main()
{
   unsigned char bytes[16];
   for(int i=0; i < 16; ++i )
      bytes[i] = 2;

   int sum = vect_sum( bytes );
   printf( "\nLa suma es: %d\n", sum );
       return 0;
}


And this is the compile command:
ppu-g++ -c main.cpp -o main.o -fno-inline-functions -fmessage-length=0 -Wall -I./include -m64 -G0 -D_DEBUG -DPLATFORM_PS3 -g

With all this, I got errors like:
main.cpp|21|error: ISO C++ forbids declaration of 'vector' with no type|
main.cpp|29|error: 'vec_ld' was not declared in this scope|
main.cpp|29|error: 'vec_perm' was not declared in this scope|
etc.


Any clue will be appreciated :)
Regards,
Jacobo.
_________________
I dont know... flight casual!
Back to top
View user's profile Send private message Visit poster's website
IronPeter



Joined: 06 Aug 2007
Posts: 207

PostPosted: Sun May 25, 2008 10:18 pm    Post subject: Reply with quote

try <altivec.h> include.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ffelagund



Joined: 16 Mar 2006
Posts: 14

PostPosted: Mon May 26, 2008 12:53 am    Post subject: Reply with quote

Thanks,

That solved all my problems :) I think that IBM docs assume some knowledge about ppc programming and they ommited that requirements.

Also, it would help much in my development having a good reference for intrinsics (Cell docs from IBM dont talk too much about PPU VMX) Fo you know a good one site? (I found several on google, but I'd prefer one that talks specifically about Cell, not generic PPC)

Thanks :)
Jacobo.
_________________
I dont know... flight casual!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group