[pytorch][nnc] protocol classes to persist the context for compiled functions (#56851)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56851
This is part of the changes to enable NNC AOT compilation for mobile.
At the end of the ahead-of-time compilation the compiler produces two sets of artifacts:
1. "compiled assembly code" - kernel functions in assembly format optimized for target platforms;
2. "compiled model" - regular TorchScript model that contains serialized parameters (weights/bias/etc) and invokes kernel functions via "handles" (name/version id/input & output specs/etc of the kernel functions).
This PR introduces a set of classes to represent kernel functions (a.k.a "handles"), which can be serialized/deserialized into/from the "compiled model" as an IValue.
Also introduces APIs to register/look-up "compiled assembly code".
ghstack-source-id: 128285802
Test Plan:
- unit tests
- for FB build environment:
buck test //caffe2/test/mobile/nnc:mobile_nnc
Reviewed By: kimishpatel, raziel
Differential Revision: D27921866
fbshipit-source-id: 4c2a4d8a4d072fc259416ae674b3b494f0ca56f3