Emit warning for op not modeled in dialect.
Unmodeled ops are treated very conservatively. Until the dialect fallback hook for querying effects is completed, these will all be marked as having side-effects. Warn for unmodeled op types. PiperOrigin-RevId: 349589705 Change-Id: If3b4621050c5e53f773f8a518caf2c32ddbc7328
This commit is contained in:
parent
b2a7c3d9da
commit
89310df4bc
@ -440,6 +440,9 @@ class ImporterBase {
|
||||
protected:
|
||||
// Maps feed as TensorId to new Placeholder node name.
|
||||
absl::flat_hash_map<TensorId, absl::string_view> remapped_feeds_;
|
||||
|
||||
// All the TF ops encountered that aren't modelled in dialect.
|
||||
llvm::DenseSet<mlir::Identifier> unmodelled_op_types_;
|
||||
};
|
||||
|
||||
// Returns true if the node with given name has a non primary output that is
|
||||
@ -1784,6 +1787,19 @@ mlir::Operation* ImporterBase::CreateOperation(
|
||||
}
|
||||
}
|
||||
|
||||
mlir::OperationName name = inner_op->getName();
|
||||
if (!name.getAbstractOperation() &&
|
||||
// Skip unmodelled ops that are handled differently.
|
||||
(node_type_name != "_Arg" && node_type_name != "_Retval")) {
|
||||
if (unmodelled_op_types_.insert(name.getIdentifier()).second) {
|
||||
LOG(WARNING) << "Unmodelled op type `" << node.type_string() << "`"
|
||||
<< (node.op_def().is_stateful()
|
||||
? " is stateful but effects not modelled"
|
||||
: " is not stateful but will be treated as such "
|
||||
"conservatively");
|
||||
}
|
||||
}
|
||||
|
||||
// Add the terminator for the island
|
||||
island_builder.create<mlir::tf_executor::YieldOp>(result.location,
|
||||
inner_op->getResults());
|
||||
|
Loading…
Reference in New Issue
Block a user