Trace tooling serializes FakeTensor storage metadata to JSON. When the
storage size is a hinted SymInt, the trace can have both useful pieces of
information:
- the symbolic storage expression, which preserves provenance for downstream
trace consumers; - the optimization hint, which gives diagnostic/policy tooling a concrete
expected extent when one was explicitly provided.
Keep the existing size field symbolic for symbolic storage sizes and add a
separate size_hint field only when every free symbol in the storage-size
expression has an explicit optimization hint override. This preserves the
existing symbolic trace contract while exposing concrete policy metadata
without specializing tensor shapes or changing runtime semantics.
Fixes #183835
Test Plan:
python test/test_fake_tensor.py FakeTensorTest.test_meta_storage_trace_uses_hint_for_symbolic_size -q
lintrunner --config=.lintrunner.toml torch/_subclasses/meta_utils.py test/test_fake_tensor.py
Pull Request resolved: #183839
Approved by: https://github.com/ezyang, https://github.com/laithsakka
SOCIAL SHARE CARD GENERATOR