mbs-octoml commented on a change in pull request #9313:
URL: https://github.com/apache/tvm/pull/9313#discussion_r737850721



##########
File path: src/target/compilation_config.cc
##########
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file tvm/target/compilation_config.cc
+ * \brief Implementation of \p CompilationConfig for collecting \p Targets.
+ */
+
+#include <tvm/runtime/device_api.h>
+#include <tvm/target/compilation_config.h>
+
+namespace tvm {
+
+TVM_REGISTER_NODE_TYPE(CompilationConfigNode);
+
+void CompilationConfigNode::VisitAttrs(AttrVisitor* v) {
+  v->Visit("legacy_target_map", &legacy_target_map);
+  v->Visit("host_target", &host_target);
+  v->Visit("primitive_targets", &primitive_targets);
+  v->Visit("default_primitive_se_scope", &default_primitive_se_scope);
+  v->Visit("host_se_scope", &host_se_scope);
+  v->Visit("optional_homogenous_target", &optional_homogeneous_target);
+  // NOTE: The se_scope_cache_ is not accessible via FFI.
+}
+
+SEScope CompilationConfigNode::CanonicalSEScope(const SEScope& se_scope) const 
{
+  if (se_scope->target().defined()) {
+    return se_scope_cache_.Unique(se_scope);
+  }
+  DLDeviceType device_type = se_scope->device_type();
+  // TODO(mbs): Proper diagnostics.
+  CHECK(device_type != kInvalidDeviceType)

Review comment:
       (For fallback to kDLCPU comment: Chris had the same concern and to be 
honest I'd be happy if all of these weird second-guessing rules were retired 
outright. I'll leave it for now to minimize breakage.)
   
   (For this comment) done, thx.




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