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



##########
File path: src/target/se_scope.cc
##########
@@ -0,0 +1,226 @@
+/*
+ * 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) {
+  int i = static_cast<int>(device_type_);
+  v->Visit("device_type", &i);

Review comment:
       This will cause problems in serializers, since serializer relies on the 
address on the field to be able to set them(during loading json), in this case 
it will "set" into stack local variables. Consider make device_type an int for 
now, or add overloaded helper fn to AttrVisitor, that cast the DeviceType ptr 
to int ptr.

##########
File path: src/target/se_scope.cc
##########
@@ -0,0 +1,226 @@
+/*
+ * 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) {
+  int i = static_cast<int>(device_type_);
+  v->Visit("device_type", &i);

Review comment:
       Unfortunately this will cause problems in serializers, since serializer 
relies on the address on the field to be able to set them(during loading json), 
in this case it will "set" into stack local variables. Consider make 
device_type an int for now, or add overloaded helper fn to AttrVisitor, that 
cast the DeviceType ptr to int ptr.




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