From 69b883d7ace02cb84a713c3a73e804ace1158eae Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Tue, 14 Jan 2025 15:22:41 -0800 Subject: [PATCH] Remove C10_EMBEDDED (#144808) I added this to support code sharing with ExecuTorch, but the operator<< overrides are load-bearing for builds -- we have other code that attempts to pretty-print Half/BFloat16, and implicit conversions can't be used to make that work because there are *multiple* implicit conversions from Half/BFloat16 to primitive types, so which one to select is ambiguous. Also, we don't actually seem to need it now in ExecuTorch core because we have `include ` in there at the moment anyway. Pull Request resolved: https://github.com/pytorch/pytorch/pull/144808 Approved by: https://github.com/janeyx99, https://github.com/malfet --- c10/util/BFloat16.h | 4 ---- c10/util/Half.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/c10/util/BFloat16.h b/c10/util/BFloat16.h index ad1271fc729..09d3051ab71 100644 --- a/c10/util/BFloat16.h +++ b/c10/util/BFloat16.h @@ -8,9 +8,7 @@ #include #include #include -#ifndef C10_EMBEDDED #include -#endif // C10_EMBEDDED #if defined(__CUDACC__) && !defined(USE_ROCM) #include @@ -116,14 +114,12 @@ struct alignas(2) BFloat16 { #endif }; -#ifndef C10_EMBEDDED C10_API inline std::ostream& operator<<( std::ostream& out, const BFloat16& value) { out << (float)value; return out; } -#endif // C10_EMBEDDED } // namespace c10 diff --git a/c10/util/Half.h b/c10/util/Half.h index 5625d4c3403..b77cf7b1f4a 100644 --- a/c10/util/Half.h +++ b/c10/util/Half.h @@ -29,9 +29,7 @@ #include #include #include -#ifndef C10_EMBEDDED #include -#endif // C10_EMBEDDED #ifdef __CUDACC__ #include @@ -411,12 +409,10 @@ struct alignas(2) Half { #endif }; -#ifndef C10_EMBEDDED C10_API inline std::ostream& operator<<(std::ostream& out, const Half& value) { out << (float)value; return out; } -#endif // C10_EMBEDDED } // namespace c10