Skip to content

Consider removing window_reversal from ConvolutionOp #1181

Open

Description

@burmako

I've recently realized that I'm not sure if window_reversal is actually used by frontends. E.g. JAX doesn't use it, and cursory inspection of TF/XLA suggests that it doesn't use it either. If that checks out, we should remove it from the spec to make things simpler. Related issue for ReduceWindowOp: #585.

Activity

  1. loganchien commented on Feb 24, 2023

    @loganchien

    AFAIK, window_reversal is being used in the lowering of transposed convolution.

  2. sdasgup3 commented on Mar 8, 2023

    @sdasgup3
    Member

    Thanks @loganchien for the valuable input. We will take that into account.

  3. loganchien commented on Mar 8, 2023

    @loganchien

    Conceptually, Transposed Convolution (a.k.a. Deconvolution, Conv2dBackpropInput, tf.nn.atrous_conv2d) is the inverse of Convolution. Its computation can be translated into Conv(x, Reverse(filter)).

    TF2Xla implement this logic by inserting a RevOp:

    https://github.com/tensorflow/tensorflow/blob/59fc820f7d6383e38ce302e1b94afbb49a0a26b6/tensorflow/compiler/tf2xla/kernels/conv_op_helpers.cc#L376

    For the project I am working on, we mainly focus on inference, thus RevOp(filter) can be further fold into a constant filter', thus we don't need window_dilation.

    I am not sure if there are other use cases that we prefer tweaking the filter memory access pattern to a separate RevOp.

  4. sdasgup3 commented on Mar 8, 2023

    @sdasgup3
    Member

    Thanks @loganchien for the findings and confirming the current status. That's very useful!

  5. sdasgup3 commented on Mar 21, 2023

    @sdasgup3
    Member

    Update: We confirmed that none of the front-ends (TF/Jax/PyTorch), producing StableHLO, are using the window_reversal and it could be safe to remove from StableHLO ops ConvolutionOp and DynamicConvOp.

    I will further update the ticket with the process of removal.

  6. sdasgup3 commented on Mar 23, 2023

    @sdasgup3
    Member

    update: We now have an RFC to remove window_reversal from ConvolutionOp.
    #1346

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

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions