As it turns out, GPUs are relatively easy to program when you have an LLVM back-end. This PR adds Turbo, a work-in-progress library that allows for transparent GPU programming from the comfort of C# code.
Turbo's main API is this method, defined in the Turbo.Parallel class:
public static Task ForAsync(int threadCount, Action kernel)
That is, you tell Turbo how many threads to launch and pass a delegate to specify the code that each of these threads should run. Turbo takes care of all the hard parts: it compiles the delegate to code suitable for execution on the GPU, it copies the delegate's call target to GPU memory, and it launches the kernel. Turbo wraps every kernel in aTask so you can easily manage kernel concurrency.
As it turns out, GPUs are relatively easy to program when you have an LLVM back-end. This PR adds Turbo, a work-in-progress library that allows for transparent GPU programming from the comfort of C# code.
Turbo's main API is this method, defined in the
Turbo.Parallel
class:That is, you tell Turbo how many threads to launch and pass a delegate to specify the code that each of these threads should run. Turbo takes care of all the hard parts: it compiles the delegate to code suitable for execution on the GPU, it copies the delegate's call target to GPU memory, and it launches the kernel. Turbo wraps every kernel in a
Task
so you can easily manage kernel concurrency.