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/05/24 18:06:56 UTC

[GitHub] [tvm] junrushao1994 opened a new pull request #8121: [TensorIR] Structural Error Reporting

junrushao1994 opened a new pull request #8121:
URL: https://github.com/apache/tvm/pull/8121


   This PR is part of the TensorIR upstreaming effort (#7527), stage M2a.
   
   In this PR, we implemented ScheduleError, an error reporting mechanism for schedule primitives to report user-face error messages, with the functionality of rendering the TIR out in the TVM script syntax.
   
   This set of APIs allows future improvement of error location rendering, e.g. more colorful rendering mechanisms like synr does.


-- 
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:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638974236



##########
File path: src/tir/schedule/error.h
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef TVM_TIR_SCHEDULE_ERROR_H_
+#define TVM_TIR_SCHEDULE_ERROR_H_
+
+#include <tvm/tir/schedule/state.h>
+
+namespace tvm {
+namespace tir {
+
+/*! \brief Error that happens during TensorIR scheduling */
+class ScheduleError : public tvm::runtime::Error {
+ public:
+  /*! \brief Base constructor */
+  ScheduleError() : tvm::runtime::Error("") {}
+  /*! \brief The schedule primitive applied that causes the error */
+  virtual String primitive() const = 0;
+  /*! \brief The IRModule that is applied on */
+  virtual IRModule mod() const = 0;
+  /*! \brief The locations of interest that we want to point out */
+  virtual Array<ObjectRef> LocationsOfInterest() const = 0;
+  /*!
+   * \brief Returns an error string template for rendering, corresponds to the "detail" mode.
+   * \sa ScheduleErrorRenderLevel
+   * \note Format of the template:
+   * "Some normal error string and curly bracket-enclosed numbers like {0}, which indicates the
+   * 0-th element of the interested location."

Review comment:
       Thanks Tristan!




-- 
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:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638487123



##########
File path: src/tir/schedule/error.h
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef TVM_TIR_SCHEDULE_ERROR_H_
+#define TVM_TIR_SCHEDULE_ERROR_H_
+
+#include <tvm/tir/schedule/state.h>
+
+namespace tvm {
+namespace tir {
+
+/*! \brief Error that happens during TensorIR scheduling */
+class ScheduleError : public tvm::runtime::Error {
+ public:
+  /*! \brief Base constructor */
+  ScheduleError() : tvm::runtime::Error("") {}
+  /*! \brief The schedule primitive applied that causes the error */
+  virtual String primitive() const = 0;
+  /*! \brief The IRModule that is applied on */
+  virtual IRModule mod() const = 0;
+  /*! \brief The locations of interest that we want to point out */
+  virtual Array<ObjectRef> LocationsOfInterest() const = 0;
+  /*!
+   * \brief Returns an error string template for rendering, corresponds to the "detail" mode.
+   * \sa ScheduleErrorRenderLevel
+   * \note Format of the template:
+   * "Some normal error string and curly bracket-enclosed numbers like {0}, which indicates the
+   * 0-th element of the interested location."

Review comment:
       Hmmm would you like to help me rephrase? The template is a string like:
   
   > "Some error occurred on block {0} and loop {1} blablabla"
   
   And renderer will replace {0} and {1} according to the list provided `LocationsOfInterest`. Right now it only printed out all the locations in plain text, but in the future, we may want to mark the IR with underscores and attach names to each location of interest, like what synr does.
   
   




-- 
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:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638490710



##########
File path: python/tvm/tir/schedule/schedule.py
##########
@@ -71,6 +81,8 @@ def __init__(
         debug_mode : Union[bool, int]
             Do extra correctness checking after the class creation and each time
             scheduling primitive
+        error_render_level : str = "detail"
+            The level of error rendering. Choices: "detail", "fast", "none"

Review comment:
       What about this one:
   
   ```
   The level of error rendering. Choices: "detail", "fast", "none".
   "detail": Render a detailed error message, with the TIR and error locations printed
   "fast: Show a simple error message without rendering or string manipulation
   "none": Do not show any error message.
   ```




-- 
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:
users@infra.apache.org



[GitHub] [tvm] tkonolige commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
tkonolige commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638258849



##########
File path: src/tir/schedule/concrete_schedule.cc
##########
@@ -173,21 +176,81 @@ class ScheduleCopier {
 
 void ConcreteScheduleNode::Copy(ScheduleState* new_state, TSymbolTable* new_symbol_table) const {
   ScheduleCopier::Copy(this, new_state, new_symbol_table);
+  new_state->get()->DebugVerify();
 }
 
 Schedule ConcreteScheduleNode::Copy() const {
   ObjectPtr<ConcreteScheduleNode> n = make_object<ConcreteScheduleNode>();
-  Copy(&n->state_, &n->symbol_table_);
+  n->error_render_level_ = this->error_render_level_;
+  this->Copy(&n->state_, &n->symbol_table_);
   n->analyzer_ = std::make_unique<arith::Analyzer>();
   return Schedule(std::move(n));
 }
 
+/*! \brief Macro that guards the beginning of each invocation of TensorIR schedule primitive */
+#define TVM_TIR_SCHEDULE_BEGIN() try {
+/*!
+ * \brief Macro that pairs with `TVM_TIR_SCHEDULE_BEGIN`, handling potential errors and error
+ * message rendering
+ * \param level An ScheduleErrorRenderLevel enum, level of error rendering
+ * \sa ScheduleErrorRenderLevel
+ */
+#define TVM_TIR_SCHEDULE_END(level)                               \
+  }                                                               \
+  catch (const ScheduleError& error) {                            \
+    if ((level) == ScheduleErrorRenderLevel::kDetail) {           \
+      throw tvm::runtime::Error(error.RenderReport());            \
+    } else if ((level) == ScheduleErrorRenderLevel::kFast) {      \
+      throw tvm::runtime::Error(error.FastErrorString());         \
+    } else if ((level) == ScheduleErrorRenderLevel::kNone) {      \
+      throw tvm::runtime::Error("ScheduleError: (not rendered)"); \
+    }                                                             \
+  }
+
 /******** Block/Loop relation ********/
 
 BlockRV ConcreteScheduleNode::GetBlock(const String& name, const String& func_name) {
+  class NotSingleResult : public ScheduleError {
+   public:
+    explicit NotSingleResult(String name, IRModule mod, const Array<StmtSRef>& blocks)
+        : name_(name), mod_(mod), blocks_{} {
+      blocks_.reserve(blocks.size());
+      for (const StmtSRef& block_sref : blocks) {
+        const BlockNode* block = TVM_SREF_TO_BLOCK(block, block_sref);
+        blocks_.push_back(GetRef<Block>(block));
+      }
+    }
+
+    String primitive() const final { return "get-block"; }
+    IRModule mod() const final { return mod_; }
+    Array<ObjectRef> LocationsOfInterest() const final { return {blocks_.begin(), blocks_.end()}; }
+
+    String DetailRenderTemplate() const final {
+      if (blocks_.empty()) {
+        return "Cannot find a block with the name: " + name_;
+      } else {
+        return "Find " + std::to_string(blocks_.size()) + " blocks with the name: " + name_;

Review comment:
       ```suggestion
           return "Found  " + std::to_string(blocks_.size()) + " blocks with the name: " + name_;
   ```

##########
File path: src/tir/schedule/error.h
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef TVM_TIR_SCHEDULE_ERROR_H_
+#define TVM_TIR_SCHEDULE_ERROR_H_
+
+#include <tvm/tir/schedule/state.h>
+
+namespace tvm {
+namespace tir {
+
+/*! \brief Error that happens during TensorIR scheduling */
+class ScheduleError : public tvm::runtime::Error {
+ public:
+  /*! \brief Base constructor */
+  ScheduleError() : tvm::runtime::Error("") {}
+  /*! \brief The schedule primitive applied that causes the error */
+  virtual String primitive() const = 0;
+  /*! \brief The IRModule that is applied on */

Review comment:
       ```suggestion
     /*! \brief The error occurred in this IRModule */
   ```

##########
File path: src/tir/schedule/concrete_schedule.cc
##########
@@ -173,21 +176,81 @@ class ScheduleCopier {
 
 void ConcreteScheduleNode::Copy(ScheduleState* new_state, TSymbolTable* new_symbol_table) const {
   ScheduleCopier::Copy(this, new_state, new_symbol_table);
+  new_state->get()->DebugVerify();
 }
 
 Schedule ConcreteScheduleNode::Copy() const {
   ObjectPtr<ConcreteScheduleNode> n = make_object<ConcreteScheduleNode>();
-  Copy(&n->state_, &n->symbol_table_);
+  n->error_render_level_ = this->error_render_level_;
+  this->Copy(&n->state_, &n->symbol_table_);
   n->analyzer_ = std::make_unique<arith::Analyzer>();
   return Schedule(std::move(n));
 }
 
+/*! \brief Macro that guards the beginning of each invocation of TensorIR schedule primitive */
+#define TVM_TIR_SCHEDULE_BEGIN() try {
+/*!
+ * \brief Macro that pairs with `TVM_TIR_SCHEDULE_BEGIN`, handling potential errors and error
+ * message rendering
+ * \param level An ScheduleErrorRenderLevel enum, level of error rendering
+ * \sa ScheduleErrorRenderLevel
+ */
+#define TVM_TIR_SCHEDULE_END(level)                               \
+  }                                                               \
+  catch (const ScheduleError& error) {                            \
+    if ((level) == ScheduleErrorRenderLevel::kDetail) {           \
+      throw tvm::runtime::Error(error.RenderReport());            \
+    } else if ((level) == ScheduleErrorRenderLevel::kFast) {      \
+      throw tvm::runtime::Error(error.FastErrorString());         \
+    } else if ((level) == ScheduleErrorRenderLevel::kNone) {      \
+      throw tvm::runtime::Error("ScheduleError: (not rendered)"); \
+    }                                                             \
+  }
+
 /******** Block/Loop relation ********/
 
 BlockRV ConcreteScheduleNode::GetBlock(const String& name, const String& func_name) {
+  class NotSingleResult : public ScheduleError {
+   public:
+    explicit NotSingleResult(String name, IRModule mod, const Array<StmtSRef>& blocks)
+        : name_(name), mod_(mod), blocks_{} {
+      blocks_.reserve(blocks.size());
+      for (const StmtSRef& block_sref : blocks) {
+        const BlockNode* block = TVM_SREF_TO_BLOCK(block, block_sref);
+        blocks_.push_back(GetRef<Block>(block));
+      }
+    }
+
+    String primitive() const final { return "get-block"; }
+    IRModule mod() const final { return mod_; }
+    Array<ObjectRef> LocationsOfInterest() const final { return {blocks_.begin(), blocks_.end()}; }
+
+    String DetailRenderTemplate() const final {
+      if (blocks_.empty()) {
+        return "Cannot find a block with the name: " + name_;
+      } else {
+        return "Find " + std::to_string(blocks_.size()) + " blocks with the name: " + name_;
+      }
+    }
+
+    String FastErrorString() const final {
+      if (blocks_.empty()) {
+        return "ScheduleError: Cannot find a block with the specific name";

Review comment:
       ```suggestion
           return "ScheduleError: Cannot find a block with the specified name";
   ```

##########
File path: python/tvm/tir/schedule/schedule.py
##########
@@ -87,10 +99,17 @@ def __init__(
                 debug_mode = 0
         if not isinstance(debug_mode, int):
             raise TypeError(f"`debug_mode` should be integer or boolean, but gets: {debug_mode}")
+        if error_render_level not in Schedule.ERROR_RENDER_LEVEL:
+            raise ValueError(
+                'error_render_level can be "detail", "fast", "none", but gets: '

Review comment:
       ```suggestion
                   'error_render_level can be "detail", "fast", or "none", but got: '
   ```

##########
File path: src/tir/schedule/error.h
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef TVM_TIR_SCHEDULE_ERROR_H_
+#define TVM_TIR_SCHEDULE_ERROR_H_
+
+#include <tvm/tir/schedule/state.h>
+
+namespace tvm {
+namespace tir {
+
+/*! \brief Error that happens during TensorIR scheduling */
+class ScheduleError : public tvm::runtime::Error {
+ public:
+  /*! \brief Base constructor */
+  ScheduleError() : tvm::runtime::Error("") {}
+  /*! \brief The schedule primitive applied that causes the error */

Review comment:
       ```suggestion
     /*! \brief The error occurred in this scheduling primitive */
   ```

##########
File path: src/tir/schedule/concrete_schedule.cc
##########
@@ -173,21 +176,81 @@ class ScheduleCopier {
 
 void ConcreteScheduleNode::Copy(ScheduleState* new_state, TSymbolTable* new_symbol_table) const {
   ScheduleCopier::Copy(this, new_state, new_symbol_table);
+  new_state->get()->DebugVerify();
 }
 
 Schedule ConcreteScheduleNode::Copy() const {
   ObjectPtr<ConcreteScheduleNode> n = make_object<ConcreteScheduleNode>();
-  Copy(&n->state_, &n->symbol_table_);
+  n->error_render_level_ = this->error_render_level_;
+  this->Copy(&n->state_, &n->symbol_table_);
   n->analyzer_ = std::make_unique<arith::Analyzer>();
   return Schedule(std::move(n));
 }
 
+/*! \brief Macro that guards the beginning of each invocation of TensorIR schedule primitive */
+#define TVM_TIR_SCHEDULE_BEGIN() try {
+/*!
+ * \brief Macro that pairs with `TVM_TIR_SCHEDULE_BEGIN`, handling potential errors and error
+ * message rendering
+ * \param level An ScheduleErrorRenderLevel enum, level of error rendering
+ * \sa ScheduleErrorRenderLevel
+ */
+#define TVM_TIR_SCHEDULE_END(level)                               \
+  }                                                               \
+  catch (const ScheduleError& error) {                            \
+    if ((level) == ScheduleErrorRenderLevel::kDetail) {           \
+      throw tvm::runtime::Error(error.RenderReport());            \
+    } else if ((level) == ScheduleErrorRenderLevel::kFast) {      \
+      throw tvm::runtime::Error(error.FastErrorString());         \
+    } else if ((level) == ScheduleErrorRenderLevel::kNone) {      \
+      throw tvm::runtime::Error("ScheduleError: (not rendered)"); \
+    }                                                             \
+  }
+
 /******** Block/Loop relation ********/
 
 BlockRV ConcreteScheduleNode::GetBlock(const String& name, const String& func_name) {
+  class NotSingleResult : public ScheduleError {
+   public:
+    explicit NotSingleResult(String name, IRModule mod, const Array<StmtSRef>& blocks)
+        : name_(name), mod_(mod), blocks_{} {
+      blocks_.reserve(blocks.size());
+      for (const StmtSRef& block_sref : blocks) {
+        const BlockNode* block = TVM_SREF_TO_BLOCK(block, block_sref);
+        blocks_.push_back(GetRef<Block>(block));
+      }
+    }
+
+    String primitive() const final { return "get-block"; }
+    IRModule mod() const final { return mod_; }
+    Array<ObjectRef> LocationsOfInterest() const final { return {blocks_.begin(), blocks_.end()}; }
+
+    String DetailRenderTemplate() const final {
+      if (blocks_.empty()) {
+        return "Cannot find a block with the name: " + name_;
+      } else {
+        return "Find " + std::to_string(blocks_.size()) + " blocks with the name: " + name_;
+      }
+    }
+
+    String FastErrorString() const final {
+      if (blocks_.empty()) {
+        return "ScheduleError: Cannot find a block with the specific name";
+      } else {
+        return "ScheduleError: Find multiple blocks with the specific name";

Review comment:
       ```suggestion
           return "ScheduleError: Found multiple blocks with the specified name";
   ```

##########
File path: src/tir/schedule/error.h
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef TVM_TIR_SCHEDULE_ERROR_H_
+#define TVM_TIR_SCHEDULE_ERROR_H_
+
+#include <tvm/tir/schedule/state.h>
+
+namespace tvm {
+namespace tir {
+
+/*! \brief Error that happens during TensorIR scheduling */
+class ScheduleError : public tvm::runtime::Error {
+ public:
+  /*! \brief Base constructor */
+  ScheduleError() : tvm::runtime::Error("") {}
+  /*! \brief The schedule primitive applied that causes the error */
+  virtual String primitive() const = 0;
+  /*! \brief The IRModule that is applied on */
+  virtual IRModule mod() const = 0;
+  /*! \brief The locations of interest that we want to point out */
+  virtual Array<ObjectRef> LocationsOfInterest() const = 0;
+  /*!
+   * \brief Returns an error string template for rendering, corresponds to the "detail" mode.
+   * \sa ScheduleErrorRenderLevel
+   * \note Format of the template:
+   * "Some normal error string and curly bracket-enclosed numbers like {0}, which indicates the
+   * 0-th element of the interested location."

Review comment:
       I'm not sure I understand this sentence.

##########
File path: include/tvm/tir/schedule/schedule.h
##########
@@ -24,6 +24,16 @@
 namespace tvm {
 namespace tir {
 
+/*! \brief The level of detailed error message rendering */
+enum class ScheduleErrorRenderLevel : int32_t {
+  /*! \brief Render the detail of the error message */

Review comment:
       ```suggestion
     /*! \brief Render a detailed error message */
   ```

##########
File path: python/tvm/tir/schedule/schedule.py
##########
@@ -71,6 +81,8 @@ def __init__(
         debug_mode : Union[bool, int]
             Do extra correctness checking after the class creation and each time
             scheduling primitive
+        error_render_level : str = "detail"
+            The level of error rendering. Choices: "detail", "fast", "none"

Review comment:
       Can you explain the differences in the levels?

##########
File path: src/tir/schedule/error.cc
##########
@@ -0,0 +1,55 @@
+/*
+ * 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 "./utils.h"
+
+namespace tvm {
+namespace tir {
+
+String ScheduleError::RenderReport() const {
+  IRModule mod = this->mod();
+  std::ostringstream os;
+  os << "ScheduleError: An error happened in schedule primitive '" << this->primitive()

Review comment:
       ```suggestion
     os << "ScheduleError: An error occurred in the schedule primitive '" << this->primitive()
   ```




-- 
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:
users@infra.apache.org



[GitHub] [tvm] tkonolige commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
tkonolige commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638949352



##########
File path: python/tvm/tir/schedule/schedule.py
##########
@@ -71,6 +81,8 @@ def __init__(
         debug_mode : Union[bool, int]
             Do extra correctness checking after the class creation and each time
             scheduling primitive
+        error_render_level : str = "detail"
+            The level of error rendering. Choices: "detail", "fast", "none"

Review comment:
       Looks good.




-- 
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:
users@infra.apache.org



[GitHub] [tvm] tqchen merged pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
tqchen merged pull request #8121:
URL: https://github.com/apache/tvm/pull/8121


   


-- 
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:
users@infra.apache.org



[GitHub] [tvm] tkonolige commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
tkonolige commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638950307



##########
File path: src/tir/schedule/error.h
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef TVM_TIR_SCHEDULE_ERROR_H_
+#define TVM_TIR_SCHEDULE_ERROR_H_
+
+#include <tvm/tir/schedule/state.h>
+
+namespace tvm {
+namespace tir {
+
+/*! \brief Error that happens during TensorIR scheduling */
+class ScheduleError : public tvm::runtime::Error {
+ public:
+  /*! \brief Base constructor */
+  ScheduleError() : tvm::runtime::Error("") {}
+  /*! \brief The schedule primitive applied that causes the error */
+  virtual String primitive() const = 0;
+  /*! \brief The IRModule that is applied on */
+  virtual IRModule mod() const = 0;
+  /*! \brief The locations of interest that we want to point out */
+  virtual Array<ObjectRef> LocationsOfInterest() const = 0;
+  /*!
+   * \brief Returns an error string template for rendering, corresponds to the "detail" mode.
+   * \sa ScheduleErrorRenderLevel
+   * \note Format of the template:
+   * "Some normal error string and curly bracket-enclosed numbers like {0}, which indicates the
+   * 0-th element of the interested location."

Review comment:
       The explanation you've provided here is good. Can you put it in the comment?




-- 
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:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on a change in pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on a change in pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#discussion_r638487314



##########
File path: python/tvm/tir/schedule/schedule.py
##########
@@ -71,6 +81,8 @@ def __init__(
         debug_mode : Union[bool, int]
             Do extra correctness checking after the class creation and each time
             scheduling primitive
+        error_render_level : str = "detail"
+            The level of error rendering. Choices: "detail", "fast", "none"

Review comment:
       Yeah sure. I am going to add more docs for those 3 options




-- 
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:
users@infra.apache.org



[GitHub] [tvm] junrushao1994 commented on pull request #8121: [TensorIR][M2a] Structural Error Reporting

Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on pull request #8121:
URL: https://github.com/apache/tvm/pull/8121#issuecomment-847234790


   CC: @tqchen @jroesch @comaniac @icemelon9 @zhiics


-- 
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:
users@infra.apache.org