Skip to content

Commit 2cdfa7d

Browse files
committed
[MLIR] Don't lower tensors that can't be represented by an ArrayType
1 parent 8dee997 commit 2cdfa7d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ static Type convertTensorType(const spirv::TargetEnv &targetEnv,
502502
<< type << " illegal: cannot handle zero-element tensors\n");
503503
return nullptr;
504504
}
505+
if (arrayElemCount > std::numeric_limits<unsigned>::max()) {
506+
LLVM_DEBUG(llvm::dbgs()
507+
<< type << " illegal: cannot fit tensor into target type\n");
508+
return nullptr;
509+
}
505510

506511
Type arrayElemType = convertScalarType(targetEnv, options, scalarType);
507512
if (!arrayElemType)

0 commit comments

Comments
 (0)