-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCLLowerIR][SemaSYCL] Support indirect hierarchical parallelism (#1…
…4264) This PR adds a missing feature in SYCL hierarchical parallelism support. Specifically, this PR adds support for the case when there are functions between parallel_for_work_group and parallel_for_work_item in the call stack. For example: void foo(sycl::group<1> group, ...) { group.parallel_for_work_item(range<1>(), [&](h_item<1> i) { ... }); } // ... cgh.parallel_for_work_group<class kernel>( range<1>(...), range<1>(...), [=](group<1> g) { foo(g, ...); }); --------- Signed-off-by: Sudarsanam, Arvind <arvind.sudarsanam@intel.com>
- Loading branch information
Showing
4 changed files
with
118 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//==- hier_par_indirect.cpp --- hierarchical parallelism test for WG scope--==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// This test checks correctness of hierarchical kernel execution when the work | ||
// item code is not directly inside work group scope. | ||
|
||
#include <iostream> | ||
#include <sycl/detail/core.hpp> | ||
|
||
void __attribute__((noinline)) foo(sycl::group<1> work_group) { | ||
work_group.parallel_for_work_item([&](sycl::h_item<1> index) {}); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
sycl::queue q; | ||
q.submit([&](sycl::handler &cgh) { | ||
cgh.parallel_for_work_group(sycl::range<1>{1}, sycl::range<1>{128}, | ||
([=](sycl::group<1> wGroup) { foo(wGroup); })); | ||
}).wait(); | ||
std::cout << "test passed" << std::endl; | ||
return 0; | ||
} |