code: def test_coproc_sync2():
      ib = tvm.tir.ir_builder.create()
      n = te.size_var("n")
      cp = te.thread_axis((0, 1), "cop")
      ty = te.thread_axis("cthread")
      A = ib.allocate("float32", 128, name="A")
      ib.scope_attr(ty, "virtual_thread", 2)
      with ib.new_scope():
          ib.scope_attr(cp, "coproc_scope", 2)
          A[ty] = 0.0
      with ib.for_range(0, n, name="i") as i:
          with ib.new_scope():
              ib.scope_attr(cp, "coproc_scope", 1)
              A[ty] = 1.0
          with ib.new_scope():
              ib.scope_attr(cp, "coproc_scope", 2)
              A[ty] = 1.0
      stmt = ib.get()
  
      mod = tvm.IRModule.from_expr(tvm.tir.PrimFunc([n], stmt))
      stmt = tvm.tir.transform.CoProcSync()(mod)["main"].body
  
imports: import tvm
  from tvm import te
label_desc: Use image node_id 2 for calling a global function with example usage: test_coproc_sync2() without return types