Skip to content

Refactor LUT fusion#9973

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test_899785919
Open

Refactor LUT fusion#9973
copybara-service[bot] wants to merge 1 commit intomasterfrom
test_899785919

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Refactor LUT fusion

This refactors the implementation of rewrite_subgraph_for_unary_lut to work more like fold_constants: it duplicates the entire graph, then removes the parts that are fused/folded from the main subgraph, and removes everything else from the duplicate. Then it executes the duplicate to implement constant folding or LUT generation.

This eliminates the need for clone_subgraph_subset. I've lately found myself fixing the tests for that often, and this approach doesn't need that extra utility or helper function.

This should also be faster (but the cost of this should generally be negligible anyways).

This refactors the implementation of `rewrite_subgraph_for_unary_lut` to work more like `fold_constants`: it duplicates the entire graph, then removes the parts that are fused/folded from the main subgraph, and removes everything else from the duplicate. Then it executes the duplicate to implement constant folding or LUT generation.

This eliminates the need for `clone_subgraph_subset`. I've lately found myself fixing the tests for that often, and this approach doesn't need that extra utility or helper function.

This should also be faster (but the cost of this should generally be negligible anyways).

PiperOrigin-RevId: 899785919
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