pytorch/tools/codegen
Dhruv Matani 594c546b69 [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
2021-04-20 17:26:14 -07:00
..
api split out NamedCType from CType. Remove direct string comparison from autograd codegen (#55334) 2021-04-16 11:43:08 -07:00
dest split out NamedCType from CType. Remove direct string comparison from autograd codegen (#55334) 2021-04-16 11:43:08 -07:00
selective_build [PyTorch Edge] Eliminate non-determinism when generating build YAML file (#56539) 2021-04-20 17:26:14 -07:00
__init__.py
code_template.py
context.py Un-ignore F403 in .flake8 (#55838) 2021-04-13 09:24:07 -07:00
gen.py add C++ namespacing logic to ctypes (#55047) 2021-04-16 11:43:06 -07:00
local.py Remove use_c10_dispatcher option (#54969) 2021-03-31 16:24:24 -07:00
model.py Port all unary float functions to structured (#56082) 2021-04-15 16:06:42 -07:00
utils.py Split anonymous and namespaced definitions in RegisterDispatchKey (#51585) 2021-02-04 09:19:41 -08:00