Skip to content

[mlir][tosa] Remove profile compliance of cond_if and while_loop #148212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,6 @@ extensionComplianceMap = {
{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
{{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
{{Extension::bf16}, {{bf16T, bf16T}}}}},
{"tosa.cond_if", {{{Extension::controlflow}, {{boolT}}}}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the impact of having these here ?
Is it just redundancy ?

For each Op, do we have a clear boundary on what the verifier checks vs Profile check ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes just redundancy since they are enforced at a higher level (on construction or during the verifier). I've removed them since the script that generates this list (part of the specification) no longer generates these entries, helping to make future updates to this list easier.

Yes - verifier checks should be used where an operator semantically doesn't make sense, while profile checks are used to check for alignment with the spec. Since the profile check list is auto-generated, I think it's possible there is some redundancy, which is okay IMO.

{"tosa.while_loop", {{{Extension::controlflow}, {{boolT}}}}},
{"tosa.variable", {{{Extension::variable}, {{i8T}, {fp16T}, {fp32T}}}}},
{"tosa.variable_write",
{{{Extension::variable}, {{i8T}, {fp16T}, {fp32T}}}}},
Expand Down
18 changes: 2 additions & 16 deletions mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,6 @@ LogicalResult ProfileInfoDepot::populateProfileInfo(tosa::VariableWriteOp op) {
return success();
}

template <>
LogicalResult ProfileInfoDepot::populateProfileInfo(tosa::IfOp op) {
addValue(op.getCondition());
return success();
}

template <>
LogicalResult ProfileInfoDepot::populateProfileInfo(tosa::WhileOp op) {
Block *block = &op.getCondGraph().front();
Operation *terminator = block->getTerminator();
addValue(terminator->getOperands().front());
return success();
}

LogicalResult ProfileInfoDepot::populatationDispatch(Operation *op) {
// This helper function only populates the info for the customised operands.
#define POPULATE_PROFILE_INFO_CUSTOM(tosaOp) \
Expand Down Expand Up @@ -280,8 +266,6 @@ LogicalResult ProfileInfoDepot::populatationDispatch(Operation *op) {
POPULATE_PROFILE_INFO_CUSTOM(MatMul)
POPULATE_PROFILE_INFO_CUSTOM(Variable)
POPULATE_PROFILE_INFO_CUSTOM(VariableWrite)
POPULATE_PROFILE_INFO_CUSTOM(If)
POPULATE_PROFILE_INFO_CUSTOM(While)

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

return failure();
}
Expand Down
Loading