Skip to content

Refactor FlexibleLayout to separate out "this stride can be changed" and "how this buffer is allocated can be changed"  #138280

@Chillee

Description

@Chillee

🚀 The feature, motivation and pitch

Currently, we have two layouts:

  • FixedLayout
  • FlexibleLayout

Where FixedLayout basically means "We already decided the layout, don't change it" while FlexibleLayout means "we are free to change this layout".

However, I think there are actually two different components of "decided this layout":

  1. What is the output stride of this layout?
  2. Who allocates the actual buffer for this tensor?

I believe conflating these causes some problems:

My proposal is that we scrap our current subclasses of Layout and refactor it into:

class Layout:
    stride: FlexibleStride or FixedStride
    allocator: NonOwningAllocator (view into another allocation) or Flexible or SymmMem

cc: @eellison @yifuwang @shunting314 @jansel

Alternatives

No response

Additional context

No response

cc @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo @ezyang @yf225 @chenyang78 @ColinPeppler @desertfire

Metadata

Metadata

Assignees

No one assigned

    Labels

    internal ramp-up taskTasks that are suitable for new folks w/ high-touch guidance from senior PyTorch folksmodule: inductoroncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions