Skip to content

Non-zero extent of access_ptr is out range of the buffer #1937

@gaoxiong-1

Description

@gaoxiong-1

Currently, the extent is not exposed in access_ptr api of Buffer. But in this api implement, the total buffer size is used for extent argument of tvm_access_ptr.
As @tqchen mentioned in this discussion https://discuss.tvm.ai/t/what-is-the-precise-meaning-of-tvm-access-ptrs-extent/957 , if the offset is non-zero, then the end of access region offset+ extent will be out of range.
This is illustrated in this code sample.
m = tvm.var('m')
n = tvm.var('n')
Ab = tvm.decl_buffer((m, n), tvm.float32)
aptr = Ab.access_ptr("rw", offset=100)
assert tvm.ir_pass.Equal(aptr.args[3], m * n - 100)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions