08-02-10 - SPU Developing

Programming for the SPU might be really fun if it didn't take like 10 minutes to get the debugger loaded.

The whole MSVC editor-is-my-debugger thing is such a massive win that it really hurts to step back from it to the bad old days of separate debugger.

I did one thing that sort of helps - I run my test app in a loop, and when it finishes each test, I unload my SPU image, wait for a key press, then reload it and repeat. This lets me rebuild my SPU ELF and just reload it and repeat. This avoids a lot of test cycle time, but only works until you have a crash so it fails a lot.

The ability to just do stdin/stdout to/from a console from the PS3 is pretty awesome. It lets me write my test apps as if they were just command line apps and run them from my PC.


Aaron said...

Imagine trying to write a game on the PS3. Everything you do... takes forever. You can't do the reloading trick with PPU code (ok that's a lie, you CAN reload .o's... about 30% of the time). Really it's a miracle anything gets done for the PS3 at all. And this is after 5 years of them working on the debugger. For most of that time it was even worse (buggy, outright wrong, etc)

cbloom said...

Yeah I'm pretty sure I would smash something if I had to do work on this thing all the time.

I don't think I could work at a game company that did PS3, no matter how good the other factors might be (eg. Insomniac seems pretty cool otherwise).

When the basic tools to do your job are incredibly annoying, it's just demoralizing.

And it's so shitty that it pushes me into bad coding habits, like trying to fix bugs by just randomly changing code, or browsing the web while I work because I'm constantly stalling out.

RCL said...

Coding for Linux at home makes me more tolerant about shortcomings of SN tools.

That also creates a useful habit of debugging by logging, not trusting your compiler, not being dependent on any particular UI etc... ;-)

Aaron said...

Every single day I work on the PS3 I'm slightly angry about it (and I don't even have to really deal with SPU hell that much directly). It's not big anger, but it's there in the background lurking. Some of it is even just anger rooted in deep disrespect for anyone who could produce such a garbage tool and not hang their heads in shame to put their name on it.

Aaron said...

One thing I have learned though is that game programmers are some amazing folk. You could literally shit in a box and put it on their desk, and given the proper incentives, they could make incredible tech with it. A bunch of them would even fall in love with it and make that shit run faster than shit has ever run before.

RCL said...

PS3 is different in its philosophy from the other major platforms and that is a part of its appeal. Its integration with Microsoft tools is worse than that of other console(s) indeed, but for those of us accustomed to coding for non-Microsoft platforms it's not a show-stopper. Its hybrid processor is a beachhead into multicore computing of the future (which, I believe, will be based on asymmetric cores), something that CUDA and OpenCL only recently made possible on the PC.

And maybe there's also a difference between American and European attitude. Having challenges is a good thing, that's what makes "real" gamedev interesting. Without challenges, it would be very much the same boring industry like databases or flash games... Would you code Facebook games even if it earned you more money? That's analogous to working in a technological McDonalds...

cbloom said...

It's interesting to get other people's viewpoints and all, but that is a whole lot of nonsense.

There's a sort of Stockholm Syndrome that seems to happen with PS3 developers where they fall in love with it specifically because it so horrible to them. Very odd.

There's also a funny macho cowboy coder attitude where they like to brag about what difficult systems they've worked on. "I wrote an OS for a prototype where the chip had hardware bugs and it was all written with punch-cards". Okay, good for you, that sounds fucking awful, and I'm not impressed. It's pure masochism and misplaced pride.

Wasting time dealing with broken system software and rotten debuggers is not gratifying in any way, it's pure friction, it doesn't advance software engineering in any way, it doesn't develop new algorithms, or produce new beautiful results.

The shitty thing about SPU's and CUDA and such is also that they're so different that learning one doesn't really make you much better at the other. And it's hard to make code bases that are fast on both.

RCL said...

What I am trying to say is that broken debugger is a minor factor compared to whole new school of thought (well, at least for people without PS2 background) that Cell introduced.

And Cell and CUDA are certainly not the same, moreover, Cell is basically a dead end now, but both pushed/are pushing us in right direction of using specialized cores and "data-driven" programming, as opposed to "traditional" SMP that people often think about when they predict multicore future.

That advances software engineering, and broken/hard to use debuggers are only minor impediment to that.

Compare that to Microsoft, which simply reused old (and cost-optimized, hence crippled) IBM technology without bringing anything new to the table (I'm speaking CPU-wise).

cbloom said...

"What I am trying to say is that broken debugger is a minor factor compared to whole new school of thought (well, at least for people without PS2 background) that Cell introduced."

I actually like the cell hardware pretty well, but it's not a new school of thought by any means, there have been coprocessors of various sorts for ages. It just forces game devs to write their engine in a packetized work-spreadable way.

And the only good thing I can say for the PS3 dev environment is that it is a big step up from the PS2. That was like everything bad about the PS3 plus worse docs, worse system libraries, etc.

Sam said...

The SN debugger seems just as bad as it was in the PS2 days though. Without fail, whenever I close it it core dumps and crashes. At least it doesn't do the random silent crashes that the PS2 version used to do where when it hit a breakpoint the debugger would just totally disappear without any warning!

cbloom said...

The random disconnects from the host are pretty awesome. It's great when you find a bug and you leave the debugger sitting at that spot while you go to lunch ,and come back and find that it's decided to kill itself. Thanks debugger! I want to smash you!

Sam Hocevar said...

I have to half-agree with RCL here. Coding for the SPU both on Linux and with the SN tools made me more efficient indeed. But coding on Linux also made me hate the SN tools. Linux allows several developers to use the PS3 at the same time, or deploy a binary on the first available box (eat that, Target Manager), or compile natively and run under gdb. I can use valgrind, vim and grep, read and write data from local files. The debugger does not crash. There is no reboot, ever.

Sure, this only works for small pieces of code or software that has a meaning outside the PS3 game, and has no chance of working for SPU code that uses the RSX. But for the cases where it works, it makes me very happy. I don't even feel like I'm working.

I think the PS3 is a wonderful machine. I cannot resent Sony enough for taking Linux support away from me, but I love coding for the SPU about as much as I hate the SN tools.

cbloom said...

Eh.. nah. I just don't buy it. I was starting to think "mm maybe it's not so bad" but then I went back to doing some Xenon dev.

I just changed a few lines in my Xenon code, hit F5, boom my app was running right away, it ran through all my tests and was done in about 3 seconds.

During that time the PS3 is still thinking about maybe connecting to the host, and then 15 seconds later decides that it's timed out friggle frack or I have to go force disconnect someone or hard reboot it or god knows what. And god help me if I have to actually debug something.

On the plus side, I can write & test my PowerPC code for Xenon and then just move it to the PS3.

The dev tools are just miles apart and I'm sick of you all being apologists for them. It's like saying that in-order cores are okay. They're just not.

old rants