code: def test_allocate_const_after_tensorize():
      i_size, o_size, h_size, w_size = 64, 64, 56, 56
      k_height_size = k_width_size = 3
      w_shape = (o_size, i_size, k_height_size, k_width_size)
  
      data = relay.var(
          "data", shape=(1, i_size, h_size, w_size), dtype="uint8"
      )
      weight = relay.var("weight", shape=w_shape, dtype="uint8")
      conv2d = relay.nn.conv2d(
          data=data,
          weight=weight,
          kernel_size=(k_height_size, k_width_size),
          channels=o_size,
          padding=(0, 0),
          strides=(1, 1),
          out_dtype="int32",
      )
      mod = tvm.IRModule.from_expr(conv2d)
  
      executor = relay.backend.Executor("graph", {"link-params": True})
      mod = mod.with_attr("executor", executor)
  
      weight_np = np.random.uniform(1, 10, size=w_shape).astype("uint8")
  
      target = tvm.target.Target("hexagon")
  
      with tvm.transform.PassContext(opt_level=3):
          opt_mod, _ = relay.optimize(
              mod, params={"weight": weight_np}, target=target
          )
  
      conv2d_func = opt_mod["main"].body.args[0].op
      prim_func = lower_to_primfunc(conv2d_func, target)
  
      sch = tir.Schedule(prim_func)
      block = sch.get_block("conv2d_NCHWc_int8")
      loops = sch.get_loops(block)
  
      sch.reorder(loops[8], loops[4], loops[-1])
      sch.decompose_reduction(block, loops[1])
      sch.tensorize(loops[4], VRMPY_u8u8i32_INTRIN)
  
      seq = tvm.transform.Sequential(
          [
              tvm.tir.transform.LowerInitBlock(),
              tvm.tir.transform.PlanAndUpdateBufferAllocationLocation(),
          ]
      )
  
      # The following error is emitted if AllocateConst nodes are not correctly handled:
      #  Check failed: (buffer_data_to_buffer_.count(source_var)) is false:
      _ = seq(sch.mod)
  
imports: import numpy
  import tvm
  import tvm.testing
  from tvm import te
  from tvm.script import tir
  from tvm import relay, tir
  from tvm.relay.backend.te_compiler import lower_to_primfunc
  from tvm.tir.tensor_intrin.hexagon import VRMPY_u8u8i32_INTRIN
label_desc: Use image node_id 17 for calling a global function with example usage: test_allocate_const_after_tensorize() without return types