Has anyone here tried to run non graphics related code on the GPU?
IE: Arbitrary math calculations

I don't know modern GPU assembly, but I assume if I did I'd be able to write a shader in GPU asm and then use something like DX9CompileVertexShader to turn it into machine code.  BUT I don't know how the input and output works, once it's done with the calculations how would I retrieve the results etc.

If you google this topic you get a bunch of USELESS stuff about HIGHLEVEL shader languages Cg(dx/gl), HLSL(dx), Brook stream programming in C, Sh(gl), and advertisements for books.  (all useless)
;not totally useless just not relevant enough

If someone's searching skills are better than mine or you have a simple example program that (for example) accumulates all the singleFP values in an array on the GPU and returns the result I would be very interested in your reply.


On a side note a snippet for 64bit programming just poped into my head
Since SSE/2/3 instructions will be used more in 64bit programming aligning your local stack frames would improve code efficiency (you'd be able to use the Align xmmx instructions).
push rbp
mov rbp,rsp
push rbx
and rsp,-16
sub rsp,64
mov rbx,rsp
;now you have 3 aligned 16byte locals at rbx, rbx+16, and rbx+32

Um anyway the GPU question help/examples would be appreciated thanks.
Posted on 2005-06-26 14:30:21 by r22
Hi r22,

I don't mean to be cross linking between the forums but this was recently asked over at masmforum and there were some good links suggested. See the thread.
Posted on 2005-06-26 15:03:23 by Eóin
I was hoping for help on a more LOW LEVEL solution. But I guess there is none.
The Brook GPGPU project compiles source with a Runtime and converts the stream C code to HLSL.

The irony of not being able to easily take advantage of the biggest speed optimization in ASM is a big disheartening.
Posted on 2005-06-27 16:54:36 by r22
Why not learning GPU's shader instruction set? I think the only tricky part is to get the data back... ...because i have no idea how to do that :|
Posted on 2005-06-27 19:01:38 by ti_mo_n

Why not learning GPU's shader instruction set?

Because it's udocumented and you probably don't have easy access to program directly in it?

Best you can do is the meta-assembly thingy...
Posted on 2005-06-27 19:08:15 by f0dder