mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Cleanup since FEATURE_TORCH_MOBILE is always true. (#55835)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55835 Now that https://github.com/pytorch/pytorch/pull/55238 is landed for a week and no complains. It seems safe to say FEATURE_TORCH_MOBILE is always true and we can do some cleanup. Test Plan: Imported from OSS Reviewed By: ezyang, walterddr Differential Revision: D27721284 Pulled By: ailzhang fbshipit-source-id: 4896bc5f736373d0922cfbe8eed0d16df62f0fa1
This commit is contained in:
parent
8188d18f8d
commit
1688a5d31a
|
|
@ -33,7 +33,6 @@ header_template_rule(
|
|||
out = "c10/macros/cmake_macros.h",
|
||||
substitutions = {
|
||||
"cmakedefine": "define",
|
||||
"#define FEATURE_TORCH_MOBILE": "/* #undef FEATURE_TORCH_MOBILE */",
|
||||
"#define C10_USE_NUMA": "/* #undef C10_USE_NUMA */",
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -511,7 +511,6 @@ if(INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
|
|||
set(BUILD_PYTHON OFF)
|
||||
set(BUILD_CAFFE2_OPS OFF)
|
||||
set(USE_DISTRIBUTED OFF)
|
||||
set(FEATURE_TORCH_MOBILE ON)
|
||||
set(NO_API ON)
|
||||
set(USE_FBGEMM OFF)
|
||||
set(USE_QNNPACK OFF)
|
||||
|
|
|
|||
|
|
@ -3,12 +3,6 @@
|
|||
namespace at {
|
||||
namespace impl {
|
||||
|
||||
/// thread_local is a feature that is not enabled by Caffe2 mobile
|
||||
/// build (e.g. iOS). Therefore, we only provide `at::VmapMode`
|
||||
/// when we are not in mobile build or when FEATURE_TORCH_MOBILE
|
||||
/// is on.
|
||||
#if !defined(C10_MOBILE) || defined(FEATURE_TORCH_MOBILE)
|
||||
|
||||
thread_local int64_t VmapMode_current_vmap_level = 0;
|
||||
|
||||
int64_t VmapMode::current_vmap_level() {
|
||||
|
|
@ -30,22 +24,5 @@ int64_t VmapMode::decrement_nesting() {
|
|||
}
|
||||
return VmapMode_current_vmap_level;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int64_t VmapMode::current_nesting_level() {
|
||||
TORCH_CHECK(false, "VmapMode is not supported on mobile");
|
||||
}
|
||||
|
||||
int64_t VmapMode::increment_nesting() {
|
||||
TORCH_CHECK(false, "VmapMode is not supported on mobile");
|
||||
}
|
||||
|
||||
int64_t VmapMode::decrement_nesting() {
|
||||
TORCH_CHECK(false, "VmapMode is not supported on mobile");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace impl
|
||||
} // namespace at
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@
|
|||
|
||||
namespace at {
|
||||
|
||||
/// thread_local is a feature that is not enabled by Caffe2 mobile
|
||||
/// build (e.g. iOS). Therefore, we only provide `at::GradMode`
|
||||
/// when we are not in mobile build or when FEATURE_TORCH_MOBILE
|
||||
/// is on.
|
||||
#if !defined(C10_MOBILE) || defined(FEATURE_TORCH_MOBILE)
|
||||
|
||||
thread_local bool GradMode_enabled = true;
|
||||
|
||||
bool GradMode::is_enabled() {
|
||||
|
|
@ -19,17 +13,4 @@ bool GradMode::is_enabled() {
|
|||
void GradMode::set_enabled(bool enabled) {
|
||||
GradMode_enabled = enabled;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool GradMode::is_enabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void GradMode::set_enabled(bool enabled) {
|
||||
throw std::runtime_error("GradMode::set_enabled is not supported on mobile");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace at
|
||||
|
|
|
|||
|
|
@ -7,13 +7,10 @@
|
|||
|
||||
#include <c10/macros/Macros.h>
|
||||
|
||||
#if !defined(C10_MOBILE) || defined(FEATURE_TORCH_MOBILE)
|
||||
#include <ATen/core/aten_interned_strings.h>
|
||||
#endif
|
||||
|
||||
namespace c10 {
|
||||
|
||||
#if !defined(C10_MOBILE) || defined(FEATURE_TORCH_MOBILE)
|
||||
#define FORALL_NS_SYMBOLS(_) \
|
||||
_(namespaces, prim) \
|
||||
_(namespaces, aten) \
|
||||
|
|
@ -425,19 +422,6 @@ namespace c10 {
|
|||
_(attr, cache_id) \
|
||||
_(attr, new_axis) \
|
||||
_(attr, warn_id)
|
||||
#else
|
||||
#define FORALL_NS_SYMBOLS(_) \
|
||||
_(namespaces, prim) \
|
||||
_(namespaces, aten) \
|
||||
_(namespaces, cuda) \
|
||||
_(namespaces, onnx) \
|
||||
_(namespaces, attr) \
|
||||
_(namespaces, scope) \
|
||||
_(namespaces, user) \
|
||||
_(namespaces, _caffe2) \
|
||||
_(namespaces, dimname) \
|
||||
_(namespaces, namespaces)
|
||||
#endif
|
||||
|
||||
// 'prim' symbols are synthetic operators that occur only in the IR
|
||||
// and don't have corresponding implementations in ATen.
|
||||
|
|
|
|||
|
|
@ -10,9 +10,4 @@
|
|||
#cmakedefine C10_USE_NUMA
|
||||
#cmakedefine C10_USE_MSVC_STATIC_RUNTIME
|
||||
|
||||
// Used by libtorch mobile build to enable features that are not enabled by
|
||||
// caffe2 mobile build. Should only use it when necessary as we are committed
|
||||
// to converging libtorch and caffe2 mobile builds and removing it eventually.
|
||||
#cmakedefine FEATURE_TORCH_MOBILE
|
||||
|
||||
#endif // C10_MACROS_CMAKE_MACROS_H_
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user