GPUs and Array Operations

Knud Soerensen 4tuu4k002 at sneakemail.com
Tue Jul 10 00:08:11 PDT 2007


On Mon, 09 Jul 2007 19:43:27 -0500, Craig Black wrote:

> Interesting syntax.  I like it, but in order to support GPU's there would 
> have to be some way that the programmer specified GPU or CPU computation. 
> Perhaps a new keyword or pragma?
> 
The purpose of the syntax is to have a hardware independent way
to specify large array calculations. 

If you specify in the code if it should be CPU or GPU the 
you have lost this Independence. so, I think it should be automatic by the
compiler or a compiler switch so if you get new hardware you just
recompile your code.


 

> I'm fuzzy on the details of how this could actually be done on the GPU.  The 
> compiler would have to somehow generate either high-level or low-level 
> shading language routines for each statement.  That means each function 
> called would also have to be converted to GPU code.
> 
> There would obviously be some restrictions as to what kinds of language 
> features could be used when the GPU option is enabled.  For example, no 
> function pointers, no heap allocations, etc, etc.  I'm sure there would end 
> up being a lot.

Yes, that is why we need a special syntax and can not just use the foreach
statement. 
   

> I suppose special floating point types could automatically be mapped.  For 
> example the compiler could automatically convert the static array float[3] 
> to the shading language type float3.
> 
> -Craig
> 
> "Knud Soerensen" <4tuu4k002 at sneakemail.com> wrote in message 
> news:f6uiqk$2qad$2 at digitalmars.com...
>> Take a look on the vectorization suggestion on the wish list
>> http://all-technology.com/eigenpolls/dwishlist/index.php?it=10
>> this notation lets you specify vector calculation in such
>> a way that the compiler can optimize them and let them run on the GPU
>> if that is preferred.



More information about the Digitalmars-d mailing list