hexagon: shared strided DMA copy for CPY and CONCAT, any-dim CONCAT via DMA
The Issue & Context
Previously, concatenation of tensors along dimension 1 was optimized using DMA, but concatenation along other dimensions or with various dense layouts relied on slower scalar copy paths.
Root Cause Analysis
The existing implementation only supported DMA-based concatenation for dim-1 contiguous tensors, causing inefficient CPU-bound copies for other concat dimensions and layouts.
Solution Strategy & Architectural Pattern
Introduced shared strided DMA copy functions enabling concatenation along any dimension for tensors dense in dim 0, moving common DMA utilities to a shared header and achieving significant runtime reductions on Snapdragon 8 Elite Gen5.
Key Takeaway for Contributors
Leveraging strided DMA for multi-dimensional tensor operations can drastically improve performance on specialized hardware, and consolidating shared functionality simplifies maintenance and future enhancements.