using DCompute

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 27 18:30:58 PDT 2017


On Friday, 28 July 2017 at 00:39:43 UTC, James Dean wrote:
> On Friday, 28 July 2017 at 00:23:35 UTC, Nicholas Wilson wrote:
>> On Thursday, 27 July 2017 at 21:33:29 UTC, James Dean wrote:
>>> I'm interested in trying it out, says it's just for ldc. Can 
>>> we simply compile it using ldc then import it and use dmd, 
>>> ldc, or gdc afterwards?
>>
>> The ability to write kernels is limited to LDC, though there 
>> is no practical reason that, once compiled, you couldn't use 
>> resulting generated files with GDC or DMD (as long as the 
>> mangling matches, which it should). This is not a priority to 
>> get working, since the assumption is if you're trying to use 
>> the GPU to boost your computing power, then you like care 
>> enough to use LDC, as opposed to DMD (GDC is still a bit 
>> behind DMD so I don't consider it) to get good optimisations 
>> in the first place.
>>
>
> Yes, but dmd is still good for development since LDC sometimes 
> has problems.

If you have problems please tell us!

> Can we compile kernels in LDC and import them in to a D project 
> seamlessly? Basically keep an LDC project that deals with the 
> kernels while using dmd for the bulk of the program. I mean, is 
> it a simple import/export type of issue?

Yes, although I'll have to add an attribute shim layer for the 
dcompute druntime symbols to be accessible for DMD. When you 
compile LDC will produce .ptx and .spv files in the object file 
directory which will be able to be used in any project. The only 
thing that will be more fragile is lambda kernels as they are 
mangled numerically (`__lambda1`, `__lambda1` and so on).


More information about the Digitalmars-d-learn mailing list