SIGN IN SIGN UP

[ET-VK][ez] Improve insert_prepack_node pass to handle multiple uses of constant tensors (#10488)

## Context

Refer to #6352 for why the `insert_prepack_nodes` pass is needed.

The current logic of the pass assumes that each constant tensor node has only one use. However, in reality, a constant tensor node may have multiple uses; some of which may require the insertion of a prepacking node and some which may not (since they may choose to apply some special packing in the operator implementation).

Currently, if any uses of a constant tensor node handles its own prepacking, then prepacking nodes will not be inserted. This makes it so that a model will produce a type error during runtime when an operator receives a `TensorRef` but expects a `Tensor`.

## Changes

Improve the logic of the pass to handle constant tensor nodes which have multiple uses. If any use does not handle its own prepacking, then a prepacking node will be inserted for those usages.

Differential Revision: [D73592619](https://our.internmc.facebook.com/intern/diff/D73592619/)
P
pytorchbot committed
e7fb2bdb5497cd31e90a40a0e1b191833b115869
Parent: b669184
Committed by GitHub <noreply@github.com> on 4/25/2025, 7:09:38 PM