Thread overview
dcompute - A library + ldc modifications - can now build a simple add kernel
Jul 17, 2016
Nicholas Wilson
Jul 17, 2016
cym13
Jul 18, 2016
Nicholas Wilson
July 17, 2016
Available here[1][2], it can now build a simple add kernel for both CUDA (.ptx) and OpenCL (.spv) (and of course the host code) in one compiler invocation.

A lot of things are still hardcoded and the optimisations need to tuned a bit more but it works.

Any and all testing, feedback,bug reports and pull requests welcome!

I'll be working on it the next two weeks, after which I go back to uni and will have less time to work on it, so the more feed back the better!

[1]https://github.com/thewilsonator/dcompute
[2]https://github.com/thewilsonator/ldc/tree/dcompute
July 17, 2016
On Sunday, 17 July 2016 at 07:45:45 UTC, Nicholas Wilson wrote:
> Available here[1][2], it can now build a simple add kernel for both CUDA (.ptx) and OpenCL (.spv) (and of course the host code) in one compiler invocation.
>
> A lot of things are still hardcoded and the optimisations need to tuned a bit more but it works.
>
> Any and all testing, feedback,bug reports and pull requests welcome!
>
> I'll be working on it the next two weeks, after which I go back to uni and will have less time to work on it, so the more feed back the better!
>
> [1]https://github.com/thewilsonator/dcompute
> [2]https://github.com/thewilsonator/ldc/tree/dcompute

What did you have to modify in LDC? Was the change important? I'm asking because the lesser the change the more likely it is to be maintanable in the future and/or added to LDC as a proper extension.
July 18, 2016
On Sunday, 17 July 2016 at 19:23:19 UTC, cym13 wrote:
> On Sunday, 17 July 2016 at 07:45:45 UTC, Nicholas Wilson wrote:
>> Available here[1][2], it can now build a simple add kernel for both CUDA (.ptx) and OpenCL (.spv) (and of course the host code) in one compiler invocation.
>>
>> A lot of things are still hardcoded and the optimisations need to tuned a bit more but it works.
>>
>> Any and all testing, feedback,bug reports and pull requests welcome!
>>
>> I'll be working on it the next two weeks, after which I go back to uni and will have less time to work on it, so the more feed back the better!
>>
>> [1]https://github.com/thewilsonator/dcompute
>> [2]https://github.com/thewilsonator/ldc/tree/dcompute
>
> What did you have to modify in LDC? Was the change important? I'm asking because the lesser the change the more likely it is to be maintanable in the future and/or added to LDC as a proper extension.

I think the only changes (as opposed to additions) were to main.cpp and to how it translates D type to llvm types (making it somewhat aware of addrspaces) and possibly some logging suff to figure out what it does. I'll have to run clang-format on it at some point though.

There's a lot of semi-duplicate code though, I copied most of the declaration and statement codegen stuff, and got rid of all the stuff I wouldn't use, e.g. classes exceptions and whatnot.