Skip to content

Add DecomposeDataflowPass to flatten compound data types.#4138

Draft
copybara-service[bot] wants to merge 1 commit intomainfrom
test_902695281
Draft

Add DecomposeDataflowPass to flatten compound data types.#4138
copybara-service[bot] wants to merge 1 commit intomainfrom
test_902695281

Conversation

@copybara-service
Copy link
Copy Markdown

Add DecomposeDataflowPass to flatten compound data types.

This pass transforms IR by replacing operations on arrays and tuples with equivalent operations on their individual leaf elements (bits or empty tuples). This is achieved by using a dataflow visitor that tracks the decomposition of compound types.

Key transformations include:

  • Replacing array/tuple operations like ArrayIndex, ArrayUpdate, ArraySlice, ArrayConcat, TupleIndex with equivalent logic using Selects and operations on leaf elements.
  • Decomposing operands of higher-order operations like Invoke, Map, CountedFor, Send, and Next.
  • Handling Select, PrioritySelect, and OneHotSelect by reconstructing them on the decomposed leaf elements.

This pass is intended for development and testing purposes, allowing analysis and optimization on a flattened representation of the IR.

Also, add a CloneSelectLike method to GenericSelect to facilitate creating new select-like nodes with different selectors.

This pass transforms IR by replacing operations on arrays and tuples with equivalent operations on their individual leaf elements (bits or empty tuples). This is achieved by using a dataflow visitor that tracks the decomposition of compound types.

Key transformations include:
-   Replacing array/tuple operations like ArrayIndex, ArrayUpdate, ArraySlice, ArrayConcat, TupleIndex with equivalent logic using Selects and operations on leaf elements.
-   Decomposing operands of higher-order operations like Invoke, Map, CountedFor, Send, and Next.
-   Handling Select, PrioritySelect, and OneHotSelect by reconstructing them on the decomposed leaf elements.

This pass is intended for development and testing purposes, allowing analysis and optimization on a flattened representation of the IR.

Also, add a `CloneSelectLike` method to `GenericSelect` to facilitate creating new select-like nodes with different selectors.

PiperOrigin-RevId: 902695281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant