pytorch/c10/util
Scott Wolchok e3f8141c25 Fix UB in BFloat16 round_to_nearest_even (#157942)
Type punning using unions is undefined behavior in C++ (you may not access a member of a union that is not the active member). bit_cast is the right way.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157942
Approved by: https://github.com/Skylion007
2025-07-10 18:03:39 +00:00
..
AbortHandler.h [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
accumulate.h
AlignOf.h
ApproximateClock.cpp [Profiler] Fix ASAN Overflow Issues (#140441) 2024-11-13 21:30:32 +00:00
ApproximateClock.h [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
Array.h Update dispatch stub to make SDPA routing cleaner (#126832) 2024-05-25 01:40:53 +00:00
ArrayRef.h Remove C10_DEPRECATED references in c10 (#151058) 2025-06-12 13:38:03 +00:00
Backtrace.cpp Use the unicode variant of the Windows API (#47422) (#138605) 2024-10-26 17:41:39 +00:00
Backtrace.h [caffe2] Make all get_backtrace() implementations lazy (#125750) (#126064) 2024-05-13 20:17:41 +00:00
BFloat16-inl.h xpu: rely on sycl/sycl.hpp to include bfloat16.hpp (#152562) 2025-05-09 02:25:44 +00:00
BFloat16-math.h Remove is_reduced_floating_point from namespace std (#144502) 2025-01-10 03:24:10 +00:00
Bfloat16.cpp [AOTI] Move c10/util ostream function implementations to their headers (#123847) 2024-04-19 00:51:24 +00:00
BFloat16.h Fix UB in BFloat16 round_to_nearest_even (#157942) 2025-07-10 18:03:39 +00:00
bit_cast.h Fix UB in BFloat16 round_to_nearest_even (#157942) 2025-07-10 18:03:39 +00:00
bits.h
Bitset.h Use clang-tidy 17 (#139678) 2024-11-05 16:00:25 +00:00
BUILD.bazel
build.bzl Fix UB in BFloat16 round_to_nearest_even (#157942) 2025-07-10 18:03:39 +00:00
C++17.cpp
C++17.h Remove some pre-cpp17 stuff (#138410) 2024-10-23 00:38:03 +00:00
CallOnce.h initialize device when pinning memory on this device, short circuit i… (#145752) 2025-01-30 21:37:29 +00:00
complex_math.cpp Remove use of math_compat.h (#116167) 2024-01-19 03:37:55 +00:00
complex_math.h
complex_utils.h
complex.h Move complex<Half> from Half.h to complex.h (#140565) 2024-11-18 15:56:21 +00:00
ConstexprCrc.h Use std::string_view (#145906) 2025-01-30 03:14:27 +00:00
copysign.h Remove use of math_compat.h (#116167) 2024-01-19 03:37:55 +00:00
DeadlockDetection.cpp [Environment Variable][1/N] Use thread-safe env variable API in c10 (#119449) 2024-10-01 06:24:30 +00:00
DeadlockDetection.h [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
Deprecated.h Revert "Remove C10_DEPRECATED (#138406)" 2024-10-22 18:00:41 +00:00
DimVector.h
DynamicCounter.cpp Enable cppcoreguidelines-special-member-functions (#139132) 2024-11-06 13:42:20 +00:00
DynamicCounter.h [pytorch][counters] DynamicCounter (#132166) 2024-07-31 19:52:51 +00:00
Enumerate.h [nativert] port enumerate from folly to c10::utill (#152481) 2025-05-01 21:41:05 +00:00
env.cpp [Environment Variable][Rebase] Use thread-safe getenv functions (#140200) 2025-05-02 00:41:49 +00:00
env.h [Environment Variable][1/N] Use thread-safe env variable API in c10 (#119449) 2024-10-01 06:24:30 +00:00
error.cpp Add missing explicit include directive for <cerrno> in c10/util/error… (#141593) 2024-11-27 00:00:23 +00:00
error.h Add and use thread-safe strerror (#140472) 2024-11-19 04:24:17 +00:00
Exception.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
Exception.h Remove C10_DEPRECATED references in c10 (#151058) 2025-06-12 13:38:03 +00:00
ExclusivelyOwned.h
ExclusivelyOwnedTensorTraits.h
FbcodeMaps.h
flags_use_gflags.cpp
flags_use_no_gflags.cpp Fix extra semicolon warning (#148291) 2025-03-03 18:51:44 +00:00
Flags.h [18/N] Fix extra warnings brought by clang-tidy-17 (#144014) 2025-01-08 17:21:55 +00:00
flat_hash_map.h
Float4_e2m1fn_x2.h add torch.float4_e2m1fn_x2 to PyTorch (#148791) 2025-03-27 17:32:20 +00:00
Float8_e4m3fn-inl.h Enable clang-tidy on c10/util/Float8*.h (#120573) 2024-06-14 13:47:07 +00:00
Float8_e4m3fn.cpp [AOTI] Move c10/util ostream function implementations to their headers (#123847) 2024-04-19 00:51:24 +00:00
Float8_e4m3fn.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
Float8_e4m3fnuz-inl.h additional support for float8_e4m3fnuz and _e5m2fnuz (#115214) 2024-01-22 18:33:41 +00:00
Float8_e4m3fnuz.cpp Enable clang-tidy on c10/util/Float8*.h (#120573) 2024-06-14 13:47:07 +00:00
Float8_e4m3fnuz.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
Float8_e5m2-inl.h Enable torch.empty for float8 dtypes + deterministic mode + cpu (#128744) 2024-06-15 02:05:30 +00:00
Float8_e5m2.cpp Enable clang-tidy on c10/util/Float8*.h (#120573) 2024-06-14 13:47:07 +00:00
Float8_e5m2.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
Float8_e5m2fnuz-inl.h Enable torch.empty for float8 dtypes + deterministic mode + cpu (#128744) 2024-06-15 02:05:30 +00:00
Float8_e5m2fnuz.cpp Enable clang-tidy on c10/util/Float8*.h (#120573) 2024-06-14 13:47:07 +00:00
Float8_e5m2fnuz.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
Float8_e8m0fnu-inl.h add the torch.float8_e8m0fnu dtype to PyTorch (#147466) 2025-02-20 13:55:42 +00:00
Float8_e8m0fnu.cpp add the torch.float8_e8m0fnu dtype to PyTorch (#147466) 2025-02-20 13:55:42 +00:00
Float8_e8m0fnu.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
Float8_fnuz_cvt.h Build SYCL kernels for ATen XPU ops on Native Windows (take 2) (#127390) 2024-06-06 01:41:06 +00:00
floating_point_utils.h Remove UB type punning from c10/util/floating_point_utils.h (#140567) 2024-11-18 18:41:34 +00:00
FunctionRef.h
Gauge.cpp add a new Guage API with an empty backend to PyTorch core (#134883) 2024-09-03 17:08:47 +00:00
Gauge.h [5/N] Fix extra warnings brought by clang-tidy-17 (#138403) 2024-10-21 02:59:54 +00:00
generic_math.h Fix a div_mod bug in generic_math.h (#157383) 2025-07-02 12:22:57 +00:00
Half-inl.h [PyTorch] Half: don't disable direct conversion to/from float on mobile (#130465) 2024-07-12 19:46:30 +00:00
Half.cpp [AOTI] Move c10/util ostream function implementations to their headers (#123847) 2024-04-19 00:51:24 +00:00
Half.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
hash.h Fix Wextra-semi warnings (#139000) 2024-10-28 21:48:51 +00:00
IdWrapper.h
int128.cpp
int128.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
intrusive_ptr.cpp
intrusive_ptr.h [11/N] Fix extra warnings brought by clang-tidy-17 (#139599) 2024-11-04 23:57:41 +00:00
IntrusiveList.h [nativert] move intrusive list to c10/util (#152754) 2025-05-05 18:49:56 +00:00
irange.h [caffe][executorch] rename to avoid shadow in irange (#157107) 2025-06-30 00:17:09 +00:00
Lazy.h [5/N] Fix extra warnings brought by clang-tidy-17 (#138403) 2024-10-21 02:59:54 +00:00
LeftRight.cpp
LeftRight.h [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
llvmMathExtras.h [2/N] Fix cppcoreguidelines-init-variables suppression (#146237) 2025-06-19 23:26:42 +00:00
Load.h [2/N] Enable UBSAN tests (#141740) 2024-12-03 20:52:26 +00:00
logging_is_google_glog.h
logging_is_not_google_glog.h [1/N] Fix Wunused-parameter warnings (#130924) 2024-07-19 06:14:51 +00:00
Logging.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
Logging.h Fix 'dllimport attribute ignored on inline function' (#157670) 2025-07-07 16:57:48 +00:00
MathConstants.cpp
MathConstants.h
MaybeOwned.h
Metaprogramming.cpp
Metaprogramming.h
NetworkFlow.cpp [BE] fix typos in c10/ (#156078) 2025-06-18 10:24:44 +00:00
NetworkFlow.h C++ network flow implementation in c10 (#132188) 2024-08-21 18:40:54 +00:00
numa.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
numa.h
Optional.cpp
Optional.h Disable c10::optional macros (#138912) 2024-12-17 09:22:47 +00:00
OptionalArrayRef.h Enable bugprone-unchecked-optional-access (#144226) 2025-01-10 03:16:56 +00:00
order_preserving_flat_hash_map.h Enable cppcoreguidelines-special-member-functions (#139132) 2024-11-06 13:42:20 +00:00
overflows.h move c10::overflows to its own header (#140564) 2024-11-18 15:56:21 +00:00
overloaded.h
ParallelGuard.cpp Turn some variables and functions into static (#136847) 2024-10-29 17:01:56 +00:00
ParallelGuard.h Avoid COW materialization in at::parallel_for/parallel_reduce (#120455) 2024-03-01 05:05:28 +00:00
python_stub.h
qint8.h
qint32.h
quint2x4.h
quint4x2.h
quint8.h
Registry.h [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
safe_numerics.h Overload mul_overflows for size_t (#155736) 2025-06-30 22:57:28 +00:00
ScopeExit.h
Semaphore.h [nativert] port semaphore to c10 util (#153504) 2025-05-28 19:17:30 +00:00
signal_handler.cpp [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
signal_handler.h [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
SmallBuffer.h [Clang-tidy header][21/N] Fix clang-tidy warnings in aten/src/ATEN/*.{cpp,h} (#120763) 2024-03-03 23:18:43 +00:00
SmallVector.cpp Fix warnings in SmallVector (#127250) 2024-05-30 21:13:20 +00:00
SmallVector.h [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
sparse_bitset.h [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
ssize.h
static_tracepoint_elfx86.h Flag TORCH_SDT_SEMAPHORE as being name resovable (#141191) 2024-11-23 01:39:44 +00:00
static_tracepoint.h
strides.h [1/N] Change static functions in headers to inline (#127727) 2024-06-03 04:34:36 +00:00
string_utils.h Eliminate c10 string_utils (#138499) 2024-10-23 13:40:19 +00:00
string_view.h [BE] fix typos in c10/ (#156078) 2025-06-18 10:24:44 +00:00
StringUtil.cpp [nativert] Port string join and split to c10/util (#152873) 2025-05-07 03:58:11 +00:00
StringUtil.h [caffe2] Make c10::str works with scoped enum (#152705) (#152714) 2025-05-13 21:05:36 +00:00
strong_type.h Remove std::is_arithmetic specialization from c10/util/strong_type.h (#153424) 2025-05-14 02:01:32 +00:00
Synchronized.h [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
tempfile.cpp Add and use thread-safe strerror (#140472) 2024-11-19 04:24:17 +00:00
tempfile.h
thread_name.cpp Add missing #include <array> to thread_name.cpp (#128664) 2024-06-14 07:49:09 +00:00
thread_name.h expose set_thread_name to Python and set thread names (#128448) 2024-06-13 16:38:23 +00:00
ThreadLocal.h [2/N] Enable cppcoreguidelines-special-member-functions (#138670) 2024-10-24 04:35:18 +00:00
ThreadLocalDebugInfo.cpp
ThreadLocalDebugInfo.h [2/N] Enable cppcoreguidelines-special-member-functions (#138670) 2024-10-24 04:35:18 +00:00
Type_demangle.cpp
Type_no_demangle.cpp
Type.h
TypeCast.cpp [codemod] Add [[noreturn]] to 2 files inc caffe2/c10/util/TypeCast.cpp (#129575) 2024-06-27 17:23:22 +00:00
TypeCast.h add the torch.float8_e8m0fnu dtype to PyTorch (#147466) 2025-02-20 13:55:42 +00:00
typeid.cpp Fix extra semicolon warning (#148291) 2025-03-03 18:51:44 +00:00
typeid.h [BE] fix typos in c10/ (#156078) 2025-06-18 10:24:44 +00:00
TypeIndex.h [1/N] Deprecate c10::string_view and at::string (#151972) 2025-04-29 07:23:52 +00:00
TypeList.cpp
TypeList.h Remove unused c10/util/C++17.h inclusion and outdated checks (#120149) 2024-02-17 14:28:17 +00:00
TypeSafeSignMath.h [2/N] Change static functions in headers to inline (#127764) 2024-06-04 00:49:04 +00:00
TypeTraits.cpp
TypeTraits.h
Unicode.cpp
Unicode.h
UniqueVoidPtr.cpp Enable nested namespace check in clang-tidy (#118506) 2024-01-31 00:32:35 +00:00
UniqueVoidPtr.h [sigmoid] memory planner C10 deps (#151275) 2025-04-24 01:46:32 +00:00
Unroll.h add int4 packed gemm support on CPU device (#117475) 2024-03-06 16:25:53 +00:00
WaitCounter.cpp [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
WaitCounter.h [5/N] Fix extra warnings brought by clang-tidy-17 (#138403) 2024-10-21 02:59:54 +00:00
WaitCounterDynamicBackend.h [pytorch][monitoring] Dynamic backend for WaitCounter (#135967) 2024-09-15 18:07:49 +00:00
win32-headers.h