Skip to content

Commit df900e4

Browse files
quintinwang5whitneywhtsang
authored andcommitted
[WA] Fix test_reduce_layouts errors
1 parent 63807b5 commit df900e4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

third_party/intel/lib/TritonIntelGPUToLLVM/ConvertLayoutOpToLLVM.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,18 @@ struct ConvertLayoutOpUsingLinearLayoutsConversion
584584
StringAttr kBlock = str_attr("block");
585585
LinearLayout comp = dstLayout.invertAndCompose(srcLayout);
586586
LinearLayout conversion = *comp.quotient(kBlock)->quotient(kWarp);
587-
int32_t subGroupSize = conversion.getOutDimSize(kLane);
588587

589588
Location loc = op.getLoc();
589+
// FIXME: This workaround addresses the incorrect sgsize and SLM offset in
590+
// ReduceOp and ConvertLayoutOp, which prevents a segmentation fault.
591+
// However, this is a temporary solution. Once the OutDimSize computation
592+
// issue in LinearLayout is resolved, this workaround should be removed.
593+
int32_t subGroupSize = std::min((int32_t)op.getType().getNumElements(),
594+
conversion.getOutDimSize(kLane));
595+
if (!op->hasAttr("allocation.offset")) {
596+
op->setAttr("allocation.offset",
597+
rewriter.getIntegerAttr(rewriter.getI32Type(), 0));
598+
}
590599

591600
SmallVector<Value> inVals =
592601
unpackLLElements(loc, adaptor.getSrc(), rewriter);

0 commit comments

Comments
 (0)