For fused pointwise & reduction kernels the pointwise operations need to be rank expanded to match [pointwise_numel, reduction_numel]. For block descriptor based load / store, currently this only applies if the number of dimensions matches the number of range trees minus the reduction trees. However this fails when there is discontiguity in the load / store.
For example:
range_trees = {x: ..., r0: ...}
block descriptor shape = [XBLOCK // 2, XBLOCK % 2]
num_reduction_dims = 1
so here the number of block descriptor dimensions won't be equal to (len(range_trees) - num_reduction_dims) (2 range trees, 1 reduction dim). and the determined final shape for this example will be [XBLOCK], instead of [XBLOCK, 1] (with the added reduction dim). This PR makes the check more robust by accounting for discontiguity.
Added a unit test for this fix. based on a compilation failure from GPT2 and Stable Diffusion XL torch compile run.
Pull Request resolved: #182936
Approved by: https://github.com/jansel
SOCIAL SHARE CARD GENERATOR