code: def test_crossthread_reduction1(target, dev):
      n = te.var("n")
      m = te.var("m")
      A = te.placeholder((n, m), name="A")
      k = te.reduce_axis((0, m), "m")
      B = te.compute((n,), lambda i: te.sum(A[i, k], axis=k), name="B")
  
      def sched(nthd):
          s = te.create_schedule(B.op)
          ko, _ = s[B].split(B.op.reduce_axis[0], nparts=nthd)
          s[B].bind(ko, te.thread_axis("threadIdx.x"))
          s[B].bind(B.op.axis[0], te.thread_axis("blockIdx.x"))
          func = tvm.build(s, [A, B], target)
          return func
  
      def verify(nthd):
          func = sched(nthd)
          nn = 3
          # checks three typical cases
          vals = [nthd - 1, nthd, nthd + 1]
          for kk in [x for x in vals]:
              size = (nn, kk)
              a = tvm.nd.array(
                  np.random.uniform(size=size).astype(A.dtype), dev
              )
              b = tvm.nd.array(np.zeros(nn, dtype=B.dtype), dev)
              func(a, b)
              tvm.testing.assert_allclose(
                  b.numpy(), np.sum(a.numpy(), axis=1), rtol=1e-3
              )
  
      verify(16)
      verify(32)
      verify(64)
  
imports: import os
  import re
  import tvm
  from tvm import te
  import numpy
  from tvm import topi
  from tvm.contrib.nvcc import have_fp16, have_int8, have_bf16
  from tvm.contrib import utils
  from tvm.script import tir
  import tvm.testing
  import pytest
label_desc: Use image node_id 9 for calling a global function with example usage: test_crossthread_reduction1(target, dev) and returns: func