Skip to content

Commit f7e81ce

Browse files
committed
Mark subgroup 2d block loads as expenisve loads
1 parent 09fec1e commit f7e81ce

File tree

1 file changed

+16
-3
lines changed
  • third_party/intel/lib/TritonIntelGPUTransforms

1 file changed

+16
-3
lines changed

third_party/intel/lib/TritonIntelGPUTransforms/Utility.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,22 @@ bool isExpensiveLoadOrStore(Operation *op) {
120120
if (isSingleValue(base))
121121
return false;
122122

123-
// Loads that use a block pointer are expensive if they cannot be lowered to
124-
// 2D block read operations. Temporarily leverage the
125-
// "ttig.block_io" attribute to filter out inexpensive loads.
123+
if (auto loadOp = dyn_cast<LoadOp>(op)) {
124+
// Subgroup2DBlockEncodingAttr loads are expensive, but loads without this
125+
// encoding may still be expensive so we only return true if the encodng
126+
// exists
127+
if (auto tensorTy = dyn_cast<RankedTensorType>(loadOp.getType()))
128+
if (isa<Subgroup2DBlockEncodingAttr>(tensorTy.getEncoding()))
129+
return true;
130+
}
131+
132+
// The block ptr attribute identifies loads that are candidates for subgroup
133+
// 2d block io operations. Loads with these attributes (and without the new
134+
// subgroup 2d block encoding above) should have their layouts replaced with
135+
// the layout from the expensive op (usually a dot op with DPAS encoding). The
136+
// load result is convert to the expensive op layout during LLVM lowering.
137+
// Note: the long term plan is to replace this path with the above subgroup 2d
138+
// block encoding layout.
126139
Attribute blockIOAttr =
127140
op->getAttr(TritonIntelGPUDialect::getBlockIOAttrName());
128141
if (blockIOAttr)

0 commit comments

Comments
 (0)