Plan of Attack for SPIRV and NVPTX

Nicholas Wilson via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon May 23 01:21:09 PDT 2016


On Sunday, 22 May 2016 at 12:02:21 UTC, Johan Engelen wrote:
> On Sunday, 22 May 2016 at 11:31:43 UTC, Nicholas Wilson wrote:
>>
>> Found it -output-ll
>
> Have a look in the tests/codegen folder of how we use this to 
> do IR testing. I think it will be very useful for your work.

Heh so is clangs.

How do you go about creating metadata?

I want to do

!nvvm.annotations = !{!n}
!n = !{void (float*)* @my_kernel, !"kernel", i32 1}

where !n is a unique MDNode.
  so far i have
llvm::NamedMDNode *nnvm_annotations = 
gIR->module.getOrInsertNamedMetadata(StringRef("nnvm.annotations"));
llvm::MDNode *kernel_md_node = new 
llvm::MDNode(gIR->context,???what goes here???);
nnvm_annotations->addOperand(kernel_md_node);

I have access to the function as
  llvm::Function *func;

many thanks
Nic


More information about the digitalmars-d-ldc mailing list