Skip to content

[mlir][tosa] Finalize profile-based validation for TOSA v1.0 #131208

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
Mar 19, 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
232 changes: 131 additions & 101 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def Tosa_LogicalAndOp : Tosa_ElementwiseOp<"logical_and", [
);

list<Availability> availability = [
Profile<[Tosa_PRO_INT]>,
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
Extension<[]>,
];
}
Expand All @@ -828,7 +828,7 @@ def Tosa_LogicalLeftShiftOp : Tosa_ElementwiseOp<"logical_left_shift",
);

list<Availability> availability = [
Profile<[Tosa_PRO_INT]>,
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
Extension<[]>,
];
}
Expand Down Expand Up @@ -856,7 +856,7 @@ def Tosa_LogicalRightShiftOp : Tosa_ElementwiseOp<"logical_right_shift",
);

list<Availability> availability = [
Profile<[Tosa_PRO_INT]>,
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
Extension<[]>,
];
}
Expand Down Expand Up @@ -884,7 +884,7 @@ def Tosa_LogicalOrOp : Tosa_ElementwiseOp<"logical_or", [
);

list<Availability> availability = [
Profile<[Tosa_PRO_INT]>,
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
Extension<[]>,
];
}
Expand Down Expand Up @@ -912,7 +912,7 @@ def Tosa_LogicalXorOp : Tosa_ElementwiseOp<"logical_xor", [
);

list<Availability> availability = [
Profile<[Tosa_PRO_INT]>,
Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
Extension<[]>,
];
}
Expand Down Expand Up @@ -1108,7 +1108,7 @@ def Tosa_TableOp : Tosa_InferShapedTypeOp<"table"> {

list<Availability> availability = [
Profile<[Tosa_PRO_INT]>,
Extension<[Tosa_EXT_BF16]>,
Extension<[Tosa_EXT_INT16]>,
];

let assemblyFormat = [{
Expand Down
14 changes: 7 additions & 7 deletions mlir/include/mlir/Dialect/Tosa/IR/TosaProfileCompliance.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ typedef struct {
} TypeInfo;

enum CheckCondition {
invalid,
// Valid when any of the profile (extension) requirement is meet.
anyOf,
// Valid when all of the profile (extension) requirement are meet.
allOf,
invalid
allOf
};

template <typename T>
Expand Down Expand Up @@ -76,20 +76,20 @@ class ProfileInfoDepot {

LogicalResult populatationDispatch(Operation *op);

void populateProfileInfo(ValueRange operands, Value output);
LogicalResult populateProfileInfo(ValueRange operands, Value output);

// Base
template <typename T>
void populateProfileInfo(T op) {
LogicalResult populateProfileInfo(T op) {
op->emitOpError() << "profile requirement for this op has not been defined";
}
// For conv2d, conv3d, transpose_conv2d, and depthwise_conv2d.
template <typename T>
void populateProfileInfoConv(T op);
LogicalResult populateProfileInfoConv(T op);

// For pad, reshape, slice, tile, and transpose.
// For reshape, slice, tile, and transpose.
template <typename T>
void populateProfileInfoDataLayout(T op);
LogicalResult populateProfileInfoDataLayout(T op);

private:
SmallVector<TypeInfo> tyInfo;
Expand Down
Loading