Skip to content

Basic implementation of Matrix-free BwdTrans and padding feature in Field

This matrix-free BwdTrans implementation supports all shape types, any number of elements, and SIMD.

A new padding feature is also added to the Field class.

  • First, GetBlockAttrb() computes num_padding_elements according to the vector width and the block_size will include paddings as well.
  • Then Field::create() allocates m_stroage based on block_size, which is large enough for later use. Align is also set here.
  • By default, the newly created Field is marked as m_curVecWidth = 1, which means no interleave. There will be unused memory (num_padding_elements * num_pts) at the end of each block. Make sure you don't access them accidentally. For example, in StdMat implementation, to move to the next block, we should use inptr += block_size instead of inptr += num_pts * num_elements.
  • ReshapeStorage() will change the storage layout to other widths, but not great than the initial width. Usually, we only need to transform between scalar and vec_t::width.

The simple CTest case (requiring padding) works.

Edited by BOYANG XIA

Merge request reports

Loading