[jit] Reclaim some binary size. (#68038)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68038
Replace const std::function& to c10::function_ref because the former uses type erasure and adds 5-10 KB size overhead and adds another level of indirection to call the underlying functions. In contrast a non-owning c10::function_ref will just compile down to a raw function pointer which should be much smaller.
ghstack-source-id: 146670523
Test Plan: eyes
Reviewed By: iseeyuan, mrshenli
Differential Revision: D32264619
fbshipit-source-id: 558538fd882b8e1f4e72c4fd5e9d36d05f301e1e