You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/11/03 17:46:07 UTC

[GitHub] [tvm] zxybazh commented on a change in pull request #9313: Adds SEScope (Storage/Execution Scope) for use as new unit of planning in 'device' planning.

zxybazh commented on a change in pull request #9313:
URL: https://github.com/apache/tvm/pull/9313#discussion_r742191139



##########
File path: src/target/se_scope.cc
##########
@@ -0,0 +1,224 @@
+/*
+ * 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/se_scope.cc
+ * \brief Implementation of \p SEScope for representing a Storage or Execution scope.
+ */
+#include <tvm/node/reflection.h>
+#include <tvm/runtime/device_api.h>
+#include <tvm/target/se_scope.h>
+
+namespace tvm {
+
+TVM_REGISTER_NODE_TYPE(SEScopeNode);
+
+void SEScopeNode::VisitAttrs(AttrVisitor* v) {
+  v->Visit("device_type_int", &device_type_int);
+  v->Visit("virtual_device_id", &virtual_device_id);
+  v->Visit("target", &target);
+  v->Visit("memory_scope", &memory_scope);
+}
+
+bool SEScopeNode::SEqualReduce(const SEScopeNode* other, SEqualReducer equal) const {
+  return device_type_int == other->device_type_int &&
+         virtual_device_id == other->virtual_device_id &&
+         // NOTE: Comparing targets by their str representations
+         target->str() == other->target->str() && memory_scope == other->memory_scope;

Review comment:
       Sorry for late in this discussion, as TQ pointed out `str` is a legacy property which is expected to be replaced by `export`. And thanks for implementing structural hash and equality!




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org