code: def test_papi(target, dev):
      target = tvm.target.Target(target)
      if str(target.kind) == "llvm":
          metric = "PAPI_FP_OPS"
      elif str(target.kind) == "cuda":
          metric = "cuda:::event:shared_load:device=0"
      else:
          pytest.skip(
              f"Target {target.kind} not supported by this test"
          )
      mod, params = mlp.get_workload(1)
  
      exe = 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({dev: [metric]})
          ],
      )
      assert metric in str(report)
  
      csv = read_csv(report)
      assert metric in csv.keys()
      assert any([float(x) > 0 for x in csv[metric]])
  
imports: import numpy
  import pytest
  from io import StringIO
  import csv
  import os
  import json
  import platform
  import tvm.testing
  import tvm.utils
  from tvm.runtime import profiler_vm
  from tvm import relay
  from tvm.relay.testing import mlp
  from tvm.contrib.debugger import debug_executor
  from tvm import rpc
  from tvm.contrib import utils
  from tvm.runtime.profiling import Report
  from tvm.script import tir
label_desc: Use image node_id 4 for calling a global function with example usage: test_papi(target, dev) without return types