serialize all c++ frontend modules to a single CU. (#23645)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23645
Previously, every module would get its own CompilationUnit when saving
from the C++ frontend. That's bad because nothing checks that they have
uniquely qualified names or mangles them to make them unique.
This was okay when we were doing model.json, but once we serialize
modules like classes this will cause an error on import (when we try to
re-define the same class a bunch of times.
Test Plan: Imported from OSS
Differential Revision: D16597709
Pulled By: suo
fbshipit-source-id: 0412efd5acfcac26d03f6ed5b5a7dfc023163bc3