OpenMP Worksharing Loop RFC

@schweitz I am unsure if you followed this discussion (it is rather long) but your proposal was discussed and there are multiple problems with it.

A worksharing loop is not a worksharing thing and a regular loop. You cannot pretend the loop is like any other scf/fir loop and expect correctness. As pointed out earlier, any transformation that modifies the loop stride or bounds would be incorrect. Loop interchange, collapse, strip-mine, tile, … are all incorrect if there is a workshare loop bound to them (and they do not take appropriate precautions). That means, merging late exposes the potential for mis-compilation, as was pointed out today in the Flang-Dev call.

It was argued that separation doesn’t even provide benefits. If you have to teach everything about the worksharing loop, why not teach it about a wsloop op instead. In case you disagree, could you please provide a specific example to justify separation? Also, why do you believe it is sound to do so [I mean why can generic transformations be unaware of the special meaning of worksharing, offloading, data-sharing (private/firsptrivate/…)]?

1 Like