Optimising AI Programming for Cell/SPE (was: PS3 Dev Forum?)

Technical discussion on the newly released and hard to find PS3.

Moderators: cheriff, emoon

Post Reply
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Optimising AI Programming for Cell/SPE (was: PS3 Dev Forum?)

Post by Arwin »

Hi Folks,

I was wondering whether it was time to start a PS3 development forum. There is a lot of info on the Cell now, you can get Cell emulators, and today we also had news that the PS3 development kit supports Cg and OpenGL. About four months left before the system should see the light of day, and Sony seems to be a lot more open than usual. I for one wouldn't mind a nice place to start discussing the merits of these systems, learning about them and start developing initial stuff. Maybe it's a bit early, but there's a lot to learn so the sooner we map all this stuff, the better. We could even start with setting up documentation, filling in the details as they come along.

I personally would really like to discuss AI routines using the Cell processor, and Cell programming in general. This machine really fascinates me, and since it is a big step forward, it feels like a good point to step in.
Last edited by Arwin on Wed Feb 01, 2006 1:17 am, edited 1 time in total.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Re: PS3 Development Forum

Post by Drakonite »

Arwin wrote: I was wondering whether it was time to start a PS3 development forum.
No, I think it's pretty clear it's not time yet. IMO there isn't enough information to do much other than speculate.

Keep in mind, the off-topic forum exists for a reason. If people want to discuss any of the information that is currently known about the PS3, the off-topic forum is a great place for it, and we'd encourage that (but please, no baseless speculation like we see too often with the PS3)

When the time comes that there is enough discussion to warrent creating a separate board for the PS3, rest assure we'll create it and any relavent discussions in off-topic will be moved to it.
Shoot Pixels Not People!
Makeshift Development
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Remeber the EE was there for AI programmers, and where did that get us? AI coding is AI coding, no matter the architecture!

To make this a real topic...What do you expect fromt the PS3 CPU to help you write AI that isn't in any current CPU?

Jim
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

Ok, that's fair enough - we can create some kind of preliminary topics. All topics in Off-Topic stay, right? They're not cleaned up or anything ... (they are on some sites)

I was following some discussions on the IBM Cell forums on state based AI. The idea was, if I understand it correctly, that if you set up the AI as basically a lot of bits that can be manipulated at once by a number of routines, then you can do very fast AI for a lot of objects at once. For instance, if you wanted to create a city with hundreds or even thousands of people in it, you could setup something that would govern their behaviour and place in bitstates in such a way that the SPE could parse them in a stream with a series of general behaviour routines. Say that you would match up status bits that show properties of that object (person) and math it with properties of its location by somehow or-ing the people with their map location, maybe it also has information on where it is going, and so on, then you should be able to do a number of bit manipulation routines that determine where it should go next, if it should avoid something, if it were able to do something random, and so on. Maybe random information could also be pre-mapped and then layed on and merged somehow in packets of data that should be processed by an SPE routine.

It's all very new to me, but I find it very fascinating. Maybe you can program several behaviour routines onto the same SPE and have them running one after the other over the local data set that contains such a state map, or a part of it.

Do I make any sense at all at this point?
gorim
Posts: 18
Joined: Wed Sep 21, 2005 1:47 pm

Post by gorim »

I have much the same interests in how Cell can be used for computational programming. However, as you expressed it, your interests are not even necessarily related to PS3DEV, whatever that will end up being, but related more to "CellDev". Granted, once "ps3dev" forums get added there is sure to be a "cell spu specific" board, but thats getting ahead of things.

Personally, I think its not too early to have ps3 related forums, but I can understand the forum moderators concern: there is likely to be far more noise than dev talk at this stage, and these forums have always been intended to have a *hard* dev focus, and minimize idle chatter at the same time.

Having said all of that, another person responded with a good question: how is AI on Cell going to be different than AI on EE+VU ? After all, architecturally, are you likely to do anything different ? A vector processor is a vector processor, and MMI in a CPU is MMI in a CPU. Does the Cell bring anything new to the table ?

Your response indicated a desire to leverage unique features of the cell. So I ask this to you:

1. Are you talking to a general purpose architecture that can take advantage of multiple processing units of arbitrary numbers located anywhere, whether on a PPC+cell hw arch, or any other arch ? In this case, the cell may just be a convenient platform to use to refine such an architecture. But the general purpose nature may prevent too many hw arch specific optimizations and feature usage.

2. Or, do you want to do essentially the above, but focus specifically on the cell architecture in order to wring the most advantage out of the hardware ?

If it is the former, there may be other ways to investigate that than starting with Cell.

If it is the latter, I hope you keep posting updates on things you are looking at because this is the kind of stuff that interests me.

Another thing to consider, check out GPGPU (general purpose GPU programming) that uses the vertex and pixel shader hardware of modern gpu cards for computation. Since they are effectively high-bandwidth vector processors, now numbering in the dozens in the most advanced GPU's, this is another option you can explore: doing your AI calcs on the GPU.
Lots of research being done on this is focused at the www.gpgpu.org website, including a forums bulletin board just like this one, and tons of academic research papers. Nvidia contributes alot of material to this as well. Much material is also included in Nvidia's GPU GEMS 2 hardcover book which is worth its weight in gold.

