From e1ea7ed2f9b8cfcf19258a05d270de4db03fec22 Mon Sep 17 00:00:00 2001 From: Dietrich Geisler Date: Wed, 12 Aug 2020 13:39:08 -0400 Subject: GPU Foreach Parsing and Checking (#1482) This PR introduces parsing and semantic checking for a GPU foreach loop for heterogeneouis programming. A GPU foreach loop takes the form: ``` __GPU_FOREACH(renderer, gridDims, LAMBDA(uint3 dispatchThreadID) { kernelCall(args, ...); }); ``` And will allow the host code to call into a kernel with the correct renderer and grid dimensions. This commit also introduces a hack to unify types in the heterogeneous hello world file, which will hopefully be amended in the future. Co-authored-by: Tim Foley --- source/slang/slang-check-stmt.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/slang/slang-check-stmt.cpp') diff --git a/source/slang/slang-check-stmt.cpp b/source/slang/slang-check-stmt.cpp index 2d01086f1..9a5aee15c 100644 --- a/source/slang/slang-check-stmt.cpp +++ b/source/slang/slang-check-stmt.cpp @@ -288,4 +288,13 @@ namespace Slang stmt->expression = CheckExpr(stmt->expression); } + void SemanticsStmtVisitor::visitGpuForeachStmt(GpuForeachStmt*stmt) + { + stmt->renderer = CheckExpr(stmt->renderer); + stmt->gridDims = CheckExpr(stmt->gridDims); + ensureDeclBase(stmt->dispatchThreadID, DeclCheckState::Checked); + WithOuterStmt subContext(this, stmt); + stmt->kernelCall = subContext.CheckExpr(stmt->kernelCall); + return; + } } -- cgit v1.2.3