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 2022/08/10 20:39:52 UTC
[GitHub] [tvm] yelite opened a new pull request, #12366: [TVMScript] Printer Frame
yelite opened a new pull request, #12366:
URL: https://github.com/apache/tvm/pull/12366
This PR:
- Implement Frame for the TVMScript Unified Printer
Compared to the prototype version, this:
- Removes the dependency of VarTable (SymbolTable) from Frame
- Adds a callback array to the Frame base class so that VarTable can add callback to clean variable when Frame goes out scope
Tracking issue: https://github.com/apache/tvm/issues/11912
cc @junrushao1994 @gbonik
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #12366: [TVMScript] Printer Frame
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #12366:
URL: https://github.com/apache/tvm/pull/12366#discussion_r943916987
##########
src/script/printer/frame.cc:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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/runtime/registry.h>
+#include <tvm/script/printer/frame.h>
+
+namespace tvm {
+namespace script {
+namespace printer {
+
+MetadataFrame::MetadataFrame() : MetadataFrame(make_object<MetadataFrameNode>()) {}
+
+VarDefFrame::VarDefFrame() : VarDefFrame(make_object<VarDefFrameNode>()) {}
+
+TVM_REGISTER_NODE_TYPE(FrameNode);
+TVM_REGISTER_GLOBAL("script.printer.FrameAddExitCallback")
+ .set_body_typed([](Frame frame, runtime::TypedPackedFunc<void()> callback) {
+ frame->AddExitCallback(callback);
+ });
+TVM_REGISTER_GLOBAL("script.printer.FrameEnterWithScope").set_body_typed([](Frame frame) {
+ frame->EnterWithScope();
+});
Review Comment:
Let's use a more concise API here, example: https://github.com/apache/tvm/blob/ca30e5e/src/tir/schedule/schedule.cc#L265-L266
--
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
[GitHub] [tvm] junrushao1994 commented on pull request #12366: [TVMScript] Printer Frame
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on PR #12366:
URL: https://github.com/apache/tvm/pull/12366#issuecomment-1212466626
The PR looks pretty good! Let's address my nitpick and get the CI green
--
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
[GitHub] [tvm] junrushao1994 merged pull request #12366: [TVMScript] Printer Frame
Posted by GitBox <gi...@apache.org>.
junrushao1994 merged PR #12366:
URL: https://github.com/apache/tvm/pull/12366
--
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