In the end, the Cell PPE + 8(7) SPUs + NVGPU will be one computational powerhouse! I hope Sony and their IBM/Toshiba partners make it easy to homebrew on this, as the PS3 will represent the lowest cost supercomputer available anywhere.
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

gorim wrote:I have much the same interests in how Cell can be used for computational programming. However, as you expressed it, your interests are not even necessarily related to PS3DEV, whatever that will end up being, but related more to "CellDev". Granted, once "ps3dev" forums get added there is sure to be a "cell spu specific" board, but thats getting ahead of things.
True. I get the impression though that at least we are beginning to see what the PS3Dev forum sections might look like. I suppose we'll see something like Cg, OpenGL, RSX and Cell, for instance. But we'll see, it is indeed still very early. Still, I expect a lot of oncoming PS3 discussions, and even a PS3 preliminary section would be a great help to have at least all PS3 related topics together from day one. That should also prevent a lot of double topics from appearing.
Having said all of that, another person responded with a good question: how is AI on Cell going to be different than AI on EE+VU ? After all, architecturally, are you likely to do anything different ? A vector processor is a vector processor, and MMI in a CPU is MMI in a CPU. Does the Cell bring anything new to the table ?
To be honest, I am not sure. I told you I was just starting out with concerning myself with any kind of low-level stuff. ;) Well, actually the first time I started looking into this was way back when the Atari Falcon 030 was released, which had that Motorola DSP56001 included as a paralel processor, which was pretty revolutionary at the time - and I even bought a manual on that processor, but there were no such forums as these back then and everything was far too new for me.

Right now, I'm getting back into it. And indeed, reading the low-level PSP programming topics, I also realised that some of this stuff might already be possible on different platforms. But when I started reading about the Cell on the IBM forum, I got the impression that the Cell should be a lot better at this than even the graphics cards, since the graphics chips have a lot of specialised hardware included, and the Cell has a very interesting bandwidth design and local SPE memory interfaces.

It's all very advanced though, but my intentions are to start thinking about programming for a Cell (like) environment from the ground up, not think about what parts I could optimise with it, but try to understand how I can fully maximise its potential by designing programs and routines specifically for its architecture. But I have a lot to learn, obviously.
Your response indicated a desire to leverage unique features of the cell. So I ask this to you:

1. Are you talking to a general purpose architecture that can take advantage of multiple processing units of arbitrary numbers located anywhere, whether on a PPC+cell hw arch, or any other arch ? In this case, the cell may just be a convenient platform to use to refine such an architecture. But the general purpose nature may prevent too many hw arch specific optimizations and feature usage.
No, I'm trying to think of how you could design programs to deal with their states as big streams of data that are suitable to the kind of processing that the SPEs are designed to do. Could you design a car simulation / driving AI this way, with say hundreds of cars all reacting to each other, for instance? I'm getting the impression that a game like Lair might be doing something like this to handle the different dragons, for instance. And a game like the new GTA or the new Getaway, which has lots of people and traffic in London, could that be using such routines?
2. Or, do you want to do essentially the above, but focus specifically on the cell architecture in order to wring the most advantage out of the hardware ?
In other words, yes. :)
If it is the latter, I hope you keep posting updates on things you are looking at because this is the kind of stuff that interests me.

Another thing to consider, check out GPGPU (general purpose GPU programming) that uses the vertex and pixel shader hardware of modern gpu cards for computation. Since they are effectively high-bandwidth vector processors, now numbering in the dozens in the most advanced GPU's, this is another option you can explore: doing your AI calcs on the GPU.
Lots of research being done on this is focused at the www.gpgpu.org website, including a forums bulletin board just like this one, and tons of academic research papers. Nvidia contributes alot of material to this as well. Much material is also included in Nvidia's GPU GEMS 2 hardcover book which is worth its weight in gold.
That sounds like a decent place to start. While I think the Cell should be much better suited for such programming, the different way to program AI routines suited to high-bandwidth vector processors should obviously at least overlap with what makes good use of the Cell.
In the end, the Cell PPE + 8(7) SPUs + NVGPU will be one computational powerhouse! I hope Sony and their IBM/Toshiba partners make it easy to homebrew on this, as the PS3 will represent the lowest cost supercomputer available anywhere.
Yes, I hope so too. A good alternative would be the Linux kit approach they did for the PS2, which is basically a really cheap devkit.

Thanks for the encouragement. I want to start collecting information on this topic, and I'm looking for a central place. I thought PS3 forums would be a good place to start, but otherwise I'll find somewhere else (at least initially), and maybe use my own demain and setup a simple website with links to topics I create here.
Steve F
Posts: 75
Joined: Wed Apr 27, 2005 2:30 am
Location: Texas USA

Post by Steve F »

I'm cool with posting in Off-Topic.

I have the Cell simulator up and running on an AMDX2. The guys at IBM http://www-128.ibm.com/developerworks/power/cell/ and BSC http://www.bsc.es/projects/deepcomputing/linuxoncell/ have done a great job on ease of installation and lots of notes. Their audience is much broader than PS3, in fact there is very little discussion specific to Sony's implementation.

