kparzysz-quic commented on code in PR #12119:
URL: https://github.com/apache/tvm/pull/12119#discussion_r923553444


##########
src/target/target.cc:
##########
@@ -716,17 +716,27 @@ ObjectPtr<Object> TargetInternal::FromRawString(const 
String& target_str) {
   return TargetInternal::FromConfig(config);
 }
 
-ObjectPtr<Object> TargetInternal::FromConfig(std::unordered_map<String, 
ObjectRef> config) {
+ObjectPtr<Object> TargetInternal::FromConfig(Map<String, ObjectRef> config) {
   const String kKind = "kind";
   const String kTag = "tag";
   const String kKeys = "keys";
   const String kDeviceName = "device";
   const String kHost = "host";
   ObjectPtr<TargetNode> target = make_object<TargetNode>();
+
   // parse 'kind'
   if (config.count(kKind)) {
     if (const auto* kind = config[kKind].as<StringObj>()) {
       target->kind = GetTargetKind(GetRef<String>(kind));
+      ICHECK(!(target->kind->preprocessor != nullptr && 
target->kind->target_parser != nullptr))
+          << "Cannot use both set_attrs_preprocessor and set_target_parser";
+
+      // Run JSON Parser over JSON input
+      if (target->kind->target_parser != nullptr) {
+        VLOG(9) << "TargetInternal::FromConfig - Running target_parser";
+        config = target->kind->target_parser(config);
+      }

Review Comment:
   Could this be executed at the end, so that the parser "has the last word" on 
what the returned target will look like?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to