@@ -46,16 +46,6 @@ namespace xegpu {
4646using namespace mlir ;
4747using namespace mlir ::dataflow;
4848
49- // / HW dependent constants.
50- // / TODO: These constants should be queried from the target information.
51- constexpr unsigned subgroupSize = 16 ; // How many lanes in a subgroup.
52- // / If DPAS A or B operands have low precision element types they must be packed
53- // / according to the following sizes.
54- constexpr unsigned packedSizeInBitsForDefault =
55- 16 ; // Minimum packing size per register for DPAS A.
56- constexpr unsigned packedSizeInBitsForDpasB =
57- 32 ; // Minimum packing size per register for DPAS B.
58-
5949namespace {
6050
6151// ===----------------------------------------------------------------------===//
@@ -198,8 +188,10 @@ struct LayoutInfoLattice : public Lattice<LayoutInfo> {
198188static LayoutInfo getDefaultLayoutInfo (unsigned rank) {
199189 assert ((rank == 1 || rank == 2 ) && " Expected 1D or 2D vector." );
200190 if (rank == 1 )
201- return LayoutInfo (LaneLayout ({subgroupSize}), LaneData ({1 }));
202- return LayoutInfo (LaneLayout ({1 , subgroupSize}), LaneData ({1 , 1 }));
191+ return LayoutInfo (LaneLayout ({xegpu::targetinfo::subgroupSize}),
192+ LaneData ({1 }));
193+ return LayoutInfo (LaneLayout ({1 , xegpu::targetinfo::subgroupSize}),
194+ LaneData ({1 , 1 }));
203195}
204196
205197// / Helper to get the default layout for a vector type.
@@ -216,9 +208,9 @@ static LayoutInfo getDefaultLayoutInfo(VectorType vectorTy) {
216208 // Packing factor is determined by the element type bitwidth.
217209 int packingFactor = 1 ;
218210 unsigned bitwidth = vectorTy.getElementType ().getIntOrFloatBitWidth ();
219- if (bitwidth < packedSizeInBitsForDefault)
220- packingFactor = packedSizeInBitsForDefault / bitwidth;
221- return LayoutInfo (LaneLayout ({1 , subgroupSize}),
211+ if (bitwidth < xegpu::targetinfo:: packedSizeInBitsForDefault)
212+ packingFactor = xegpu::targetinfo:: packedSizeInBitsForDefault / bitwidth;
213+ return LayoutInfo (LaneLayout ({1 , xegpu::targetinfo:: subgroupSize}),
222214 LaneData ({1 , packingFactor}));
223215}
224216
@@ -233,13 +225,14 @@ static LayoutInfo getLayoutInfoForDPASOperand(VectorType vectorTy,
233225 Type elementTy = vectorTy.getElementType ();
234226 assert (elementTy.isIntOrFloat () &&
235227 " Expected int or float type in DPAS operands" );
236- LaneLayout layout ({1 , subgroupSize});
228+ LaneLayout layout ({1 , xegpu::targetinfo:: subgroupSize});
237229 // For B operand, data must be packed in minimum `packedDpasBSizeInBits` and
238230 // must have the VNNI format.
239- if (operandNum == 1 &&
240- elementTy.getIntOrFloatBitWidth () < packedSizeInBitsForDpasB) {
241- LaneData data (
242- {packedSizeInBitsForDpasB / elementTy.getIntOrFloatBitWidth (), 1 });
231+ if (operandNum == 1 && elementTy.getIntOrFloatBitWidth () <
232+ xegpu::targetinfo::packedSizeInBitsForDpasB) {
233+ LaneData data ({xegpu::targetinfo::packedSizeInBitsForDpasB /
234+ elementTy.getIntOrFloatBitWidth (),
235+ 1 });
243236 return LayoutInfo (layout, data);
244237 }
245238 // Otherwise, return the default layout for the vector type.
@@ -577,7 +570,7 @@ void LayoutInfoPropagation::visitStoreScatterOp(
577570 ArrayRef<int64_t > tdescShape = storeScatter.getTensorDescType ().getShape ();
578571 if (tdescShape.size () > 1 )
579572 assert (
580- tdescShape[0 ] == subgroupSize &&
573+ tdescShape[0 ] == xegpu::targetinfo:: subgroupSize &&
581574 " Expected the first dimension of 2D tensor descriptor to be equal to "
582575 " subgroup size." );
583576
0 commit comments