@@ -58,6 +58,14 @@ namespace {
5858// ===----------------------------------------------------------------------===//
5959// SIMT Distribution Patterns
6060// ===----------------------------------------------------------------------===//
61+
62+ // / In certain cases, we may need to favor XeGPU specific distribution patterns
63+ // / over generic vector distribution patterns. In such cases, we can assign
64+ // / priorities to patterns.
65+ enum class PatternPriority : int { Regular = 1 , High = 2 };
66+
67+ // / Helper function to compute the effective lane layout from a
68+ // / DistributeLayoutAttr which can be either a LayoutAttr or a SliceAttr.
6169static SmallVector<int64_t >
6270computeEffectiveLaneLayout (const xegpu::DistributeLayoutAttr layout) {
6371 SmallVector<int64_t > effectiveLaneLayout;
@@ -1034,6 +1042,8 @@ struct VectorMultiReductionDistribution : public gpu::WarpDistributionPattern {
10341042 }
10351043};
10361044
1045+ // / Distribute a `vector.shape_cast` op feeding into yield op of an enclosing
1046+ // / `gpu.warp_execute_on_lane_0` region.
10371047struct VectorShapeCastDistribution : public gpu ::WarpDistributionPattern {
10381048 using gpu::WarpDistributionPattern::WarpDistributionPattern;
10391049 LogicalResult matchAndRewrite (gpu::WarpExecuteOnLane0Op warpOp,
@@ -1098,7 +1108,7 @@ void xegpu::populateXeGPUSubgroupDistributePatterns(
10981108 GpuBarrierDistribution, VectorMultiReductionDistribution>(
10991109 patterns.getContext ());
11001110 patterns.add <VectorShapeCastDistribution>(patterns.getContext (),
1101- /* benefit=*/ 2 );
1111+ /* benefit=*/ PatternPriority::High );
11021112}
11031113
11041114void XeGPUSubgroupDistributePass::runOnOperation () {
0 commit comments