In most cases, hidden helper task behave similar as detached tasks. That means, for example, if we have to wait for detached tasks, we have to do the same thing for hidden helper tasks as well. This patch adds the missing condition for hidden helper task accordingly along with detached task. Reviewed By: AndreyChurbanov Differential Revision: https://reviews.llvm.org/D107316
32 lines
572 B
C++
32 lines
572 B
C++
// RUN: %libomptarget-compilexx-and-run-generic
|
|
|
|
// UNSUPPORTED: amdgcn-amd-amdhsa
|
|
|
|
#include <cassert>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
int data[1024];
|
|
int sum = 0;
|
|
|
|
for (int i = 0; i < 1024; ++i)
|
|
data[i] = i;
|
|
|
|
#pragma omp target map(tofrom: sum) map(to: data) depend(inout : data[0]) nowait
|
|
{
|
|
for (int i = 0; i < 1024; ++i) {
|
|
sum += data[i];
|
|
}
|
|
}
|
|
|
|
#pragma omp target map(tofrom: sum) map(to: data) depend(inout : data[0])
|
|
{
|
|
for (int i = 0; i < 1024; ++i) {
|
|
sum += data[i];
|
|
}
|
|
}
|
|
|
|
assert(sum == 1023 * 1024);
|
|
|
|
return 0;
|
|
}
|