Skip to content

Implement a detensoring pass for HLO #3139

Closed

Description

@benvanik

HLO treats all values as tensors which is suboptimal for things like loop iterators and conditions controlling program flow. Not only is it additional overhead (allocations/metadata storage/etc) but also introduces host/device round trips when the values are used for host functionality (control flow, array indexing, etc). We should be able to aggressively convert HLO ops on scalar tensors into standard ops on primitives in a lot of these cases, even without any sophisticated analysis for tracking usage. The goal is to try to reduce the total number of readbacks (flow.tensor.load) and keep as much simple computation as possible on the host by avoiding tensors.

(details TBD)

Activity

  1. added
    enhancement ➕
    compiler/dialects
    on Sep 14, 2020
  2. added this to the milestone on Sep 14, 2020
  3. silvasean commented on Oct 1, 2020

    @silvasean
    Contributor

    Please ping me when this shows up on the profile. I have the design sketched out in some detail, and am happy to implement it.

  4. benvanik commented on Oct 1, 2020

    @benvanik
    CollaboratorAuthor

    I think it really depends on whether we have a tf.while - if we do, we'll need it (so that we aren't computing a loop iterator increment asynchronously). Will update this issue with IR when we have it!

  5. benvanik commented on Oct 2, 2020

    @benvanik
    CollaboratorAuthor

    Looks like mobilebert is entirely unrolled (lame!) - so we don't need it for that - but any model we aren't trying to also run in tflite really should not be unrolled and then we'll need it. Would be really good to get done in q4 so we stop having to worry about it, but not blocking.

  6. benvanik commented on Nov 22, 2020

    @benvanik
    CollaboratorAuthor

    Duping with #1159.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler/dialectsenhancement ➕

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions