Skip to content

Instantly share code, notes, and snippets.

@jpienaar
Last active November 10, 2021 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpienaar/7ffd2e9b0737134ba2ea2729b91c9572 to your computer and use it in GitHub Desktop.
Save jpienaar/7ffd2e9b0737134ba2ea2729b91c9572 to your computer and use it in GitHub Desktop.
Before vs after change using lambda
static ::mlir::LogicalResult generated(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueGroupStartIndex) {
if (!(((type.isa<::mlir::TensorType>())) && ([](Type elementType) {
return (((elementType.isBF16())) ||
((elementType.isa<mlir::TF::Bfloat16RefType>()))) ||
((((elementType.isa<::mlir::ComplexType>())) &&
((elementType.cast<::mlir::ComplexType>()
.getElementType()
.isF64()))) ||
((elementType.isa<mlir::TF::Complex128RefType>()))) ||
((((elementType.isa<::mlir::ComplexType>())) &&
((elementType.cast<::mlir::ComplexType>()
.getElementType()
.isF32()))) ||
((elementType.isa<mlir::TF::Complex64RefType>()))) ||
(((elementType.isF16())) ||
((elementType.isa<mlir::TF::HalfRefType>()))) ||
(((elementType.isF32())) ||
((elementType.isa<mlir::TF::FloatRefType>()))) ||
(((elementType.isF64())) ||
((elementType.isa<mlir::TF::DoubleRefType>()))) ||
(((elementType.isSignlessInteger(16))) ||
((elementType.isa<mlir::TF::Int16RefType>()))) ||
(((elementType.isSignlessInteger(32))) ||
((elementType.isa<mlir::TF::Int32RefType>()))) ||
(((elementType.isSignlessInteger(64))) ||
((elementType.isa<mlir::TF::Int64RefType>()))) ||
(((elementType.isSignlessInteger(8))) ||
((elementType.isa<mlir::TF::Int8RefType>())));
}(type.cast<::mlir::ShapedType>().getElementType())))) {
return op->emitOpError(valueKind) << "...";
}
return ::mlir::success();
}
static::mlir::LogicalResult generated(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueGroupStartIndex) {
if (!(((type.isa<::mlir::TensorType>())) &&
((((type.cast<::mlir::ShapedType>().getElementType().isBF16())) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Bfloat16RefType>()))) ||
((((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<::mlir::ComplexType>())) &&
((type.cast<::mlir::ShapedType>()
.getElementType()
.cast<::mlir::ComplexType>()
.getElementType()
.isF64()))) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Complex128RefType>()))) ||
((((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<::mlir::ComplexType>())) &&
((type.cast<::mlir::ShapedType>()
.getElementType()
.cast<::mlir::ComplexType>()
.getElementType()
.isF32()))) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Complex64RefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isF16())) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::HalfRefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isF32())) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::FloatRefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isF64())) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::DoubleRefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isSignlessInteger(
16))) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Int16RefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isSignlessInteger(
32))) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Int32RefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isSignlessInteger(
64))) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Int64RefType>()))) ||
(((type.cast<::mlir::ShapedType>().getElementType().isSignlessInteger(
8))) ||
((type.cast<::mlir::ShapedType>()
.getElementType()
.isa<mlir::TF::Int8RefType>())))))) {
return op->emitOpError(valueKind) << "...";
}
return ::mlir::success();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment