Thread affinity in affine.parallel

When issuing affine parallel, the compiler sometimes has the notion that the parallel region should use threads nearby (e.g. to benefit from spacial locality between the threads) or conversely that the parallel region should use threads that are far apart (e.g. to benefit from less sharing of caches between concurrent threads).

OpenMP specs, and dialect, have support for this via the proc-bind attribute. Values are typically “close” and “spread” for “nearby” vs “apart” in the above description.

Is there an appetite to provide such thread affinity concept into the affine dialect parallel operation?

Thanks for your insights on the matter



If we were to provide such information, I would rather have it shared between various parallel constructs and not limited specifically to affine.parallel.


Totally agree.

To work through the lowering process, a thread affinity in the affine.parallel would need to be reflected in the scf.forall or scf.parallel, which I believe is then typically lowered to the omp dialect.

The async dialect could potentially also benefits from such a concept.