# Gridtools: Optimize the Layout for the sid::composite Strides ###### tags: `betting-archive` shaper: Anton ## Appetite half a cycle ## Context In C++ based backend the data is passed to the kernels using `sid::composite` (each composite contains multiple `SID`'s in it and also acts as singe giant `SID`) Strides and pointer holder of the composite are the actual structures that are passed to the kernel. Additionally composite pointer and in some backends pointer diference is instatiated within the kernel. Simplifying a bit, `composite strides` is a tuple of tuples. Each element of the innermost tuple can have different `sizeof`. Gridtools tuple does empty base optimization. That means that the virtual `sizeof` of some elements can be even zero. At the end `comosite strides` can have some paddings in it. The same is applied to the pointer and the pointer holder. ## Idea We can change the order within the tuples inside the strides to minimize the total size of paddings. Obviously all reordering should be done in compile time. We should measure if that optimization has practical effect.