PAPI: Unknown libpfm4 related error

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

The problem has been solved. This warning doesnn’t affect the process, and the real problems are two: One is the PAPI turtoial code bug, which has already been proposed and solved in another topic. The other is the type of data. In PAPI tutorial, data is astype float32, but when I do this in gpt model, it needs to be turned as int, and it works well. Next I gonna analyse the result, but that’s not the content this TOPIC covers.