Questions about sparse field or pointer

Hello!

I am trying to explore the sparse field in taichi and here are two experiments that I have done to compare the memory usage difference between sparse field and dense field. But, it looks like that they don’t have any difference in terms of memory. Could someone help me figure out what happens? Do I use something wrong?

import taichi as ti
ti.init(arch=ti.cuda, debug=True)

ti_sparse_x = ti.field(ti.f32)
m_grid = ti.root.pointer(ti.ij, 4096 // 128)
m_block = m_grid.pointer(ti.ij, 128 // 16)
m_block.dense(ti.ij, 16).place(ti_sparse_x)

@ti.kernel
def set_sparse_x():
    for i, j in ti.ndrange(100, 100):
        ti_sparse_x[i, j] = i + j

@ti.kernel
def visit_sparse_x():
    ti.block_local(ti_sparse_x)
    print(ti_sparse_x[50, 10])

if __name__ == "__main__":
    m_grid.deactivate_all()
    set_sparse_x()
    for i in range(100000):
        visit_sparse_x()

The dense experiment:

import taichi as ti
ti.init(arch=ti.cuda, debug=True)

ti_dense_x = ti.field(ti.f32, shape=(4096, 4096))

@ti.kernel
def set_dense_x():
    for i, j in ti.ndrange(100, 100):
        ti_dense_x[i, j] = i + j

@ti.kernel
def visit_dense_x():
    print(ti_dense_x[50, 10])

if __name__ == "__main__":
    set_dense_x()
    for i in range(100000):
        visit_dense_x()

Thank you in advance!