code: def test_global():
      metatable = {"VirtualDevice": [CPU, GPU]}
  
      def input():
          return tvm.relay.parse(
              """
              #[version = "0.0.5"]
              def @f(%a: Tensor[(5, 7), float32], %b: Tensor[(5, 7), float32]) -> Tensor[(5, 7), float32] {
                %0 = on_device(%b, virtual_device=meta[VirtualDevice][0]);
                add(%a, %0)
              }
  
              def @main(%x: Tensor[(5, 7), float32], %y: Tensor[(5, 7), float32]) -> Tensor[(5, 7), float32] {
                @f(%y, %x)
              }
          """,
              "from_string",
              None,
              metatable,
          )
  
      def expected():
          return tvm.relay.parse(
              """
              #[version = "0.0.5"]
              def @f(%a {virtual_device=meta[VirtualDevice][1]}: Tensor[(5, 7), float32], %b {virtual_device=meta[VirtualDevice][0]}: Tensor[(5, 7), float32],
                     virtual_device=meta[VirtualDevice][1]) -> Tensor[(5, 7), float32] {
                %0 = device_copy(%b, src_virtual_device=meta[VirtualDevice][0], dst_virtual_device=meta[VirtualDevice][1]);
                add(%a, %0)
              }
  
              def @main(%x {virtual_device=meta[VirtualDevice][0]}: Tensor[(5, 7), float32], %y {virtual_device=meta[VirtualDevice][1]}: Tensor[(5, 7), float32],
                        virtual_device=meta[VirtualDevice][1]) -> Tensor[(5, 7), float32] {
                @f(%y, %x)
              }
          """,
              "from_string",
              None,
              metatable,
          )
  
      def ref(x, y):
          def f(a, b):
              return np.add(a, b)
  
          return f(x, y)
  
      exercise(input(), expected(), ref, rands((5, 7), 2))
  
imports: import tvm
  from tvm import relay
  from tvm.script import tir
  import tvm.testing
  import numpy
  import os
label_desc: Use image node_id 32 for calling a global function with example usage: test_global() and returns: tvm, tvm, f, np