pytorch
051ea5cc - [Static Runtime] Bundle function & function_kind to carry them together (#66974)

Commit
4 years ago
[Static Runtime] Bundle function & function_kind to carry them together (#66974) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/66974 `D31591785 (https://github.com/pytorch/pytorch/commit/67e003f09bd1c2a578ee0e48ed1314e69a8ca115)` started carrying a function object to be executed and `FunctionKind` for the type of the function *separately*, and this caused a bug fixed by D31783028 (https://github.com/pytorch/pytorch/commit/79803b199f3d475eae88cf13bff81476c22aea6e). This change bundles them as it was before done by swolchok to reduce the chances of such a mistake in the future. They need to be carried altogether always since `FunctionKind` identifies the type of the function object. Note that `struct Function` is a POD type, so accessing its field (first, second) shouldn't cause an extra overhead in `ProcessedNode::run()`. Test Plan: Confirmed that the managed memory metics remain the same before/after this diff on inline_cvr: ``` #AFTER # inline_cvr/local Total number of managed tensors: 2660 Total number of managed output tensors: 0 Total number of unmanaged values: 3041 Total memory managed: 1496896 bytes Total number of reused tensors: 1183 Total number of 'out' variant nodes/total number of nodes: 2452/2469 (99.3115%) # inline_cvr/local_ro Total number of managed tensors: 1412 Total number of managed output tensors: 0 Total number of unmanaged values: 2679 Total memory managed: 39040 bytes Total number of reused tensors: 959 Total number of 'out' variant nodes/total number of nodes: 1928/1939 (99.4327%) # inline_cvr/remote_ro First iter time: 12.0344 ms Total number of managed tensors: 1293 Total number of managed output tensors: 0 Total number of unmanaged values: 14 Total memory managed: 5293824 bytes Total number of reused tensors: 771 Total number of 'out' variant nodes/total number of nodes: 1298/1298 (100%) ``` ``` #BEFORE # inline_cvr/local Total number of managed tensors: 2660 Total number of managed output tensors: 0 Total number of unmanaged values: 3041 Total memory managed: 1496896 bytes Total number of reused tensors: 1183 Total number of 'out' variant nodes/total number of nodes: 2452/2469 (99.3115%) #inline_cvr/local_ro Total number of managed tensors: 1412 Total number of managed output tensors: 0 Total number of unmanaged values: 2679 Total memory managed: 39040 bytes Total number of reused tensors: 959 Total number of 'out' variant nodes/total number of nodes: 1928/1939 (99.4327%) #inline_cvr_remote_ro Total number of managed tensors: 1293 Total number of managed output tensors: 0 Total number of unmanaged values: 14 Total memory managed: 5293824 bytes Total number of reused tensors: 771 Total number of 'out' variant nodes/total number of nodes: 1298/1298 (100%) ``` Reviewed By: mikeiovine Differential Revision: D31798419 fbshipit-source-id: fd4301b6731e402be0820729654735c791511aba
Author
Parents
Loading