junrushao1994 commented on a change in pull request #7847:
URL: https://github.com/apache/tvm/pull/7847#discussion_r612927235



##########
File path: src/tir/schedule/schedule.cc
##########
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+#include <tvm/tir/schedule/schedule.h>
+
+namespace tvm {
+namespace tir {
+
+/**************** Constructor ****************/
+
+BlockRV::BlockRV() { this->data_ = make_object<BlockRVNode>(); }
+
+LoopRV::LoopRV() { this->data_ = make_object<LoopRVNode>(); }
+
+/**************** GetSRef ****************/
+
+StmtSRef ScheduleNode::GetSRef(const StmtNode* stmt) const {
+  ScheduleState state = this->state();
+  auto it = state->stmt2ref.find(stmt);
+  if (it == state->stmt2ref.end()) {
+    LOG(FATAL) << "IndexError: The stmt doesn't exist in the IR";
+  }
+  return it->second;
+}
+
+/**************** FFI ****************/
+
+TVM_REGISTER_NODE_TYPE(BlockRVNode);
+TVM_REGISTER_NODE_TYPE(LoopRVNode);
+TVM_REGISTER_OBJECT_TYPE(ScheduleNode);
+
+TVM_REGISTER_GLOBAL("tir.schedule.ScheduleModule")  //
+    .set_body_method<Schedule>(&ScheduleNode::mod);
+TVM_REGISTER_GLOBAL("tir.schedule.ScheduleGetState")  //
+    .set_body_method<Schedule>(&ScheduleNode::state);
+TVM_REGISTER_GLOBAL("tir.schedule.ScheduleSeed")  //
+    .set_body_method<Schedule>(&ScheduleNode::Seed);
+TVM_REGISTER_GLOBAL("tir.schedule.ScheduleCopy")  //
+    .set_body_method<Schedule>(&ScheduleNode::Copy);

Review comment:
       Hmmmm actually it is not that bad here. Without the slashes, the 
formatter will concat the two lines together on some of the lines depending how 
long it will be, which is a bit ugly.




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


Reply via email to