archives

Twilight of the GPU

This interview with Tim Sweeney discusses his prediction that graphic rendering will move from special purpose GPUs back to the CPU:

I expect that in the next generation we'll write 100 percent of our rendering code in a real programming language—not DirectX, not OpenGL, but a language like C++ or CUDA. A real programming language unconstrained by weird API restrictions. Whether that runs on NVIDIA hardware, Intel hardware or ATI hardware is really an independent question. You could potentially run it on any hardware that's capable of running general-purpose code efficiently.

This is driven by the development of cheap multi-core CPUs. Consumers might still buy graphics boards, but they'll be fully programmable multi-core devices:

Intel's forthcoming Larrabee product will be sold as a discrete GPU, but it is essentially a many-core processor, and there's little doubt that forthcoming Larrabee competitors from NVIDIA and ATI will be similarly programmable, even if their individual cores are simpler and more specialized.

How are we going to program these devices? NVIDIA showed the data-parallel paradigm was practical with CUDA (LtU discussion). Now, Tim asks:

...can we take CUDA's restricted feature set—it doesn't support recursion or function pointers—and can we make that into a full C++ compatible language?... From my point of view, the ideal software layer is just to have a vectorizing C++ compiler for every architecture.

The FP lover is me says that data-parallel + C++ = the horror! However, I can appreciate it is a practical solution to a pressing problem. What do you think? Is Tim right? Is a data-parallel extension to C++ the right way to go? Or is the next version of Unreal going to be written in FRP?

Is There a Standard Formalism for Describing Abstract Syntax Trees?

I'm in a position where I need to describe an algorithm that operates over an abstract syntax tree. In this sense, the language would be that of a simple 'while' language and I'm only interested in statement level detail. An example of what I'm looking for would be a good, mathematically precise description of implementing a control flow graph. Does anyone know of any articles, papers, books with such a discussion? An example:

Program:

A = 0
while A != 10
  if A == 5 then
    print "hello, 5!"
  else
    print "waiting for a 5..."
  endif
  A = A + 1
endwhile

The obvious AST:

[stamentlist]
 +[assignment]
 +[while]     
   +[statementlist]
     +[if]
       +[statementlist]
         +[print]
       +[statementlist]
         +[print]
     +[assignment]