Skip to content

Spec the behavior of select in SelectAndScatterOp #731

Open

Description

@sdasgup3

Request description

Problem what happens if the entire window of the reduce_window phase of select_and_scatter consists of padding values?

Specifically, per the spec
what is going to the behavior of selected_values = reduce_window_without_init(...) when the data consists of only padding values.

Ideally, The expected outcome sould be selected_values = []. But reduce_window_without_init does not convey that clearly.

A suggestion:

As per the hlo implementation of SelectAndScatter,
this is the callback function which is used to go through every valid operand index and book-keep the most updated selection based on the operand indices seen so far.

As expected, in case where there is no valid index, the above callback is never applied, leaving the result of selection empty.

One of the challenges that I found is: for the case of selectAndScatter we define reduce_window_without_init saying that it is based on reduce_window, but the reduce_window's spec relies very much on "init_values" and thereby, it might be hard to imagine how the _withpout_init version would look like.

How about we define selectAndScatter using reduce_without_init: Including just the valid indices in a window and applying reduce_without_init on that. The valid indices will be along this line.

Activity

  1. changed the title [-]Revisit the spec for SelectAndScatter[/-] [+]Revisit the behavior of select in SelectAndScatterOp[/+] on Dec 9, 2022
  2. changed the title [-]Revisit the behavior of select in SelectAndScatterOp[/-] [+]Spec the behavior of select in SelectAndScatterOp[/+] on Dec 9, 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

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions