Skip to content

Commit fbf7878

Browse files
authored
[mlir][tosa] Fix level check on unranked input tensor (#140795)
This commit fixes a segfault that occurred on operators with unranked input tensors. Operator specific level checks performed before the rank check incorrectly assumed all inputs were shaped.
1 parent 4e9c3ce commit fbf7878

File tree

2 files changed

+91
-83
lines changed

2 files changed

+91
-83
lines changed

mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,10 @@ LogicalResult TosaValidation::applyLevelCheck(Operation *op) {
758758
return success();
759759
}
760760

761+
// check rank and sizes early so later checks can assume shaped operands
762+
if (!levelCheckRanksAndSizes(op))
763+
return failure();
764+
761765
// additional level checks from spec 0.70
762766
if (!levelCheckPool<tosa::AvgPool2dOp>(op) ||
763767
!levelCheckConv<tosa::Conv2DOp>(op) ||
@@ -770,10 +774,6 @@ LogicalResult TosaValidation::applyLevelCheck(Operation *op) {
770774
return failure();
771775
}
772776

773-
if (!levelCheckRanksAndSizes(op)) {
774-
return failure();
775-
}
776-
777777
// level check MAX_TENSOR_LIST_SIZE
778778
if (!levelCheckListSize(op)) {
779779
return failure();

0 commit comments

Comments
 (0)