code: def test_variable_passed_from_args():
      ib = tvm.tir.ir_builder.create()
  
      input_buffer = tvm.tir.decl_buffer(name="input_buffer", shape=[1])
      not_device_context = tvm.tir.Var(
          "not_device_context", dtype="handle"
      )
  
      ib.emit(
          tvm.tir.call_extern(
              "float32",
              "some_external_call",
              input_buffer.data,
              not_device_context,
          ),
      )
      stmt = ib.get()
  
      mod = tvm.IRModule.from_expr(
          tvm.tir.PrimFunc([input_buffer, not_device_context], stmt)
      )
      mod = tvm.tir.transform.Apply(
          lambda f: f.with_attr(
              "target", tvm.target.Target("llvm", host="llvm")
          )
      )(mod)
      mod = tvm.tir.transform.Apply(
          lambda f: f.with_attr("global_symbol", "main")
      )(mod)
      func = tvm.tir.transform.MakePackedAPI()(mod)["main"]
  
      num_args = func.params[2]
  
      # num_args assertion
      assert func.body.condition.a == num_args
      assert func.body.condition.b == 2
  
      # Arguments unpacking
      assignment = _find_assignment(func.body, "input_buffer")
      assert (
          str(assignment.value)
          == 'T.tvm_struct_get(args, 0, 12, "handle")'
      )
  
      assignment = _find_assignment(assignment.body, "input_buffer")
      assert (
          str(assignment.value)
          == 'T.tvm_struct_get(input_buffer, 0, 1, "handle")'
      )
      unpacked_input_buffer = assignment.var
  
      assignment = _find_assignment(func.body, "not_device_context")
      assert (
          str(assignment.value)
          == 'T.tvm_struct_get(args, 1, 12, "handle")'
      )
      unpacked_not_device_context = assignment.var
  
      seq_stmt = _find_next(assignment, tvm.tir.SeqStmt)
      call = _find_next(seq_stmt[1], tvm.tir.Evaluate)
      call_extern = call.value
  
      assert call_extern.args[1] == unpacked_input_buffer
      assert call_extern.args[2] == unpacked_not_device_context
  
file_path: tvm/tests/python/tir-transform/test_tir_transform_make_packed_api.py
imports: import pytest
  import tvm
  import tvm.testing
  from tvm import te, tir
  from tvm.script import tir, ir
  from tvm.driver.build_module import schedule_to_module
label_desc: Use image node_id 5 for calling a global function with example usage: test_variable_passed_from_args() without return types