Open justinchuby opened 2 months ago
Before this is created, I recommend using a key in the meta
dictionary to store this information. It is possible to create a helper function to interact with the dictionary. Replacing it with the new field when the field is implemented should be easy.
Another question is how we can make the field robust. Is there a lightweight pass we can run every time the graph is changed? Do we need to create any invariance on this field?
cc @gramalingam
I came up with a new idea for this. It may be helpful to create an auxiliary data structure for this, rather than making it a field in values since it is more usage specific. Consider a data structure with these apis:
mark_equivalence(value_1, value_2)
and mark_equivalence(value_1, [<sequence of values>])
Establishes that two values are equivalentunmark_equivalence(value_1, value_2)
breaks the equivalence relationshipassign(value, ir.Tensor)
binds a constant tensor to a value, and internally also binds it to all values that share the equivalence relationare_equivalent(value_1, value_2)
returns whether two values are the sameThis way it is very easy to establish and manage equivalence relationships. Internally it can be represented as a tree like structure.
Create a field in Value to support representing equivalence relations among values.
+0