[C++ RPC + AOT] Error "Can not pass in local device" when deploying AOT-compiled model via C++ RPC client

It works that using “rpc.SessTableIndex” and AddRPCSessionMask, but I don’t know whether it’s a correct way.

auto f_get_idx = tvm::runtime::Registry::Get("rpc.SessTableIndex");
int my_idx = (*f_get_idx)(mod);
DLDevice local_dev = {kDLCPU, 0};
DLDevice remote_dev = tvm::runtime::AddRPCSessionMask(local_dev, my_idx);
tvm::runtime::Module gmod = mod.GetFunction("default")(remote_dev);