code: def record_common(dag, s):
      target = tvm.target.Target("llvm")
      task = auto_scheduler.SearchTask(
          compute_dag=dag, workload_key="test", target=target
      )
  
      inp = auto_scheduler.measure.MeasureInput(task, s)
      res = auto_scheduler.measure.MeasureResult([0.1], 0, "", 0.2, 1)
  
      # Test in-memory record processing.
      record_str = auto_scheduler.measure_record.dump_record_to_string(
          inp, res
      )
      (
          r_inp,
          r_res,
      ) = auto_scheduler.measure_record.load_record_from_string(
          record_str
      )
      # Only check the workload_key for simplification.
      assert inp.task.workload_key == r_inp.task.workload_key
      assert str(res) == str(r_res)
  
      # Test file-based record processing.
      with tempfile.NamedTemporaryFile() as fp:
          auto_scheduler.save_records(fp.name, [inp], [res])
  
          log_reader = auto_scheduler.RecordReader(fp.name)
          inputs, _ = log_reader.read_lines()
          assert len(inputs) == 1
  
          s1 = dag.infer_bound_from_state(s)
          s2 = dag.infer_bound_from_state(inputs[0].state)
  
          assert s1 == s2
          assert not (s1 == dag.get_init_state())
  
imports: import json
  import multiprocessing
  import numpy
  import tvm
  from tvm import topi
  from tvm import te, auto_scheduler
  import tempfile
  import tvm.testing
  import pickle
  from tvm.testing.auto_scheduler import matmul_auto_scheduler_test
  from tvm.auto_scheduler import workload_registry
label_desc: Use image node_id 1 for calling a global function with example usage: record_common(dag, s) without return types