[OpenMP][offload] Size the grid of cross-team reductions by their size (#234190)

Use the ReductionDataSize for sizing the grid of xteam reductions.
Classify a reduction with a ReductionDataSize of 32bytes and more as
"large". Otherwise, we call this reduction "scalar" or "small".
Xteam reductions differ from regular loops in that they have two phases:
the intra-team reduction and the inter-team reduction. The cost of the
latter increases with the number of blocks and the ReductionDataSize.
For small reductions, aim for 16 waves/CU. For large reductions, aim for
1 block/CU.
For Generic and Generic-SPMD loops, we only use this heuristic for large
reductions and use the regular gris size heuristic otherwise since there
is currently no data for these situations.

This is an upstream port of the corresponding downstream. Measurements
have been made on MI210, MI300A, MI300X, MI350X, and MI450.

Claude assisted with this patch.

GitOrigin-RevId: 9c3e5f162635e8827ae276e5ab0c18235f158158
1 file changed