MCPcopy Create free account
hub / github.com/apache/tvm / test_buffer_access_ptr_offset

Function test_buffer_access_ptr_offset

tests/python/tirx-base/test_tir_buffer.py:52–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51
52def test_buffer_access_ptr_offset():
53 m = tvm.tirx.SizeVar("m", "int32")
54 n = tvm.tirx.SizeVar("n", "int32")
55 Ab = tvm.tirx.decl_buffer((m, n), "float32")
56 aptr = Ab.access_ptr("rw", offset=100)
57 tvm.testing.assert_prim_expr_equal(aptr.args[2], 100)
58 assert aptr.args[4].value == Buffer.READ | Buffer.WRITE
59 v = tvm.tirx.SizeVar("int32", "int32")
60 aptr = Ab.access_ptr("rw", offset=100 + 100 + v)
61 tvm.testing.assert_prim_expr_equal(aptr.args[2], 200 + v)
62 assert aptr.args[4].value == Buffer.READ | Buffer.WRITE
63 aptr = Ab.access_ptr("rw", offset=tvm.tirx.call_extern("int32", "test_call", 100 + 100 + v))
64 tvm.testing.assert_prim_expr_equal(
65 aptr.args[2], tvm.tirx.call_extern("int32", "test_call", 200 + v)
66 )
67 assert aptr.args[4].value == Buffer.READ | Buffer.WRITE
68
69
70def test_buffer_access_ptr_extent():

Callers

nothing calls this directly

Calls 1

access_ptrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…