jtb20 wrote:
> something like
>
> ```
> bool Init[N] = {false};
> for (int ij = 0; ij < N*N; ij++) {
> int i = ij / N, j = ij % N;
> #pragma omp critical
> if (!Init[i]) {
> arr2[i] = i;
> Init[i] = true;
> }
> arr1[i][j] += arr2[i];
> }
> ```
I don't think synthesizing a critical region inside the collapsed loop will be
a win overall, and also I don't quite see how it helps in this case. A correct
version would be doing something like serialising the loop, I think, which I
suppose sort of bypasses the problem, but doesn't really solve it. (When would
we do such a transformation? How much analysis do we need to avoid killing
performance in non-contrived cases?)
https://github.com/llvm/llvm-project/pull/96087
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits