code: def test_llvm_link_params(linkable_dtype):
      ir_mod, param_init = _make_mod_and_params(linkable_dtype)
      rand_input = _make_random_tensor(linkable_dtype, INPUT_SHAPE)
      main_func = ir_mod["main"]
      target = "llvm"
      runtime = Runtime("crt", {"system-lib": True})
      executor = Executor("graph", {"link-params": True})
      with tvm.transform.PassContext(opt_level=3):
          lib = tvm.relay.build(
              ir_mod,
              target,
              runtime=runtime,
              executor=executor,
              params=param_init,
          )
  
          # NOTE: Need to export_library() and load_library() to link all the Module(llvm, ...)
          # against one another.
          temp_dir = utils.TempDirectory()
          export_file = temp_dir / "lib.so"
          lib.lib.export_library(export_file)
          mod = tvm.runtime.load_module(export_file)
          assert (
              len(lib.params.keys()) == 0
          )  # NOTE: params became tir.constants
          assert mod.get_function("TVMSystemLibEntryPoint") != None
  
          graph = json.loads(lib.graph_json)
          for p in lib.params:
              _verify_linked_param(
                  linkable_dtype, lib, mod, graph, p
              ) or found_one
  
          # Wrap in function to explicitly deallocate the runtime.
          def _run_linked(lib, mod):
              graph_json, _, _ = lib
              graph_rt = tvm.contrib.graph_executor.create(
                  graph_json, mod, tvm.cpu(0)
              )
              graph_rt.set_input(
                  "rand_input", rand_input
              )  # NOTE: params not required.
              graph_rt.run()
              return graph_rt.get_output(0)
  
          linked_output = _run_linked(lib, mod)
  
      runtime = Runtime("cpp", {"system-lib": True})
      with tvm.transform.PassContext(opt_level=3):
          lib = tvm.relay.build(
              ir_mod, "llvm", runtime=runtime, params=param_init
          )
  
          def _run_unlinked(lib):
              graph_json, mod, lowered_params = lib
              graph_rt = tvm.contrib.graph_executor.create(
                  graph_json, mod, tvm.cpu(0)
              )
              graph_rt.set_input(
                  "rand_input", rand_input, **lowered_params
              )
              graph_rt.run()
              return graph_rt.get_output(0)
  
          unlinked_output = _run_unlinked(lib)
  
      if "int" in linkable_dtype:
          np.testing.assert_equal(
              unlinked_output.numpy(), linked_output.numpy()
          )
      else:
          np.testing.assert_allclose(
              unlinked_output.numpy(), linked_output.numpy()
          )
  
imports: import collections
  import ctypes
  import json
  import os
  import re
  from contextlib import redirect_stderr
  from io import StringIO
  import numpy
  import tvm
  import tvm.relay
  import tvm.testing
  from tvm import meta_schedule
  from tvm import relay
  from tvm.contrib import utils
  from tvm.relay.backend import Executor, Runtime
label_desc: Use image node_id 7 for calling a global function with example usage: test_llvm_link_params(linkable_dtype) and returns: graph_rt, graph_rt