I've been looking at porting ODE, Open Dynamics Engine http://ode.org/ to the Cell. At this point I am leaning toward using the SPE's as pipelined microstore execution units for things like quaternion/euler conversions, rotations, etc. Unfortunately, the SPE's are set up as devices in /dev and the compilers don't have SPE-SPE communication features built in yet. It can be done by hand coding but it sounds like everyone is willing to wait until higher level feature set is available.

Yesterday I learned that Sony will include the Ageia API with their dev kits. I haven't seen the PhysX chip in the PS3 hardware spec but with a PCIe card just around the corner I bet hardware physics will be an add-on. I also saw that the license fee for Ageia API will be included in the purchase price of the box. If that's true I wonder if the physics libraries will be available in rom for PS3's without the hardware physics chip. It makes me wonder if working on ODE will be worth while.

In the mean time this post got me thinking about AI. My game doesn't really have much AI in it although discussions like this get the imagination going. I can think of a few things just to lend atmosphere to my game. I remember an article in Scientific America, Sept. 1987 by A.K. Dewdney titled "Diverse personalities search for social equilibrium at a computer party". It's about each person having preference of attraction or repulsion to every other person [in the room]. The simulation is designed around the geometry of where each person is located and where they move to satisfy their preferences. I found two related articles that stem from Dewdney's article. 1) Attractions and Repulsion's at http://www.ventrella.com/Ideas/attractions.html, and 2) Behavior Research Methods, Instruments, and Computers at http://www.ub.es/comporta/gcai/Abstracts/brmic00.doc

It occurs to me that AI has a heavy dependence on geometry math in much the same way as a physics engine, at least in terms of physical location. Regarding modeling of natural or unnatural behaviors, I haven't given it much thought. With the capabilities of the new hardware I bet this becomes an area rich for innovation and development.
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Post by Arwin »

Steve F wrote:I'm cool with posting in Off-Topic.

I have the Cell simulator up and running on an AMDX2. The guys at IBM http://www-128.ibm.com/developerworks/power/cell/ and BSC http://www.bsc.es/projects/deepcomputing/linuxoncell/ have done a great job on ease of installation and lots of notes. Their audience is much broader than PS3, in fact there is very little discussion specific to Sony's implementation.
Cool stuff! I don't think I currently have a PC capable of doing this (XP 1800+ with a measly 256mb of RAM, and its running WinXP at that), but I have been thinking about trying to get that up and running to see if I can really get into this. I think I'll wait a bit and first just try to think what I want to do exactly, and how I would do it in theory and make some concept designs on a simpler setup. That approach has helped me in the past.
I've been looking at porting ODE, Open Dynamics Engine http://ode.org/ to the Cell. At this point I am leaning toward using the SPE's as pipelined microstore execution units for things like quaternion/euler conversions, rotations, etc. Unfortunately, the SPE's are set up as devices in /dev and the compilers don't have SPE-SPE communication features built in yet. It can be done by hand coding but it sounds like everyone is willing to wait until higher level feature set is available.

Yesterday I learned that Sony will include the Ageia API with their dev kits. I haven't seen the PhysX chip in the PS3 hardware spec but with a PCIe card just around the corner I bet hardware physics will be an add-on. I also saw that the license fee for Ageia API will be included in the purchase price of the box. If that's true I wonder if the physics libraries will be available in rom for PS3's without the hardware physics chip. It makes me wonder if working on ODE will be worth while.
The PhysX chip won't be included in the PS3. Instead, the Ageia API has direct support for PowerPC, Cell, and PhysX chips, and can run also in software emulation only. The Ageia API does apparently run several threads in concurrently, as is advertised on their website: http://www.ageia.com/products/physx.html, and I expect they should be able to make pretty good use of those SPEs already.
The simulation is designed around the geometry of where each person is located and where they move to satisfy their preferences. I found two related articles that stem from Dewdney's article. 1) Attractions and Repulsion's at http://www.ventrella.com/Ideas/attractions.html, and 2) Behavior Research Methods, Instruments, and Computers at http://www.ub.es/comporta/gcai/Abstracts/brmic00.doc

It occurs to me that AI has a heavy dependence on geometry math in much the same way as a physics engine, at least in terms of physical location. Regarding modeling of natural or unnatural behaviors, I haven't given it much thought. With the capabilities of the new hardware I bet this becomes an area rich for innovation and development.
Yes indeed. It will generate some new genres, which is good, because it is necessary. I think the innovative power of the PS3 is underestimated in that respect - it's not just a funny controller that can bring innovation. ;)

Plus, I'm 100% sure that we'll see true 3D stuff with the PS3's double HDMI outputs. I noticed that in the summer, Nvidia released true 3D display drivers supporting several 3D peripherals.

And that face recreation software that apparently also runs on the PS3 has really stepped up amazingly, did anyone see that?

Anyway, I'd like to start working on some AI routines in concept soon, just some general principles about how to store properties, how to match them with environments, and so on. I'll get back on that here after I've researched this a little and also looked at the links you posted, for which thanks!
Post Reply