vinx13 commented on a change in pull request #9306:
URL: https://github.com/apache/tvm/pull/9306#discussion_r731001016
##########
File path: src/tir/schedule/error.cc
##########
@@ -24,22 +24,31 @@ namespace tir {
String ScheduleError::RenderReport(const String& primitive) const {
IRModule mod = this->mod();
std::ostringstream os;
- os << "ScheduleError: An error occurred in the schedule primitive '" <<
primitive
- << "'.\n\nThe IR is:\n"
- << AsTVMScript(mod);
+
+ // get locations of interest
Array<ObjectRef> locs = LocationsOfInterest();
int n_locs = locs.size();
std::vector<String> roi_names;
roi_names.reserve(n_locs);
if (n_locs > 0) {
- os << "Regions of interest:\n";
for (const ObjectRef& obj : locs) {
String name = obj->GetTypeKey() + '#' + std::to_string(roi_names.size());
- os << name << "\n" << obj;
roi_names.emplace_back(std::move(name));
}
- os << "\n";
}
+
+ // print IR module
+ runtime::TypedPackedFunc<String(ObjectRef)> annotate =
+ runtime::TypedPackedFunc<String(ObjectRef)>([](const ObjectRef& expr) ->
String {
+ std::string annotations = std::string(10, '^');
Review comment:
What is 10? I think the length should be determined after printing the
the first line of the annotated statements
##########
File path: src/tir/schedule/error.cc
##########
@@ -24,22 +24,31 @@ namespace tir {
String ScheduleError::RenderReport(const String& primitive) const {
IRModule mod = this->mod();
std::ostringstream os;
- os << "ScheduleError: An error occurred in the schedule primitive '" <<
primitive
- << "'.\n\nThe IR is:\n"
- << AsTVMScript(mod);
+
+ // get locations of interest
Array<ObjectRef> locs = LocationsOfInterest();
int n_locs = locs.size();
std::vector<String> roi_names;
roi_names.reserve(n_locs);
if (n_locs > 0) {
- os << "Regions of interest:\n";
for (const ObjectRef& obj : locs) {
String name = obj->GetTypeKey() + '#' + std::to_string(roi_names.size());
- os << name << "\n" << obj;
roi_names.emplace_back(std::move(name));
}
- os << "\n";
}
+
+ // print IR module
+ runtime::TypedPackedFunc<String(ObjectRef)> annotate =
+ runtime::TypedPackedFunc<String(ObjectRef)>([](const ObjectRef& expr) ->
String {
Review comment:
The annotate function should return a name of the region of interest,
like Block #0, which is referred in the error message below.
--
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]