ColossalAI icon indicating copy to clipboard operation
ColossalAI copied to clipboard

[FEATURE]: Implement LayoutConverter

Open YuliangLiu0306 opened this issue 2 years ago • 0 comments

Describe the feature

LayoutConverter mainly has three main functions:

  1. Search an efficient transform path for the given pair of source_layout and target_layout.
  2. Estimate the converting cost for the given pair of source_layout and target_layout.
  3. Apply the layout converting path to redistribute a tensor from source_layout to target_layout.

To search the transform path, we use a heuristic algorithm which could be simplily describe as:

  • Step1: Generate all one-step transform sequences from source_layout.
  • Step2: Pick the 'best' layout following the heuristic function.
  • Step3: Repeat above steps until the source layout transform to target layout.

To estimate the total converting cost, we implement a method to estimate the communication cost of each communication operation under the instruction of CommSpec. Then, we just need sum the costs of CommSpec in the transform_sequence up to get the total converting cost.

YuliangLiu0306 avatar Mar 09 '23 05:03 YuliangLiu0306