Skip to content
Closed
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
5 changes: 5 additions & 0 deletions mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,11 @@ LogicalResult tosa::AvgPool2dOp::verify() {
if (inputETy.isF32() && !accType.isF32())
return emitOpError("accumulator type for f32 tensor is not f32");

if ((llvm::isa<Float8E5M2Type>(inputETy) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move the checks in the validation pass? Maybe we can leave the operator verifier a bit more relaxed ie just check that the accumulator is of fp type?
Thoughts?
Cc: @lhutton1 @FranklandJack

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 from me on this - it allows other users of TOSA to express operations that may be important for their workflow e.g. an fp8 avg_pool with an fp32 accumulator

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good, thanks for the review. i will then close this PR.

llvm::isa<Float8E4M3FNType>(inputETy)) &&
!accType.isF16())
return emitOpError("accumulator type for f8 tensor is not f16");

if (inputETy != inputZpETy)
return emitOpError("expect both input and its zero point are the same "
"element type, got ")
Expand Down