ldc nvvm GPU intrinsics good news

kinke noone at nowhere.com
Fri Mar 5 11:28:31 UTC 2021


On Friday, 5 March 2021 at 01:59:35 UTC, Bruce Carneal wrote:
> To be clear, I'm not asking for how a new builtin might be 
> added cleanly, I'm asking if there is a better way to access 
> all the builtins present in the current .di file.
>
> As noted above, I had to copy and edit the .di file to avoid 
> this error from ldc:
> ...: Error: can only call functions from other @compute modules 
> in @compute code
>
> Once I did that, everything I have tried from the edited .di 
> file appears to work as intended.  Amazing!  I just thought 
> that copying/editing could be avoided.

The dcompute parts in the compiler could definitely be improved 
(but it's nowhere on my priorities list). What I tried to get at 
by linking my comment [1] is that you can generally target 
NVPTX/AMDGCN directly, without any @compute stuff, and in that 
case importing and using intrinsics from that .di works without 
any issues.

[1] 
https://github.com/ldc-developers/ldc/pull/3411#issuecomment-619385886


More information about the digitalmars-d-ldc mailing list