Skip to content

Commit d7f6660

Browse files
authored
[mlir][tosa] Remove profile compliance of cond_if and while_loop (#148212)
The requirement for a boolean condition is already checked for both operators elsewhere. `cond_if` requires a boolean condition at construction. `while_loop` cond_graph is checked in the verifier for a scalar boolean output type.
1 parent 7c69c3b commit d7f6660

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,6 @@ extensionComplianceMap = {
433433
{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
434434
{{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
435435
{{Extension::bf16}, {{bf16T, bf16T}}}}},
436-
{"tosa.cond_if", {{{Extension::controlflow}, {{boolT}}}}},
437-
{"tosa.while_loop", {{{Extension::controlflow}, {{boolT}}}}},
438436
{"tosa.variable", {{{Extension::variable}, {{i8T}, {fp16T}, {fp32T}}}}},
439437
{"tosa.variable_write",
440438
{{{Extension::variable}, {{i8T}, {fp16T}, {fp32T}}}}},

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

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,6 @@ LogicalResult ProfileInfoDepot::populateProfileInfo(tosa::VariableWriteOp op) {
225225
return success();
226226
}
227227

228-
template <>
229-
LogicalResult ProfileInfoDepot::populateProfileInfo(tosa::IfOp op) {
230-
addValue(op.getCondition());
231-
return success();
232-
}
233-
234-
template <>
235-
LogicalResult ProfileInfoDepot::populateProfileInfo(tosa::WhileOp op) {
236-
Block *block = &op.getCondGraph().front();
237-
Operation *terminator = block->getTerminator();
238-
addValue(terminator->getOperands().front());
239-
return success();
240-
}
241-
242228
LogicalResult ProfileInfoDepot::populatationDispatch(Operation *op) {
243229
// This helper function only populates the info for the customised operands.
244230
#define POPULATE_PROFILE_INFO_CUSTOM(tosaOp) \
@@ -280,8 +266,6 @@ LogicalResult ProfileInfoDepot::populatationDispatch(Operation *op) {
280266
POPULATE_PROFILE_INFO_CUSTOM(MatMul)
281267
POPULATE_PROFILE_INFO_CUSTOM(Variable)
282268
POPULATE_PROFILE_INFO_CUSTOM(VariableWrite)
283-
POPULATE_PROFILE_INFO_CUSTOM(If)
284-
POPULATE_PROFILE_INFO_CUSTOM(While)
285269

286270
// For the most of tosa operators, all operands are profile/extension related
287271
// and hence are all considered in this profile-based compilance check.
@@ -340,6 +324,8 @@ LogicalResult ProfileInfoDepot::populatationDispatch(Operation *op) {
340324
// constraint for those operations.
341325
POPULATE_PROFILE_INFO_SKIP(ConstShape)
342326
POPULATE_PROFILE_INFO_SKIP(Yield)
327+
POPULATE_PROFILE_INFO_SKIP(If)
328+
POPULATE_PROFILE_INFO_SKIP(While)
343329

344330
return failure();
345331
}

0 commit comments

Comments
 (0)