Move at::{Refcounted,}MapAllocator to c10 (#109881)

`libshm.so` depends on the torch library exclusively for `at::RefcountedMapAllocator`,
 so it makes sense to move it to c10 along with the other memory allocators.

This means `libshm.so` only depends on `c10` and we don't need to relink
`libshm.so` for every ATen change.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/109881
Approved by: https://github.com/albanD
This commit is contained in:
Peter Bell
2023-10-11 19:56:58 +00:00
committed by PyTorch MergeBot
parent 42b89aea4b
commit 68a1219f74
18 changed files with 1161 additions and 799 deletions

View File

@ -14,6 +14,7 @@ cxx_library(
"//third_party:cpuinfo",
"//third_party:fmt",
"//third_party:glog",
"//third_party:rt",
],
exported_deps = [],
compiler_flags = [
@ -44,7 +45,12 @@ cxx_library(
header_namespace = "c10",
link_whole = True,
platform_preprocessor_flags = [['windows', ['-D_WINDOWS', '-D_WIN32', '-DWIN32', '-DNOMINMAX', '-D_CRT_SECURE_NO_WARNINGS', '-D_USE_MATH_DEFINES']], ['windows.*64$', ['-D_WIN64']]],
preprocessor_flags = ['-DC10_BUILD_MAIN_LIB'],
preprocessor_flags = [
'-DC10_BUILD_MAIN_LIB',
'-DHAVE_MMAP=1',
'-DHAVE_SHM_OPEN=1',
'-DHAVE_SHM_UNLINK=1',
],
reexport_all_header_dependencies = True,
visibility = ['PUBLIC'],
)