pytorch
62909fac - [jit] Decouple ivalue.h from jit_type.h (#70119)

Commit
2 years ago
[jit] Decouple ivalue.h from jit_type.h (#70119) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/70119 JIT type and IValue have a mutual dependency because of various reasons today. It makes things worse when we have `jit_type.h` and `ivalue.h` mutually include each other, causing non deterministic name resolutions at different translation units, preventing us safely use symbols from `jit_type.h` in `ivalue.h` . This diff doesn't address the mutual dependency between JIT type and IValue at linking level, but at header level. We choose to remove include of `ivalue.h` from `jit_type.h` because it's way harder to make a type-free header for IValue. The way we achieve this is by removing EnumType (which is the only type depending on IValue in JIT types) from `jit_type.h`, and let downstream users to specifiy an explicit `enum_type.h` as needed. We also move some IValue inline member function definitions back to `ivalue_inl.h` so that `jit_type.h` doesn't need IValue definition to be present. We also remove a seemingly accidental include of `jit_type.h` from `ATen/core/List_inl.h` so that `ivalue.h` can include `jit_type.h` directly, otherwise due to another mutual inclusion between `ivalue.h` and `List_inl.h` we can still get nondeterministic behavior. ghstack-source-id: 146727333 (Note: this ignores all push blocking failures!) Test Plan: no behavior change. Reviewed By: gmagogsfm Differential Revision: D33155792 fbshipit-source-id: d39d24688004c2ec16c50dbfdeedb7b55f71cd36
Author
Parents
Loading