[jit] Fix value association with dictionaries in the tracer (#40885)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/40885
`TracingState::setValue` associates a concrete IValue in the traced
program with a `Value*` symbolic. Previously, the logic for how
GenericDicts worked was special cased to only work for very simple cases
and silently eat other cases.
This PR generalizes the logic to reflect the same behavior as using
dictionaries on input: whenever we encounter a dictionary in the system,
we completely "burn in" all the keys into the graph, and then
recursively call `setValue` on the associated value.
This has the effect of requiring that any dictionary structure you are
creating in a traced program be of fixed structure, similar to how any
dictionary used as input must be static as well.
Test Plan: Imported from OSS
Differential Revision: D22342490
Pulled By: suo
fbshipit-source-id: 93e610a4895d61d9b8b19c8d2aa4e6d57777eaf6