You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving the declaration of the loop control variable during the normalization of an OpenMP loop may cause a declaration issue because of scoping change. After some thinking and testing on REX, in my opinion, this probably won't be an issue. Given the following AXPY example:
inti=10; // i(1), scope 1#pragma omp target parallel for map(...)
for (inti=0; i<n; ++i) // i(2), scope 2y[i] +=a*x[i];
In this case, two symbols i(1) and i(2) share the same name, but it's OK because they are in different scopes. To lower the directive, we move int i(2) out of the loop. It seems like a declaration conflict will happen. However, before doing that, we always outline first so that the OpenMP code will all go to another function. Thus, an intermediate status of lowering would be something like this:
__global__voidoutlined_func(...) {
// waiting for loop normalization and transformationfor (inti=0; i<n; ++i) // i(2)y[i] +=a*x[i];
}
inti=10; // i(1), scope 1
{
// some statements for GPU kernel call.
}
In this case, i(2) is not even part of the outlined function parameter because its declaration is always inside the outlining region.
The text was updated successfully, but these errors were encountered:
Moving the declaration of the loop control variable during the normalization of an OpenMP loop may cause a declaration issue because of scoping change. After some thinking and testing on REX, in my opinion, this probably won't be an issue. Given the following AXPY example:
In this case, two symbols
i(1)
andi(2)
share the same name, but it's OK because they are in different scopes. To lower the directive, we moveint i(2)
out of the loop. It seems like a declaration conflict will happen. However, before doing that, we always outline first so that the OpenMP code will all go to another function. Thus, an intermediate status of lowering would be something like this:In this case,
i(2)
is not even part of the outlined function parameter because its declaration is always inside the outlining region.The text was updated successfully, but these errors were encountered: