Relationship between `NDBuffer` and `LayoutTensor`

What is the relationship between NDBuffer and LayoutTensor? Most of the MAX AI kernels seem to use NDBuffer, but the kernel puzzles seem to prefer LayoutTensor. From my understanding of LayoutTensor, it’s a type designed to facilitate multi-dimensional indexing (but it carries a pointer to some underlying buffer).

How do the MAX AI kernels handle indexing? Is the idea that these will be updated to use LayoutTensor? Or perhaps many of them can’t operate on the underlying NDBuffer without worrying about indexing.

IIUC, NDBuffer is on its way out. Let’s summon @Lukas for more details.

As Sora said, NDBuffer is a legacy type and I’m in the process of migrating our kernels to LayoutTensor. Some of that work is bound on needing to make improvements to the latter though.

3 Likes