code: def load_reference_log(backend, model, workload_name):
      """Load reference log from TopHub to support fallback in template.
      Template will use these reference logs to choose fallback config.
  
      Parameters
      ----------
      backend: str
          The backend name
      model: str
          The name of the device model
      workload_name: str
          The name of the workload. (The first item in the workload tuple)
      """
  
      backend = _alias(backend)
      if backend not in PACKAGE_VERSION:
          return []
      version = PACKAGE_VERSION[backend]
      package_name = f"{backend}_{version}.log"
      filename = Path(AUTOTVM_TOPHUB_ROOT_PATH, package_name)
  
      global REFERENCE_LOG_CACHE
      key = (backend, model, workload_name)
  
      if key not in REFERENCE_LOG_CACHE:
          tmp = []
          # If TOPHUB_LOCATION is not AUTOTVM_TOPHUB_NONE_LOC,
          # Download the config file from tophub if not exists.
          if not Path(filename).exists():
              tophub_location = _get_tophub_location()
              if tophub_location != AUTOTVM_TOPHUB_NONE_LOC:
                  download_package(tophub_location, package_name)
          if Path(filename).is_file():  # in case download failed
              find = False
              inp = None
              counts = {}
              for inp, res in load_from_file(filename):
                  counts[inp.target.model] = (
                      counts.get(inp.target.model, 0) + 1
                  )
                  if model == inp.target.model:
                      find = True
                      break
              # if device model is not find, use the device model with the most tuned workloads
              if not find and counts:
                  model = max(counts.items(), key=lambda k: k[1])[0]
  
              for inp, res in load_from_file(filename):
                  if (
                      model == inp.target.model
                      and inp.task.workload[0] == workload_name
                  ):
                      tmp.append((inp, res))
          REFERENCE_LOG_CACHE[key] = tmp
  
      return REFERENCE_LOG_CACHE[key]
  
file_path: tvm/python/tvm/autotvm/tophub.py
imports: import logging
  from os import getenv
  import sys
  from pathlib import Path
  from tvm.ir.container import Array
  from .task import ApplyHistoryBest
  from ..target import Target
  from ..contrib.download import download
  from .record import load_from_file
  from .utils import EmptyContext
label_desc: Use image node_id 6 for calling a global function with example usage: load_reference_log(backend, model, workload_name) and returns: REFERENCE_LOG_CACHE, list