ldc/dcompute nvptx intrinsics

Bruce Carneal bcarneal at gmail.com
Sun Feb 21 01:18:10 UTC 2021


On Saturday, 20 February 2021 at 12:38:35 UTC, Johan Engelen 
wrote:
> On Friday, 19 February 2021 at 20:02:29 UTC, Bruce Carneal 
> wrote:
>>
>> I'd love to bring up some additional functionality but I'm new 
>> to LDC/LLVM so it's slow going at this point of the learning 
>> curve.  Does anyone have additional LDC/dcompute CUDA 
>> intrinsics working or have some pointers for bringing up more 
>> CUDA/warp intrinsics generally?
>
> Hi Bruce,
>   You can write LLVM IR inside D code using ldc.llvmasm.__irEx. 
> Perhaps that works as a quick workaround for defining calls to 
> intrinsics.
> Very quickly, something like this:
>
> ```
> alias someFunction = __irEx!("forward declaration of 
> intrinsic", "call intrinsic(%0,%1,%2)", int, long, void*);
> ```
>
> -Johan

Here's what I get so far when testing the above out against 
llvm.nvvm.barrier0.popc (something that works as an 
LDC_intrinsic):

"can only call functions from other @compute modules in @compute 
code"

I'll keep digging.



More information about the digitalmars-d-ldc mailing list