Profile mlc_chat_cli on android phone

I tried to do per op profiling on android phone for mlc-chat. I add following code tvm::Device gpu; gpu.device_type = kDLOpenCL; int device_type = gpu.device_type; gpu.device_id = device_id; std::ifstream loaded_json(model.config); std::string json_data((std::istreambuf_iterator(loaded_json)), std::istreambuf_iterator()); loaded_json.close(); std::string lib_path_string = model.lib.parent_path().string(); std::string model_path_string = model.config.string(); std::cout <<"model_path_string "<<model_path_string<<std::endl; tvm::runtime::Module loaded_lib = tvm::runtime::Module::LoadFromFile(lib_path); tvm::runtime::Module executor = (*tvm::runtime::Registry::Get(“tvm.graph_executor_debug.create”))(json_data, loaded_lib, device_type, gpu.device_id); tvm::runtime::PackedFunc profile = executor.GetFunction(“profile”);

But I don’t know where I should get model json file, initially, I thought it is mlc-chat-config.json, I realized it means network json. Could you tell me how to dump the json file? This my first time on TVM, it might be very trivial questions. Thanks.

MLC uses vm executor(not graph executor).

Both of them ends up in opencl runtime and the OpenCL kernel launch/enqueu happens at

You may try using OpenCL profiling using events here.

Also, you might need to enabled opencl profiling while creating queue at

@srkreddy1238 really appreciated for your reply, I tried to profile it on per Op based. Any feedback how to do it?