From ee1c4326205499bde8b4aae3b2279422738b909b Mon Sep 17 00:00:00 2001 From: Bin Bao Date: Fri, 11 Apr 2025 06:05:09 -0700 Subject: [PATCH] Remove C10_DEPRECATED Summary: X-link: https://github.com/pytorch/pytorch/pull/151058 Revive https://github.com/pytorch/pytorch/pull/138406. In additional to the original code, fixed internal test failures and completely removed c10/util/Deprecated.h. Summary from the original PR, ``` Looking in the code I see // NB: __cplusplus doesn't work for MSVC, so for now MSVC always uses // the "__declspec(deprecated)" implementation and not the C++14 // "[[deprecated]]" attribute. We tried enabling "[[deprecated]]" for C++14 on // MSVC, but ran into issues with some older MSVC versions. But looking at the MSVC C++ support table I see that the [[deprecated]] attribute is supported as of MSVC 2015 and that the vast majority of C++17 features became supported in MSVC 2015 or later. Since PyTorch is C++17 now, I infer that PyTorch must not support versions of MSVC earlier than MSVC 2015, so the versions of MSVC supported by PyTorch must support [[deprecated]]. Therefore, since we are finished deprecating old MSVCs we can deprecate C10_DEPRECATED. ``` Differential Revision: D72762767 --- fbgemm_gpu/include/fbgemm_gpu/utils/tensor_accessor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fbgemm_gpu/include/fbgemm_gpu/utils/tensor_accessor.h b/fbgemm_gpu/include/fbgemm_gpu/utils/tensor_accessor.h index c90a7ff9bc..4f30940d40 100644 --- a/fbgemm_gpu/include/fbgemm_gpu/utils/tensor_accessor.h +++ b/fbgemm_gpu/include/fbgemm_gpu/utils/tensor_accessor.h @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -504,7 +503,8 @@ template < size_t N, template class PtrTraits = DefaultPtrTraits, typename index_t = int64_t> -C10_DEFINE_DEPRECATED_USING(PackedTensorAccessor, AT_X) +using PackedTensorAccessor + [[deprecated("Old name for `GenericPackedTensorAccessor`")]] = AT_X; #undef AT_X