Skip to content

Commit f4c48a9

Browse files
authored
[BACKEND] Emit an error when the tensor shape is smaller than the shared memory tile size for shared encoding with leadingOffset=True. (triton-lang#4731)
1 parent a26848c commit f4c48a9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/Dialect/TritonGPU/IR/LinearLayoutConversions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,13 @@ LinearLayout sharedToLinearLayoutLeadingOffset(ArrayRef<int64_t> shape,
419419
int tileRows = 8;
420420
int tileCols = 8 * tileWidthBytes / elemBitWidth;
421421

422+
if (shape[colDim] < tileCols || shape[rowDim] < tileRows) {
423+
llvm::errs() << "Illegal shared layout; expected shape to be at least ["
424+
<< tileRows << ", " << tileCols << "], shape: ["
425+
<< shape[rowDim] << ", " << shape[colDim] << "]\n";
426+
llvm::report_fatal_error("Illegal shared layout");
427+
}
428+
422429
int vec = 8 * 16 / elemBitWidth;
423430
if (vec != shared.getVec()) {
424431
llvm::errs() << "Illegal shared layout; expected `vec` to be " << vec

0 commit comments

Comments
 (0)