@@ -65,20 +65,18 @@ struct TransferReadToArmSMELowering
65
65
return rewriter.notifyMatchFailure (transferReadOp,
66
66
" not inbounds transfer read" );
67
67
68
- arm_sme::TileSliceLayout layout;
69
-
70
- AffineExpr d0, d1;
71
- bindDims (transferReadOp.getContext (), d0, d1);
72
68
AffineMap map = transferReadOp.getPermutationMap ();
73
- if (map.isIdentity ())
74
- layout = arm_sme::TileSliceLayout::Horizontal;
75
- else if (map == AffineMap::get (map.getNumDims (), 0 , {d1, d0},
76
- transferReadOp.getContext ()))
77
- layout = arm_sme::TileSliceLayout::Vertical;
78
- else
69
+ if (!map.isPermutation ())
79
70
return rewriter.notifyMatchFailure (transferReadOp,
80
71
" unsupported permutation map" );
81
72
73
+ // Note: For 2D vector types the only non-identity permutation is a simple
74
+ // transpose [1, 0].
75
+ bool transposed = !map.isIdentity ();
76
+ arm_sme::TileSliceLayout layout =
77
+ transposed ? arm_sme::TileSliceLayout::Vertical
78
+ : arm_sme::TileSliceLayout::Horizontal;
79
+
82
80
// Padding isn't optional for transfer_read, but is only used in the case
83
81
// of out-of-bounds accesses (not supported here) and/or masking. Mask is
84
82
// optional, if it's not present don't pass padding.
@@ -137,19 +135,17 @@ struct TransferWriteToArmSMELowering
137
135
return rewriter.notifyMatchFailure (writeOp,
138
136
" not inbounds transfer write" );
139
137
140
- AffineExpr d0, d1;
141
- bindDims (writeOp.getContext (), d0, d1);
142
138
AffineMap map = writeOp.getPermutationMap ();
143
- bool isTranspose = (map == AffineMap::get (map.getNumDims (), 0 , {d1, d0},
144
- writeOp.getContext ()));
145
-
146
- if (!map.isIdentity () && !isTranspose)
139
+ if (!map.isPermutation ())
147
140
return rewriter.notifyMatchFailure (writeOp,
148
141
" unsupported permutation map" );
149
142
143
+ // Note: For 2D vector types the only non-identity permutation is a simple
144
+ // transpose [1, 0].
145
+ bool transposed = !map.isIdentity ();
150
146
arm_sme::TileSliceLayout layout =
151
- isTranspose ? arm_sme::TileSliceLayout::Vertical
152
- : arm_sme::TileSliceLayout::Horizontal;
147
+ transposed ? arm_sme::TileSliceLayout::Vertical
148
+ : arm_sme::TileSliceLayout::Horizontal;
153
149
154
150
rewriter.replaceOpWithNewOp <arm_sme::TileStoreOp>(
155
151
writeOp, writeOp.getVector (), writeOp.getSource (), writeOp.getIndices (),
0 commit comments