code: def callback_rocm_bitcode_path(rocdl_dir=None):
      """Utility function to find ROCm device library bitcodes
  
      Parameters
      ----------
      rocdl_dir : str
          The path to rocm library directory
          The default value is the standard location
      """
      # seems link order matters.
  
      if rocdl_dir is None:
          if exists("/opt/rocm/amdgcn/bitcode/"):
              rocdl_dir = (
                  "/opt/rocm/amdgcn/bitcode/"  # starting with rocm 3.9
              )
          else:
              rocdl_dir = "/opt/rocm/lib/"  # until rocm 3.8
  
      bitcode_names = [
          "oclc_daz_opt_on",
          "ocml",
          "irif",  # this does not exist in rocm 3.9, drop eventually
          "oclc_correctly_rounded_sqrt_off",
          "oclc_correctly_rounded_sqrt_on",
          "oclc_daz_opt_off",
          "oclc_finite_only_off",
          "oclc_finite_only_on",
          # todo (t-vi): an alternative might be to scan for the
          "oclc_isa_version_803",
          "oclc_isa_version_900",  # isa version files (if the linker throws out
          "oclc_isa_version_906",  # the unneeded ones or we filter for the arch we need)
          "oclc_isa_version_1030",
          "oclc_unsafe_math_off",
          "oclc_unsafe_math_on",
          "oclc_wavefrontsize64_on",
          "oclc_abi_version_500",
      ]
  
      bitcode_files = []
      for n in bitcode_names:
          p = join(rocdl_dir, n + ".bc")  # rocm >= 3.9
          if not exists(p):  # rocm <= 3.8
              p = join(rocdl_dir, n + ".amdgcn.bc")
          if exists(p):
              bitcode_files.append(p)
          elif "isa_version" not in n and n not in {"irif"}:
              raise RuntimeError("could not find bitcode " + n)
  
      return tvm.runtime.convert(bitcode_files)
  
file_path: tvm/python/tvm/contrib/rocm.py
imports: import re
  import subprocess
  import os
  from os.path import join, exists
  import tvm._ffi
  from tvm._ffi.base import py_str
  import tvm.runtime
  import tvm.target
  from .None import utils
label_desc: Use image node_id 4 for calling a global function with example usage: callback_rocm_bitcode_path(rocdl_dir) and returns: tvm