[PyTorch Edge] Eliminate non-determinism when generating build YAML file (#56539)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56539
It seems like a potential source of non-determinism when generating YAML files during the build stems from the fact that when we write out Python lists, they get written out in list order. This isn't a problem per-se, but if you look to see how these lists are generated, you'll see that they come from sets, which are inherently [not order preserving](https://stackoverflow.com/questions/1653970/does-python-have-an-ordered-set) in Python.
I can't guarantee that this removes non-determinism, but it removes all non-determinism that I know of so far. The surface area of codegen isn't sprawling, and the YAML file is generated by converting the object `toDict()` and passing it into the YAML serializer, so this should cover it (I think). Dictionaries are serialized in key order by pyyaml, so that's not a problem.
This could be releated to the elevated Android build times being seen [here](https://fb.workplace.com/groups/pytorch.edge.users/permalink/841622146708080/).
ghstack-source-id: 126987721
Test Plan: Build + Sandcastle.
Reviewed By: JacobSzwejbka
Differential Revision: D27893058
fbshipit-source-id: 6d7bcb09f34c05b71fbb4a0673bac1c4c33f23d7