Skip to content

Commit

Permalink
[SERVE][OPENCL] Pre compiler cache enable for opencl (#2954)
Browse files Browse the repository at this point in the history
Pre compiler cache enable for opencl to avoid kernel compile affecting benchmark
  • Loading branch information
krishnaraj36 authored Sep 30, 2024
1 parent d1ebaa5 commit d2cd68e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cpp/serve/function_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ void FunctionTable::Init(String reload_lib_path, Device device, picojson::object
} else {
executable = tvm::runtime::Module::LoadFromFile(reload_lib_path);
fload_exec = executable->GetFunction("vm_load_executable");
/* precompile opencl kernel programs */
if (device.device_type == kDLOpenCL) {
auto f_get = executable->GetFunction("opencl.GetPreCompiledPrograms", true);
std::string ss = f_get();
auto bytes = tvm::String(ss);
auto f_set = executable->GetFunction("opencl.SetPreCompiledPrograms", true);
f_set(tvm::String(bytes));
}
ICHECK(fload_exec.defined()) << "TVM runtime cannot find vm_load_executable";
}
this->use_disco = false;
Expand Down

0 comments on commit d2cd68e

Please sign in to comment.