ldc nvvm GPU intrinsics good news

Bruce Carneal bcarneal at gmail.com
Fri Mar 5 01:52:11 UTC 2021


On Friday, 5 March 2021 at 00:16:41 UTC, kinke wrote:
> On Friday, 5 March 2021 at 00:03:26 UTC, Bruce Carneal wrote:
> ... These files are auto-generated from the LLVM .td file using 
> a tiny program [1]. It's currently limited to intrinsics with a 
> GCCBuiltinName, so if you'd like to make more of these 
> available in D, see processRecord().
>
> [1] 
> https://github.com/ldc-developers/ldc/blob/master/utils/gen_gccbuiltins.cpp

Good to know.  __nvvm_vote_ballot and __nvvm_vote_ballot_sync 
both show up in the .td file with GCCBuiltin names but do not 
show up in the .di file.

I've found a workaround for those but I'd like to understand what 
kept them from being included in the .di file.  I'm guessing it 
is the dtype(...) call from within processRecord(...) that did 
not know what to do with an i1 type?

If it's as simple as that I'd greatly appreciate your augmenting 
the if/else ladder in dtype() to include the branch for i1.  The 
ballot/vote instruction may be better than my workaround and has 
other uses.

I tried to work around the .di file issue by declaring my own 
pragma:
pragma(LDC_intrinsic, "llvm.nvvm.vote.ballot") int myBallot(bool);
with no luck:
  LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.vote.ballot

If you know how I can manually define the ballot pragmas 
correctly before any dtype(...) upgrade you might release, please 
let me know.

Finally and again, many thanks for your efforts maintaining LDC.



More information about the digitalmars-d-ldc mailing list