pytorch/c10/util
dolpm 66f53889d5 [nativert] port semaphore to c10 util (#153504)
Summary:
nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff adds a simple semaphore interface into c10 until c++20 where we get counting_semaphore

gonna need a oss build export to take a look at this...

Test Plan: CI

Differential Revision: D73882656

Pull Request resolved: https://github.com/pytorch/pytorch/pull/153504
Approved by: https://github.com/zhxchen17
2025-05-28 19:17:30 +00:00
..
AbortHandler.h [4/N] Fix cppcoreguidelines-special-member-functions warnings (#139027) 2024-10-29 00:18:18 +00:00
accumulate.h [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +00:00
AlignOf.h [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326) 2023-12-23 04:59:55 +00:00
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 Fix & unit test for c10::ArrayRef constructed from user-defined types (#139758) 2024-11-06 04:23:05 +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 xpu: rely on sycl/sycl.hpp to include bfloat16.hpp (#152562) 2025-05-09 02:25:44 +00:00
bit_cast.h Fix macro for bit_cast in c10/util/bit_cast.h - one line change (#148265) 2025-03-01 20:55:31 +00:00
bits.h Add various uninterpreted bit tensor data types (try 2) (#95860) 2023-03-04 03:35:59 +00:00
Bitset.h Use clang-tidy 17 (#139678) 2024-11-05 16:00:25 +00:00
BUILD.bazel
build.bzl [nativert] port semaphore to c10 util (#153504) 2025-05-28 19:17:30 +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 [codemod][lowrisk] Remove extra semi colon from caffe2/c10/util/Float8_e5m2.h (#115761) 2024-01-04 02:02:26 +00:00
complex_utils.h Logcumsumexp for CPU (#93153) 2023-01-27 22:29:33 +00:00
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 [9/N] Fixes clang-tidy warnings in c10/util/*.h (#116185) 2023-12-22 09:35:44 +00:00
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 [BE] Fix typos in SyntaxError description (#154436) 2025-05-27 18:08:58 +00:00
ExclusivelyOwned.h [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +00:00
ExclusivelyOwnedTensorTraits.h [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326) 2023-12-23 04:59:55 +00:00
FbcodeMaps.h [PyTorch] add c10/util/FbcodeMaps.h (#96359) 2023-03-10 02:18:16 +00:00
flags_use_gflags.cpp adjust header inclusions in C10 as sugguested by IWYU (#102467) 2023-05-31 19:19:10 +00:00
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 [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +00:00
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 [ROCm][Windows] Fix unrecognized _BitScanReverse intrinsic (#146606) 2025-02-06 23:47:18 +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 Enable clang-tidy on c10/util/Float8*.h (#120573) 2024-06-14 13:47:07 +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 [AOTI] Move c10/util ostream function implementations to their headers (#123847) 2024-04-19 00:51:24 +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 Eliminate some C++11 checks (#126308) 2024-05-16 22:37:45 +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 add the torch.float8_e8m0fnu dtype to PyTorch (#147466) 2025-02-20 13:55:42 +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 [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326) 2023-12-23 04:59:55 +00:00
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 PythonMod printing for C++ (#143385) 2025-01-22 14:58:35 +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 [ROCm][Windows] Fix unrecognized constexpr std::memcpy for HIP-clang (#147316) 2025-02-24 18:28:59 +00:00
hash.h Fix Wextra-semi warnings (#139000) 2024-10-28 21:48:51 +00:00
IdWrapper.h [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +00:00
int128.cpp increase clang-tidy coverage to more c10 source files (#102902) 2023-06-04 06:33:01 +00:00
int128.h [1/N] Change static functions in headers to inline (#127727) 2024-06-03 04:34:36 +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 constexpr all the things in irange.h (#147633) 2025-02-22 01:51:51 +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 [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +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 C10_UNUSED to [[maybe_unused]] (#6357) (#138364) 2024-10-19 13:17:43 +00:00
MathConstants.cpp Use c10 math constants consistently in Math.h (#91967) 2023-01-12 11:53:52 +00:00
MathConstants.h Use c10 math constants consistently in Math.h (#91967) 2023-01-12 11:53:52 +00:00
MaybeOwned.h [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +00:00
Metaprogramming.cpp
Metaprogramming.h [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326) 2023-12-23 04:59:55 +00:00
NetworkFlow.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +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 [9/N] Fixes clang-tidy warnings in c10/util/*.h (#116185) 2023-12-22 09:35:44 +00:00
Optional.cpp [PyTorch] Redirect c10::optional to std::optional (#101995) 2023-11-30 02:46:41 +00:00
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 [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326) 2023-12-23 04:59:55 +00:00
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 [9/N] Fixes clang-tidy warnings in c10/util/*.h (#116185) 2023-12-22 09:35:44 +00:00
ScopeExit.h [Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751) 2024-01-08 11:07:58 +00:00
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 [10/N] Fixes clang-tidy warnings in c10/util/*.h (#116326) 2023-12-23 04:59:55 +00:00
static_tracepoint_elfx86.h Flag TORCH_SDT_SEMAPHORE as being name resovable (#141191) 2024-11-23 01:39:44 +00:00
static_tracepoint.h [caffe2][SDT] Check whether TORCH_DISABLE_SDT macro is defined before referencing it (#107149) 2023-08-16 19:52:12 +00:00
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 Bump Clang-tidy to 19.1.4 (#148648) 2025-03-10 17:32:30 +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 [9/N] Fixes clang-tidy warnings in c10/util/*.h (#116185) 2023-12-22 09:35:44 +00:00
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 cleanup unused include (#93359) 2023-02-04 02:15:50 +00:00
ThreadLocalDebugInfo.h [2/N] Enable cppcoreguidelines-special-member-functions (#138670) 2024-10-24 04:35:18 +00:00
Type_demangle.cpp [Reland 1] Cleanup header inclusions in torch_cpu by iwyu (#112311) 2023-11-19 04:06:36 +00:00
Type_no_demangle.cpp [2/N] Cleanup header inclusions in torch_cpu by iwyu (#109964) 2023-11-19 20:56:32 +00:00
Type.h [T153220354] Fix header inclusions in c10 (#1541) (#101846) 2023-05-20 19:35:14 +00:00
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 [1/N] Deprecate c10::string_view and at::string (#151972) 2025-04-29 07:23:52 +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 [9/N] Fixes clang-tidy warnings in c10/util/*.h (#116185) 2023-12-22 09:35:44 +00:00
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