code: def test_try_unaligned_vector_load():
      def get_compute(N, C_N, offset):
          A = te.placeholder((N,), name="A", dtype="float16")
          C = te.compute((C_N,), lambda i: A[i + offset], name="C")
          return N, C_N, A, C
  
      def get_compute_unaligned():
          return get_compute(3, 2, 1)
  
      def get_compute_aligned():
          return get_compute(4, 2, 2)
  
      def build(A, C, N, C_N):
          s = te.create_schedule(C.op)
          oi, ii = s[C].split(C.op.axis[0], factor=2)
          s[C].bind(oi, te.thread_axis("threadIdx.x"))
          s[C].vectorize(ii)  # BUG: misalignment
  
          tgt = tvm.target.Target(target="cuda", host="llvm")
          dev = tvm.device(tgt.kind.name, 0)
          f = tvm.build(s, [A, C], tgt, name="foo")
          kernel_source = f.imported_modules[0].get_source()
  
          a_data = np.arange(0, N).astype(A.dtype)
          a = tvm.nd.array(a_data, dev)
          c = tvm.nd.array(np.zeros(C_N, dtype=C.dtype), dev)
          f(a, c)
  
          return a_data, c.numpy(), kernel_source
  
      N, C_N, A, C = get_compute_unaligned()
      a_data, c, kernel_source = build(A, C, N, C_N)
      # (uint1*)(A + (1)) is invalid
      assert "A + (1)" not in kernel_source
  
      expected = a_data[1 : C_N + 1]
      assert np.allclose(
          c, expected
      ), f"expected={expected}\nactual={c}"
  
      N, C_N, A, C = get_compute_aligned()
      a_data, c, kernel_source = build(A, C, N, C_N)
      # (uint1*)(A + (2)) is a valid vector load
      assert "A + 2" in kernel_source
  
      expected = a_data[2 : C_N + 2]
      assert np.allclose(
          c, expected
      ), f"expected={expected}\nactual={c}"
  
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 28 for calling a global function with example usage: test_try_unaligned_vector_load() and returns: N,  C_N,  A,  C, get_compute, get_compute, a_data,  c,  kernel_source