code: def test_loop_dep_reduce_cache_write():
      X = te.placeholder(shape=(10,), name="x")
  
      def f(n):
          rv = te.reduce_axis((0, n))
          init = lambda dtype: tvm.tir.Select(
              n > 1, tvm.tir.const(0, dtype), n.astype(dtype)
          )
          sum = te.comm_reducer(
              lambda x, y: tvm.te.max(x + y, n.astype("float32")),
              init,
              name="sum",
          )
          return sum(X[rv], axis=rv)
  
      Y = te.compute(X.shape, f, name="y")
      s = te.create_schedule([Y.op])
      s.cache_write(Y, "local")
      f = tvm.build(s, [X, Y])
  
imports: import numpy
  import tvm
  from tvm import te
  from tvm.driver.build_module import schedule_to_module
label_desc: Use image node_id 24 for calling a global function with example usage: test_loop_dep_reduce_cache_write() and returns: sum