Saturday, September 22, 2007

What technology do programers need?

There are many many programming languages --- from low level languages, C and C++ to the next generation high-level language providing GC like Java and C#. I have a question: How do you use the next generation high-level language in multi-core machines which prohibit rich programming? Will that be really available in the near future, especially the game console? In Gamefest Japan 2007, microsoft said; Inline assembly has gone. we will suggest developing a game with C# and inline C/C++. It will be instead of C/C++ and inline assembly.

However, I personally think C# will not be effective for the game console. Indeed, the right to existence of C++ will be jeopardized.

- Why has inline assembly gone?
Why has inline assembly has been vanished in the latest video game development? Perhaps, the reason is not that assembly language spec is difficult to write much code for big game. The true reason is that the latest CPU in the next generation game console is IN-ORDER and is too long PIPELINE, so it's impossible to hit CACHE well with assembly programming manually. Tuning with assembly is difficult. Programers must use Compiler well with Compile Option to optimize native code. In other words, programmers use C and VMX like macro of assembly.

- 2-way Hardware Thread
In Java and C#, multi-core programing and multi-thread programing are the same concept. But, in the game console, they are different. Multi-core programing has a clear merit of parallel processing. That's just distributed program. Meanwhile, 2-way thread program does not have easy merit to understand. While a thread engenders PIPELINE-STALL, the CPU executes another thread exclusively. If threads don't cause appropriate STALL, thread programing doesn't exercise good performance. But, if both of two threads cause STALL often, thread programing becomes bad performance.

Consider a balance of parallel threads on hardware thread. Maybe programers have to check assembly code generated by C-Compiler. Meanwhile, threads in Java and C# expect to be distributed to multi-core. XNA Theads can specify thread number and core number, but C# is unable to control PIPELINE. So that's rough and unenough for 2-way hardware thread.

- C++ may have gone..?
When I check programing method from a such view, we may be unable to use 100% of object oriented programing like virtual functions. Virtual functions are heavy process. But, in this case, the JUMP-TABLE may cause PIPELINE-STALL. If you use PIC for PIPELINE, you can not use virtual functions because it does not have fixed address. PIC is the best for CPU and the worst for programers who want to use virtual functions.

MS said; C# will be used for global programing. C/C++ will be used for good performance. Inline C/C++ is instead of inline assembly.

But, the "assembly -> C" movement is for performance, not productivity. Because assembly is not effective to long PIPELINE of the latest CPU. Meanwhile, the "C/C++ -> C#" movement is for productivity, not performance. I think that is old mind-set which believes CPU continues growing. Or, we have to wait the next generation that we can believe high-level languages save us.

- What technology do programers need?
GPU will get to hardware thread and will have the same merit as CPU hardware thread. Fortunately, the next generation game consoles don't equip a such GPU. But, programers will have to use both of CPU hardware multi-thread and GPU hardware multi-thread and will use GPU as SIMD processor. I think that's strange pipeline. Development under a such pipeline will get difficult than Cell.

Sony recommends using the special assembly language to optimize SPU. Meanwhile, RSX is not good GPU, so programers don't need to use RSX as a kind of SIMD processor. It seems that the Cell architecture is simple.

Programers will be forked to two kinds. I know two kinds, because I have acted in XOOPS Cube.

Web and XML programing is very short schedule and uses String always. It is single-thread program with multi-thread middleware like MySQL. These programers have to quest for good middleware and productivity always, under short schedule. That's hard work, because programers don't have float. I am not good at this category.

Meanwhile, other programers have to set performances above productivity. Wii says; all games don't have to be gorgeous. But, programers have similar destiny. The program culture has been changed. We have to keep fighting.

No comments: