Skip to content

Commit fe34cbb

Browse files
author
Peter Salas
committed
[Autoscheduler] Reduce task weight coercion overhead
1 parent 1914462 commit fe34cbb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

python/tvm/auto_scheduler/relay_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def extract_tasks(
171171
desc=",".join(func_names),
172172
)
173173
)
174-
weights.append(weight)
174+
weights.append(int(weight))
175175

176176
if dump_workload_to_dag_log is not None:
177177
with open(dump_workload_to_dag_log, "w") as f:

src/node/reflection.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ runtime::TVMRetValue ReflectionVTable::GetAttr(Object* self, const String& field
106106
}
107107
}
108108
if (!success) {
109-
LOG(FATAL) << "AttributeError: " << self->GetTypeKey() << " object has no attributed "
110-
<< getter.skey;
109+
// This exception is typically caught, sometimes in a loop. LOG(FATAL) is very
110+
// expensive (it collects a backtrace) so throw an explicit exception instead.
111+
std::ostringstream os;
112+
os << "AttributeError: " << self->GetTypeKey() << " object has no attribute " << getter.skey;
113+
throw dmlc::Error(os.str());
111114
}
112115
return ret;
113116
}

0 commit comments

Comments
 (0)