The .contiguous().transpose() dance was swapping dims back. A single transpose from (g,k,mn) gives (g,mn,k) with stride(-2)=1, which is exactly the MN-major layout TMA expects.
The .contiguous().transpose() dance was swapping dims back. A single transpose from (g,k,mn) gives (g,mn,k) with stride(-2)=1, which is exactly the MN-major layout TMA expects.