digitalmars.D.ldc - Plan of Attack for SPIRV and NVPTX
- Nicholas Wilson (5/5) May 21 2016 Hello
- Johan Engelen (19/24) May 22 2016 Sounds like a great (tough!) project!
- Nicholas Wilson (3/8) May 22 2016 Thanks, does ldc have an -emit-llvm switch (in one of the llvm
- Nicholas Wilson (2/13) May 22 2016 Found it -output-ll
- Johan Engelen (3/4) May 22 2016 Have a look in the tests/codegen folder of how we use this to do
- Nicholas Wilson (17/22) May 23 2016 Heh so is clangs.
- Johan Engelen (6/7) May 23 2016 For that I usually also look at how Clang/LLVM does it. Often
- Nicholas Wilson (3/11) May 23 2016 Thanks
- Johan Engelen (4/6) May 24 2016 Sorry I don't know.
- Johan Engelen (4/12) May 24 2016 Btw, I'd be happy to help with the lit-based testsuite if you
- David Nadlinger via digitalmars-d-ldc (4/7) May 24 2016 Yes, it definitely does deserve more appreciation (I'm guilty of this
- Nicholas Wilson (3/16) May 24 2016 Pardon my ignorance, whats a lit-based test suite? ( I've got a
- Johan Engelen (2/5) May 25 2016 http://forum.dlang.org/post/jorzeoxnxzkzcsdajewf@forum.dlang.org
Hello I have made a wiki entry for targeting SPIRV and NVPTX. I will have some time over the upcoming (southern hemisphere) winter break to work on this. please comment and destroy.
May 21 2016
On Sunday, 22 May 2016 at 06:41:53 UTC, Nicholas Wilson wrote:Hello I have made a wiki entry for targeting SPIRV and NVPTX. I will have some time over the upcoming (southern hemisphere) winter break to work on this. please comment and destroy.Sounds like a great (tough!) project! For plan of attack, what I would do is: 1. Get something _super_ simple working. For example, a kernel for vector addition. Don't do any legality checks, etc, really just get it to work. Code can be ugly hacks, whatever you need to get it to work. This would teach you how to integrate the target into LDC. Possibly you find out that the design you started out with doesn't quite fit well, and so you may have to reimplement parts with a better design knowing what you've learned so far. 2. Legality: disable pretty much all fancy D features for kernel stuff. Try to stay out of the ddmd code as much as possible, perhaps do the legality checking in an extra semantic pass (AST walk) in LDC code, an equivalent of a "semantic4" but with a better name. Add a ton of test cases. 3. Start implementing support for D features, slowly relaxing the legality contraints.
May 22 2016
On Sunday, 22 May 2016 at 10:13:02 UTC, Johan Engelen wrote:On Sunday, 22 May 2016 at 06:41:53 UTC, Nicholas Wilson wrote:Thanks, does ldc have an -emit-llvm switch (in one of the llvm switches it hides)?[...]Sounds like a great (tough!) project! For plan of attack, what I would do is: [...]
May 22 2016
On Sunday, 22 May 2016 at 11:24:43 UTC, Nicholas Wilson wrote:On Sunday, 22 May 2016 at 10:13:02 UTC, Johan Engelen wrote:Found it -output-llOn Sunday, 22 May 2016 at 06:41:53 UTC, Nicholas Wilson wrote:Thanks, does ldc have an -emit-llvm switch (in one of the llvm switches it hides)?[...]Sounds like a great (tough!) project! For plan of attack, what I would do is: [...]
May 22 2016
On Sunday, 22 May 2016 at 11:31:43 UTC, Nicholas Wilson wrote:Found it -output-llHave 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.
May 22 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: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 NicFound it -output-llHave 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.
May 23 2016
On Monday, 23 May 2016 at 08:21:09 UTC, Nicholas Wilson wrote:How do you go about creating metadata?For that I usually also look at how Clang/LLVM does it. Often there are helper functions around to create metadata. The llvm::MDBuilder class is useful too: http://llvm.org/docs/doxygen/html/classllvm_1_1MDBuilder.html -Johan
May 23 2016
On Monday, 23 May 2016 at 08:26:38 UTC, Johan Engelen wrote:On Monday, 23 May 2016 at 08:21:09 UTC, Nicholas Wilson wrote:Thanks What type is a function pointer MDNode? A DISubroutineType?How do you go about creating metadata?For that I usually also look at how Clang/LLVM does it. Often there are helper functions around to create metadata. The llvm::MDBuilder class is useful too: http://llvm.org/docs/doxygen/html/classllvm_1_1MDBuilder.html -Johan
May 23 2016
On Monday, 23 May 2016 at 09:31:30 UTC, Nicholas Wilson wrote:What type is a function pointer MDNode? A DISubroutineType?Sorry I don't know. I guess you already had a look at how Clang generates the metadata?
May 24 2016
On Monday, 23 May 2016 at 08:21:09 UTC, Nicholas Wilson wrote:On Sunday, 22 May 2016 at 12:02:21 UTC, Johan Engelen wrote:Btw, I'd be happy to help with the lit-based testsuite if you have any issues or special requests. I am a huge fan of it :)On Sunday, 22 May 2016 at 11:31:43 UTC, Nicholas Wilson wrote:Heh so is clangs.Found it -output-llHave 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.
May 24 2016
On 24 May 2016, at 13:21, Johan Engelen via digitalmars-d-ldc wrote:Btw, I'd be happy to help with the lit-based testsuite if you have any issues or special requests. I am a huge fan of it :)Yes, it definitely does deserve more appreciation (I'm guilty of this too). ;) — David
May 24 2016
On Tuesday, 24 May 2016 at 12:21:24 UTC, Johan Engelen wrote:On Monday, 23 May 2016 at 08:21:09 UTC, Nicholas Wilson wrote:Pardon my ignorance, whats a lit-based test suite? ( I've got a cold atm so I'm not thinking properly.)On Sunday, 22 May 2016 at 12:02:21 UTC, Johan Engelen wrote:Btw, I'd be happy to help with the lit-based testsuite if you have any issues or special requests. I am a huge fan of it :)On Sunday, 22 May 2016 at 11:31:43 UTC, Nicholas Wilson wrote:Heh so is clangs.Found it -output-llHave 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.
May 24 2016
On Tuesday, 24 May 2016 at 23:41:46 UTC, Nicholas Wilson wrote:Pardon my ignorance, whats a lit-based test suite? ( I've got a cold atm so I'm not thinking properly.)http://forum.dlang.org/post/jorzeoxnxzkzcsdajewf forum.dlang.org
May 25 2016