mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Consistently use c10_ovrsource in arvr mode everywhere (#164128)
Summary: Previously, many arvr targets transitively depended on c10, not c10_ovrsource, because they either explicitly depended on c10 (because they didn't know better) or they depended on legacy Caffe2, which never got the ovrsource treatment. So we found all these spots (driven by D82283623) and forced them to query arvr mode to figure out which one they should use. The goal is you NEVER have both targets in the same build rule at the same time. This diff could be reverted if D82224960 works out but I haven't gotten it to work yet. Test Plan: sandcastle Reviewed By: EscapeZero Differential Revision: D82390436 Pull Request resolved: https://github.com/pytorch/pytorch/pull/164128 Approved by: https://github.com/albanD, https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
b5d4d350f5
commit
efd7fd5ed5
@ -156,7 +156,7 @@ ROOT = "//" if IS_OSS else "//xplat/caffe2"
|
||||
# for targets in subfolders
|
||||
ROOT_PATH = "//" if IS_OSS else "//xplat/caffe2/"
|
||||
|
||||
C10 = "//c10:c10" if IS_OSS else "//xplat/caffe2/c10:c10"
|
||||
C10 = "//c10:c10" if IS_OSS else ("//xplat/caffe2/c10:c10_ovrsource" if is_arvr_mode() else "//xplat/caffe2/c10:c10")
|
||||
|
||||
# a dictionary maps third party library name to fbsource and oss target
|
||||
THIRD_PARTY_LIBS = {
|
||||
|
@ -16,11 +16,21 @@ cuda_supported_platforms = [
|
||||
"ovr_config//os:windows-cuda",
|
||||
]
|
||||
|
||||
# rocktenn apparently has its own copy of glog that comes with libmp.dll, so we
|
||||
# had better not try to use glog from c10 lest the glog symbols not be eliminated.
|
||||
C10_USE_GLOG = native.read_config("c10", "use_glog", "1") == "1"
|
||||
|
||||
# If you don't use any functionality that relies on static initializer in c10 (the
|
||||
# most notable ones are the allocators), you can turn off link_whole this way.
|
||||
# In practice, this is only used by rocktenn as well.
|
||||
C10_LINK_WHOLE = native.read_config("c10", "link_whole", "1") == "1"
|
||||
|
||||
def define_c10_ovrsource(name, is_mobile):
|
||||
pp_flags = []
|
||||
if is_mobile:
|
||||
pp_flags = ["-DC10_MOBILE=1"]
|
||||
else:
|
||||
pp_flags = []
|
||||
pp_flags.append("-DC10_MOBILE=1")
|
||||
if C10_USE_GLOG:
|
||||
pp_flags.append("-DC10_USE_GLOG")
|
||||
|
||||
oxx_static_library(
|
||||
name = name,
|
||||
@ -31,6 +41,7 @@ def define_c10_ovrsource(name, is_mobile):
|
||||
"util/*.cpp",
|
||||
]),
|
||||
compatible_with = cpu_supported_platforms,
|
||||
link_whole = C10_LINK_WHOLE,
|
||||
compiler_flags = select({
|
||||
"DEFAULT": [],
|
||||
"ovr_config//compiler:cl": [
|
||||
@ -77,6 +88,7 @@ def define_c10_ovrsource(name, is_mobile):
|
||||
"//arvr/third-party/gflags:gflags",
|
||||
"//third-party/cpuinfo:cpuinfo",
|
||||
"//third-party/fmt:fmt",
|
||||
# For some godforsaken reason, this is always required even when not C10_USE_GLOG
|
||||
"//third-party/glog:glog",
|
||||
],
|
||||
)
|
||||
|
Reference in New Issue
Block a user