Data-oriented programming and the vectorisation transformation
I just realised that the data layout and the resulting code organisation in data-oriented programming, as proposed for games design, in many aspects resembles the data layout and code organisation favoured by the vectorisation transformation that is at the core of Data Parallel Haskell. This should not be surprising as both have similar goals, namely to maximise data throughput, to minimise stalls by utilising the memory hierarchy, and to maximise parallelism.
However, the parallels are interesting given the very different origins of both approaches. The big difference is of course that data-oriented programming is a design methodology for programmers, whereas the vectorisation transformation is a program transformation automatically applied by a compiler. Nevertheless, we may regard the vectorisation transformation as a program transformation that turns purely functional code into code that is structured in a data-oriented manner, where the layout of bulk data shapes the organisation of the code.
This raises the question of how useful nested data parallel programming and the vectorisation transformation may be to games programming.
5 comments
This and other optimisations for CUDA make me think that the best way to write for CUDA is by compiling from a higher level language such as DpH), which I believe is a work-in-progress.
Good work.
Accelerate is less ambitious as DPH in the range of programs being parallelised, but it is more ambitious in the targeted hardware. DPH on GPUs is a longer-term goal (we want it to work well on multicore CPUs first), though it may get easier with the new Fermi architecture that NVIDIA recently announced (which among other things appears to support function pointers in GPUs kernels).
Thanks.
