Data alignment mismatch warning



I got a warning about data alignment mismatch, although this doesn’t affect the correctness of computation.

src/pass/ Trying to bind buffer to another one with lower alignment requirement required_alignment=64, provided_alignment=4

Any thought?


would be great if you provide a code snippet that reproduces the warning. This has things to do with buffer alignment, so by default buffer assumes 64 bytes of alignment, but if we try to pass in some certain offset that does not satisfy this alignment, a warning will be fired.

If the intention is to use a buffer that does not have such alignment requirement, we can declare the buffer with corresponding data_alignment keyword in decl_buffer


This is a trivial example to reproduce the warning:

def test_ir(data, out1, out2):
    ib = tvm.ir_builder.create()
    return ib.get()

def test(data):
    count, out1 = tvm.extern([(1,), data.shape], [data], lambda ins, outs: test_ir(ins[0], outs[0], outs[1]), dtype=["float32", "float32"])
    out2 = tvm.compute(out1.shape, lambda i, j, k: out1[i, j, k] * count[0])
    return out2

data = tvm.placeholder((1, 2, 3), name="data")
result = test(data)
s = tvm.create_schedule(result.op)
ctx = tvm.cpu(0)
f =, [data, result], "llvm -mcpu=core-avx2")


Similar issue when employing tensorize.

I looked into the tvm.decl_buffer api. I am confused by the sementatic of the data_alignment argument. By intuition, should it be the byte size of the data type of a buffer?

The document is as below, but I can hardly understand the it means beyond the text…

The alignment of data pointer in bytes. If -1 is passed, the alignment will be set to TVM’s internal default.


The alignment could be more than the default size. For example, when we want to make use of AVX or Neon, the data is required to be aligned to be multiple of 4 so we can load 4 floats in at a time


Thanks, so it is basically for sanity check.