After building relay module, I follow the tutorial from tvm/papi.html,but when I run the following code:
from tvm.relay.testing import mlp
from tvm.runtime import profiler_vm
target = "llvm"
dev = tvm.cpu()
mod, params = mlp.get_workload(1)
exe = tvm.relay.vm.compile(mod, target, params=params)
vm = profiler_vm.VirtualMachineProfiler(exe, dev)
data = tvm.nd.array(np.random.rand(1, 1, 28, 28).astype("float32"), device=dev)
report = vm.profile(
[data],
func_name="main",
collectors=[tvm.runtime.profiling.PAPIMetricCollector()],
)
print(report)
It ends up with “Warning: PAPI could not initialize counters for cpu: Unknown libpfm4 related error” and hints me with "Try setting sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid'
"
The environment I build tvm is:
- cmake = the latest 3.24.1
- docker: tvm/docker/Dockerfile.ci_gpu I have added “DOCKER_FLAGS+=( --privileged=true )” in bash.sh so I have the privilege to run the above hint code, but it doesn’t work. I don’t know where the problem is. Tvm build works well. Thanks a lot if someone can give some suggestions. tvm works well