Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TVM] Update Submodule 2022-08-15-13-16-11 #120

Merged
merged 3 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/tvm
Submodule tvm updated from b4e36c to bb5138
8 changes: 4 additions & 4 deletions src/op/dialect/cutlass/cutlass_fusion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ OpEnv* Tune(const op::CallValues& call, OpEnv* op_env) {
} else {
std::vector<std::shared_ptr<TunableConfig>> tunable = env->ListTunableConfigs();
const int number = 10, repeat = 1, min_repeat_ms = 0, cooldown_interval_ms = 0,
repeats_to_cooldow = 1;
repeats_to_cooldown = 1, limit_zero_time_iterations = 100;
double min_time = std::numeric_limits<double>::max();
for (auto& config : tunable) {
env->SetTunableConfig(config);
env->Init(call);
Array<FloatValue> result =
TimeEvaluator(TypedPackedFunc<void()>([&]() { env->Execute(call); }), call->device,
number, repeat, min_repeat_ms, cooldown_interval_ms, repeats_to_cooldow)();
Array<FloatValue> result = TimeEvaluator(
TypedPackedFunc<void()>([&]() { env->Execute(call); }), call->device, number, repeat,
min_repeat_ms, limit_zero_time_iterations, cooldown_interval_ms, repeats_to_cooldown)();
CHECK_EQ(result.size(), 1U);
if (result[0]->value < min_time) {
min_time = result[0]->value;
Expand Down
6 changes: 4 additions & 2 deletions src/op/dialect/cutlass/timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ tvm::runtime::Module MakeCutlassModule(PackedFunc pf) {
}

PackedFunc TimeEvaluator(PackedFunc pf, Device dev, int number, int repeat, int min_repeat_ms,
int cooldown_interval_ms, int repeats_to_cooldown) {
int limit_zero_time_iterations, int cooldown_interval_ms,
int repeats_to_cooldown) {
tvm::Device tvm_dev = dev;
auto wrapper = [=](TVMArgs args, TVMRetValue* rv) mutable {
const static PackedFunc rpv_eval = registry::GetPackedFunc("runtime.RPCTimeEvaluator");
PackedFunc timer =
rpv_eval(MakeCutlassModule(pf), "main", (int)tvm_dev.device_type, (int)tvm_dev.device_id,
number, repeat, min_repeat_ms, cooldown_interval_ms, repeats_to_cooldown, "");
number, repeat, min_repeat_ms, limit_zero_time_iterations, cooldown_interval_ms,
repeats_to_cooldown, "");
TVMRetValue timer_rv;
timer.CallPacked(args, &timer_rv);
const double* speed = reinterpret_cast<const double*>(timer_rv.operator std::string().data());
Expand Down
4 changes: 4 additions & 0 deletions src/op/dialect/cutlass/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ tvm::runtime::Module MakeCutlassModule(registry::PackedFunc pf);
* minimum duration requirement of one `repeat`.
* i.e., When the run time of one `repeat` falls below this time, the `number`
* parameter will be automatically increased.
* \param limit_zero_time_iterations The maximum number of repeats when
* measured time is equal to 0. It helps to avoid hanging
* during measurements.
* \param cooldown_interval_ms The cooldown interval in milliseconds between the number of
* repeats defined by `repeats_to_cooldown`.
* \param repeats_to_cooldown The number of repeats before the cooldown is activated.
Expand All @@ -70,6 +73,7 @@ tvm::runtime::Module MakeCutlassModule(registry::PackedFunc pf);
*/
registry::PackedFunc TimeEvaluator(registry::PackedFunc pf, Device dev, int number = 10,
int repeat = 1, int min_repeat_ms = 0,
int limit_zero_time_iterations = 100,
int cooldown_interval_ms = 0, int repeats_to_cooldown = 1);

} // namespace cutlass
Expand Down
2 changes: 1 addition & 1 deletion src/op/dialect/tvm/tvm_fusion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ OpEnv* FusedFuncBuild(const op::CallValues& call) {
te_compiler->Clear();
try {
auto cached_key = tvm::relay::tec::CCacheKey(func, target);
auto cached_func = te_compiler->Lower(cached_key, [](String name) { return name; });
auto cached_func = te_compiler->Lower(cached_key);
auto mod = tvm::build(cached_func->funcs, cached_key->target, Target(nullptr));
entry = TVMModuleCacheEntry(mod, cached_func->prim_fn_var->name_hint);
cache->Set(key.byte_vector, entry);
Expand Down
2 changes: 1 addition & 1 deletion src/op/dialect/tvm/tvm_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ extern MetaPersistCache<RelayFuncCacheEntry> CacheLoweredFunc;
[&](const ir::Function& f) { \
te_compiler->Clear(); \
auto key = tvm::relay::tec::CCacheKey(f, target); \
auto cached_func = te_compiler->Lower(key, [](String name) { return name; }); \
auto cached_func = te_compiler->Lower(key); \
auto mod = tvm::build(cached_func->funcs, key->target, Target(nullptr)); \
return TVMModuleCacheEntry(mod, cached_func->prim_fn_var->name_hint); \
}); \
Expand Down