junrushao1994 commented on a change in pull request #6369:
URL: https://github.com/apache/incubator-tvm/pull/6369#discussion_r485284869
##########
File path: src/target/target_kind.cc
##########
@@ -52,178 +57,238 @@ const AttrRegistryMapContainerMap<TargetKind>&
TargetKind::GetAttrMapContainer(
return TargetKindRegistry::Global()->GetAttrMap(attr_name);
}
-const TargetKind& TargetKind::Get(const String& target_kind_name) {
+Optional<TargetKind> TargetKind::Get(const String& target_kind_name) {
const TargetKindRegEntry* reg =
TargetKindRegistry::Global()->Get(target_kind_name);
- CHECK(reg != nullptr) << "ValueError: TargetKind \"" << target_kind_name
- << "\" is not registered";
+ if (reg == nullptr) {
+ return NullOpt;
+ }
return reg->kind_;
}
-// TODO(@junrushao1994): remove some redundant attributes
+/********** Utility functions **********/
Review comment:
I agree that it is good to have a separate file for shared utility, but
for now, there is not shared party yet. Let's do it in the future once there
are more to share.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]