From ff2d490dc120708a2fcb6eea5880a6b7c6586a4b Mon Sep 17 00:00:00 2001 From: Dietrich Geisler Date: Mon, 17 Aug 2020 12:50:44 -0400 Subject: GPU Foreach Loop (#1498) * GPU Foreach Loop This PR introduces the completed GPU foreach loop and updates the heterogeneous-hello-world example to use it. This PR builds on the previous introduction of the GPU Foreach loop parsing and semantic checking PR (#1482) by introducing IR lowering and emmitting. THe new feature can be used by having a GPU_Foreach loop interacting with a named non-CPP entry point, and using the -heterogeneous flag. * Fix to path Co-authored-by: Tim Foley --- source/slang/slang-ir-link.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'source/slang/slang-ir-link.cpp') diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp index 9de2b5d1c..274fbf6d9 100644 --- a/source/slang/slang-ir-link.cpp +++ b/source/slang/slang-ir-link.cpp @@ -1491,19 +1491,21 @@ LinkedIR linkIR( cloneValue(context, bindInst); } } - - for (IRModule* irModule : irModules) + if (target == CodeGenTarget::CPPSource) { - for (auto inst : irModule->getGlobalInsts()) + for (IRModule* irModule : irModules) { - auto hasPublic = inst->findDecoration(); - if (!hasPublic) - continue; - - auto cloned = cloneValue(context, inst); - if (!cloned->findDecorationImpl(kIROp_KeepAliveDecoration)) + for (auto inst : irModule->getGlobalInsts()) { - context->builder->addKeepAliveDecoration(cloned); + auto hasPublic = inst->findDecoration(); + if (!hasPublic) + continue; + + auto cloned = cloneValue(context, inst); + if (!cloned->findDecorationImpl(kIROp_KeepAliveDecoration)) + { + context->builder->addKeepAliveDecoration(cloned); + } } } } -- cgit v1.2.3