www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - dcompute - A library + ldc modifications - can now build a simple add

reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
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
Jul 17 2016
parent reply cym13 <cpicard openmailbox.org> writes:
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.
Jul 17 2016
parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
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.
Jul 17 2016