Skip to content

Stateful hal.command_buffer canonicalizations/redundant op tracing #1155

Closed as not planned

Description

@benvanik

Whether these are implemented using canonicalizers, a pass, or a utility in ConvertStreamOps is TBD, but basically we want to look at the hal.command_buffer.* methods and remove the ones that are redundant, including ops like hal.command_buffer.push_constants, hal.command_buffer.push_descriptor_set, hal.command_buffer.execution_barrier, etc.

This will allow us to emit more verbose (and correct) IR during transformation and ease the process of stream formation across basic blocks which is effectively similar to inlining in that can merge IR that came from separate places late in the process.

The goal is to emit only the ops that we know we need and no more, which will reduce module size (fewer ops), runtime execution overhead (fewer HAL export calls across VM/C++), driver API overhead (fewer calls to Vulkan functions), etc.

Activity

  1. added
    compiler/dialects
    enhancement ➕
    good first issue 🌱
    on Mar 19, 2020
  2. added this to the milestone on May 12, 2020
  3. modified the milestones: , on Sep 12, 2020
  4. removed this from the milestone on Nov 22, 2020
  5. benvanik commented on Aug 30, 2021

    @benvanik
    CollaboratorAuthor

    This would be implemented with DFA to track at each use of the command buffer what the assumptions on its internal state can be. Needs to support going through control flow.

  6. benvanik commented on Nov 15, 2021

    @benvanik
    CollaboratorAuthor

    A few bits of this have grown recently in iree/compiler/Dialect/HAL/Transforms/ElideRedundantCommands.cpp - it's not fantastic but can do peephole elision. It'll be more effective to spend time on reducing our unique binding/layout setup (#3502) over something specific to this.

  7. added this to IREE Codegen and removed this from IREE Codegenon May 2, 2022
  8. benvanik commented on Jul 1, 2022

    @benvanik
    CollaboratorAuthor

    #3502 covers the most common cases of this.

  9. moved this to Done in IREEon Jul 1, 2022
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 ➕good first issue 🌱

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions