[Pytorch Mobile] Remove caching (in code) of interned strings (#50390)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50390
Currently, there is a massive switch/case statement that is generated in the `InternedStrings::string()` method to speed up Symbol -> string conversion without taking a lock (mutex). The relative call rate of this on mobile is insignificant, so unlikely to have any material impact on runtime even if the lookups happen under a lock. Plus, parallelism is almost absent on mobile, which is where locks/mutexes cause the most problem (taking a mutex without contention is usually very fast and just adds a memory barrier iirc).
The only impact that caching interned strings has is avoiding taking a lock when interned strings are looked up. They are not looked up very often during training, and based on basic testing, they don't seem to be looked up much during inference either.
During training, the following strings were looked up at test startup:
```
prim::profile
prim::profile_ivalue
prim::profile_optional
prim::FusionGroup
prim::TypeCheck
prim::FallbackGraph
prim::ChunkSizes
prim::ConstantChunk
prim::tolist
prim::FusedConcat
prim::DifferentiableGraph
prim::MMBatchSide
prim::TensorExprGroup
```
Command used to trigger training: `buck test fbsource//xplat/papaya/client/executor/torch/store/transform/feature/test:test`
During inference, the only symbol that was looked up was `tolist`.
ghstack-source-id: 119679831
Test Plan:
See the summary above + sandcastle tests.
### Size test: fbios
```
D25861786-V1 (https://www.internalfb.com/intern/diff/D25861786/?dest_number=119641372)
fbios: Succeeded
Change in Download Size for arm64 + 3x assets variation: -13.9 KiB
Change in Uncompressed Size for arm64 + 3x assets variation: -41.7 KiB
Mbex Comparison: https://our.intern.facebook.com/intern/mbex/bsb:747386759232352@base/bsb:747386759232352@diff/
```
### Size test: igios
```
D25861786-V1 (https://www.internalfb.com/intern/diff/D25861786/?dest_number=119641372)
igios: Succeeded
Change in Download Size for arm64 + 3x assets variation: -16.6 KiB
Change in Uncompressed Size for arm64 + 3x assets variation: -42.0 KiB
Mbex Comparison: https://our.intern.facebook.com/intern/mbex/bsb:213166470538954@base/bsb:213166470538954@diff/
```
Reviewed By: iseeyuan
Differential Revision: D25861786
fbshipit-source-id: 34a55d693edc41537300f628877a64723694f8f0