Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Oct 17, 2024
1 parent d649cac commit bf8f057
Show file tree
Hide file tree
Showing 106 changed files with 295 additions and 571 deletions.
10 changes: 0 additions & 10 deletions cgmanifests/generated/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,6 @@
"comments": "google_benchmark"
}
},
{
"component": {
"type": "git",
"git": {
"commitHash": "13de152c2a1cd73ff4df97bd2c406b6d15d34af3",
"repositoryUrl": "https://github.com/google/nsync.git"
},
"comments": "google_nsync"
}
},
{
"component": {
"type": "git",
Expand Down
3 changes: 0 additions & 3 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,6 @@ function(onnxruntime_set_compile_flags target_name)
if (CMAKE_CXX_COMPILER_ID STREQUAL "IBMClang")
target_compile_options(${target_name} PRIVATE "-Wno-unused-function")
endif()
target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11)
onnxruntime_add_include_to_target(${target_name} nsync::nsync_cpp)
endif()
foreach(ORT_FLAG ${ORT_PROVIDER_FLAGS})
target_compile_definitions(${target_name} PRIVATE ${ORT_FLAG})
Expand Down Expand Up @@ -1672,7 +1670,6 @@ if (WIN32)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES advapi32)
endif()
else()
list(APPEND onnxruntime_EXTERNAL_LIBRARIES nsync::nsync_cpp)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${ICONV_LIB} ${CMAKE_DL_LIBS} Threads::Threads)
endif()

Expand Down
1 change: 0 additions & 1 deletion cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ flatbuffers;https://github.com/google/flatbuffers/archive/refs/tags/v23.5.26.zip
fp16;https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip;b985f6985a05a1c03ff1bb71190f66d8f98a1494
fxdiv;https://github.com/Maratyszcza/FXdiv/archive/63058eff77e11aa15bf531df5dd34395ec3017c8.zip;a5658f4036402dbca7cebee32be57fb8149811e1
google_benchmark;https://github.com/google/benchmark/archive/refs/tags/v1.8.5.zip;cd47d3d272faf353600c8cc2fdec2b52d6f69177
google_nsync;https://github.com/google/nsync/archive/refs/tags/1.26.0.zip;5e7c00ef6bf5b787386fc040067903ec774e2752
googletest;https://github.com/google/googletest/archive/refs/tags/v1.15.0.zip;9d2d0af8d77ac726ea55d44a8fa727ec98311349
#xnnpack 2024.09.04
googlexnnpack;https://github.com/google/XNNPACK/archive/309b75c9e56e0a674bf78d59872ce131f814dfb6.zip;39FA5259EAEACE0547284B63D5CEDC4F05553F5A
Expand Down
21 changes: 0 additions & 21 deletions cmake/external/onnxruntime_external_deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,6 @@ if (onnxruntime_BUILD_BENCHMARKS)
onnxruntime_fetchcontent_makeavailable(google_benchmark)
endif()

if (NOT WIN32)
FetchContent_Declare(
google_nsync
URL ${DEP_URL_google_nsync}
URL_HASH SHA1=${DEP_SHA1_google_nsync}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/nsync/nsync_1.26.0.patch
FIND_PACKAGE_ARGS NAMES nsync unofficial-nsync
)
#nsync tests failed on Mac Build
set(NSYNC_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
onnxruntime_fetchcontent_makeavailable(google_nsync)

if (google_nsync_SOURCE_DIR)
add_library(nsync::nsync_cpp ALIAS nsync_cpp)
target_include_directories(nsync_cpp PUBLIC ${google_nsync_SOURCE_DIR}/public)
endif()
if(TARGET unofficial::nsync::nsync_cpp AND NOT TARGET nsync::nsync_cpp)
message(STATUS "Aliasing unofficial::nsync::nsync_cpp to nsync::nsync_cpp")
add_library(nsync::nsync_cpp ALIAS unofficial::nsync::nsync_cpp)
endif()
endif()

if(onnxruntime_USE_MIMALLOC)
FetchContent_Declare(
Expand Down
2 changes: 1 addition & 1 deletion cmake/onnxruntime_mlas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ if (NOT onnxruntime_ORT_MINIMAL_BUILD)
target_link_libraries(onnxruntime_mlas_q4dq PRIVATE cpuinfo)
endif()
if(NOT WIN32)
target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
target_link_libraries(onnxruntime_mlas_q4dq PRIVATE ${CMAKE_DL_LIBS})
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
target_link_libraries(onnxruntime_mlas_q4dq PRIVATE ${android_shared_libs})
Expand Down
2 changes: 1 addition & 1 deletion cmake/onnxruntime_providers_cann.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
onnxruntime_add_include_to_target(onnxruntime_providers_cann onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers::flatbuffers Boost::mp11 safeint_interface)

add_dependencies(onnxruntime_providers_cann onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_link_libraries(onnxruntime_providers_cann PRIVATE ascendcl acl_op_compiler fmk_onnx_parser nsync::nsync_cpp ${ABSEIL_LIBS} ${ONNXRUNTIME_PROVIDERS_SHARED})
target_link_libraries(onnxruntime_providers_cann PRIVATE ascendcl acl_op_compiler fmk_onnx_parser ${ABSEIL_LIBS} ${ONNXRUNTIME_PROVIDERS_SHARED})
target_link_directories(onnxruntime_providers_cann PRIVATE ${onnxruntime_CANN_HOME}/lib64)
target_include_directories(onnxruntime_providers_cann PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${onnxruntime_CANN_HOME} ${onnxruntime_CANN_HOME}/include)

Expand Down
2 changes: 0 additions & 2 deletions cmake/onnxruntime_providers_cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@

if(APPLE)
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker -exported_symbols_list ${ONNXRUNTIME_ROOT}/core/providers/cuda/exported_symbols.lst")
target_link_libraries(${target} PRIVATE nsync::nsync_cpp)
elseif(UNIX)
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/core/providers/cuda/version_script.lds -Xlinker --gc-sections")
target_link_libraries(${target} PRIVATE nsync::nsync_cpp)
elseif(WIN32)
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS "-DEF:${ONNXRUNTIME_ROOT}/core/providers/cuda/symbols.def")
else()
Expand Down
2 changes: 0 additions & 2 deletions cmake/onnxruntime_providers_dnnl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
INSTALL_RPATH "@loader_path"
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE)
target_link_libraries(onnxruntime_providers_dnnl PRIVATE nsync::nsync_cpp)
elseif(UNIX)
set_property(TARGET onnxruntime_providers_dnnl APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/core/providers/dnnl/version_script.lds -Xlinker --gc-sections -Xlinker -rpath=\$ORIGIN")
target_link_libraries(onnxruntime_providers_dnnl PRIVATE nsync::nsync_cpp)
elseif(WIN32)
set_property(TARGET onnxruntime_providers_dnnl APPEND_STRING PROPERTY LINK_FLAGS "-DEF:${ONNXRUNTIME_ROOT}/core/providers/dnnl/symbols.def")
else()
Expand Down
2 changes: 1 addition & 1 deletion cmake/onnxruntime_providers_migraphx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
endif()
if(UNIX)
set_property(TARGET onnxruntime_providers_migraphx APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/core/providers/migraphx/version_script.lds -Xlinker --gc-sections")
target_link_libraries(onnxruntime_providers_migraphx PRIVATE nsync::nsync_cpp stdc++fs)
target_link_libraries(onnxruntime_providers_migraphx PRIVATE stdc++fs)
endif()

if (onnxruntime_ENABLE_TRAINING_OPS)
Expand Down
1 change: 0 additions & 1 deletion cmake/onnxruntime_providers_rocm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@

if(UNIX)
set_property(TARGET onnxruntime_providers_rocm APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/core/providers/rocm/version_script.lds -Xlinker --gc-sections")
target_link_libraries(onnxruntime_providers_rocm PRIVATE nsync::nsync_cpp)
else()
message(FATAL_ERROR "onnxruntime_providers_rocm unknown platform, need to specify shared library exports for it")
endif()
Expand Down
2 changes: 0 additions & 2 deletions cmake/onnxruntime_providers_tensorrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,9 @@

if(APPLE)
set_property(TARGET onnxruntime_providers_tensorrt APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker -exported_symbols_list ${ONNXRUNTIME_ROOT}/core/providers/tensorrt/exported_symbols.lst")
target_link_libraries(onnxruntime_providers_tensorrt PRIVATE nsync::nsync_cpp)
elseif(UNIX)
set_property(TARGET onnxruntime_providers_tensorrt APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations")
set_property(TARGET onnxruntime_providers_tensorrt APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/core/providers/tensorrt/version_script.lds -Xlinker --gc-sections")
target_link_libraries(onnxruntime_providers_tensorrt PRIVATE nsync::nsync_cpp)
elseif(WIN32)
set_property(TARGET onnxruntime_providers_tensorrt APPEND_STRING PROPERTY LINK_FLAGS "-DEF:${ONNXRUNTIME_ROOT}/core/providers/tensorrt/symbols.def")
else()
Expand Down
2 changes: 1 addition & 1 deletion cmake/onnxruntime_providers_vsinpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
add_library(onnxruntime_providers_vsinpu ${onnxruntime_providers_vsinpu_srcs})
onnxruntime_add_include_to_target(onnxruntime_providers_vsinpu
onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers Boost::mp11
safeint_interface nsync::nsync_cpp)
safeint_interface )
add_dependencies(onnxruntime_providers_vsinpu ${onnxruntime_EXTERNAL_DEPENDENCIES})
set_target_properties(onnxruntime_providers_vsinpu PROPERTIES FOLDER "ONNXRuntime" LINKER_LANGUAGE CXX)
target_include_directories(onnxruntime_providers_vsinpu PRIVATE ${ONNXRUNTIME_ROOT} $ENV{TIM_VX_INSTALL}/include)
Expand Down
22 changes: 10 additions & 12 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,8 @@ if(MSVC)
target_compile_options(onnxruntime_test_utils PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /wd6326>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/wd6326>")
else()
target_compile_definitions(onnxruntime_test_utils PUBLIC -DNSYNC_ATOMIC_CPP11)
target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
onnxruntime_add_include_to_target(onnxruntime_test_utils nsync::nsync_cpp)
onnxruntime_add_include_to_target(onnxruntime_test_utils )
endif()
if (onnxruntime_USE_NCCL)
target_include_directories(onnxruntime_test_utils PRIVATE ${NCCL_INCLUDE_DIRS})
Expand Down Expand Up @@ -797,9 +796,8 @@ if(NOT IOS)
target_compile_options(onnx_test_runner_common PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /utf-8>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/utf-8>")
else()
target_compile_definitions(onnx_test_runner_common PUBLIC -DNSYNC_ATOMIC_CPP11)
target_include_directories(onnx_test_runner_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
onnxruntime_add_include_to_target(onnx_test_runner_common nsync::nsync_cpp)
onnxruntime_add_include_to_target(onnx_test_runner_common )
endif()
if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
#TODO: fix the warnings, they are dangerous
Expand Down Expand Up @@ -1202,7 +1200,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
# "Global initializer calls a non-constexpr function." BENCHMARK_CAPTURE macro needs this.
target_compile_options(onnxruntime_mlas_benchmark PRIVATE /wd26426)
else()
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE ${CMAKE_DL_LIBS})
endif()
if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE cpuinfo)
Expand Down Expand Up @@ -1275,7 +1273,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
${onnxruntime_EXTERNAL_LIBRARIES}
${GETOPT_LIB_WIDE} ${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
if(NOT WIN32)
list(APPEND onnxruntime_perf_test_libs nsync::nsync_cpp)
list(APPEND onnxruntime_perf_test_libs )
if(onnxruntime_USE_SNPE)
list(APPEND onnxruntime_perf_test_libs onnxruntime_providers_snpe)
endif()
Expand Down Expand Up @@ -1343,7 +1341,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
# test inference using shared lib
set(onnxruntime_shared_lib_test_LIBS onnxruntime_mocked_allocator onnxruntime_test_utils onnxruntime_common onnx_proto)
if(NOT WIN32)
list(APPEND onnxruntime_shared_lib_test_LIBS nsync::nsync_cpp)
list(APPEND onnxruntime_shared_lib_test_LIBS )
if(onnxruntime_USE_SNPE)
list(APPEND onnxruntime_shared_lib_test_LIBS onnxruntime_providers_snpe)
endif()
Expand Down Expand Up @@ -1492,7 +1490,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
target_link_libraries(onnxruntime_mlas_test PRIVATE cpuinfo)
endif()
if(NOT WIN32)
target_link_libraries(onnxruntime_mlas_test PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
target_link_libraries(onnxruntime_mlas_test PRIVATE ${CMAKE_DL_LIBS})
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
target_link_libraries(onnxruntime_mlas_test PRIVATE ${android_shared_libs})
Expand Down Expand Up @@ -1679,7 +1677,7 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")

set(onnxruntime_customopregistration_test_LIBS custom_op_library onnxruntime_common onnxruntime_test_utils)
if (NOT WIN32)
list(APPEND onnxruntime_customopregistration_test_LIBS nsync::nsync_cpp)
list(APPEND onnxruntime_customopregistration_test_LIBS )
endif()
if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
list(APPEND onnxruntime_customopregistration_test_LIBS cpuinfo)
Expand All @@ -1688,7 +1686,7 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
list(APPEND onnxruntime_customopregistration_test_LIBS ${TENSORRT_LIBRARY_INFER})
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
list(APPEND onnxruntime_customopregistration_test_LIBS onnxruntime_graph onnxruntime_session onnxruntime_providers onnxruntime_lora onnxruntime_framework onnxruntime_util onnxruntime_mlas onnxruntime_optimizer onnxruntime_flatbuffers iconv re2 ${PROTOBUF_LIB} onnx onnx_proto nsync_cpp)
list(APPEND onnxruntime_customopregistration_test_LIBS onnxruntime_graph onnxruntime_session onnxruntime_providers onnxruntime_lora onnxruntime_framework onnxruntime_util onnxruntime_mlas onnxruntime_optimizer onnxruntime_flatbuffers iconv re2 ${PROTOBUF_LIB} onnx onnx_proto)
endif()
AddTest(DYN
TARGET onnxruntime_customopregistration_test
Expand Down Expand Up @@ -1807,11 +1805,11 @@ if (onnxruntime_BUILD_SHARED_LIB AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten"

set(onnxruntime_logging_apis_test_LIBS onnxruntime_common onnxruntime_test_utils)
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
list(APPEND onnxruntime_logging_apis_test_LIBS onnxruntime_session onnxruntime_util onnxruntime_lora onnxruntime_framework onnxruntime_common onnxruntime_graph onnxruntime_providers onnxruntime_mlas onnxruntime_optimizer onnxruntime_flatbuffers iconv re2 ${PROTOBUF_LIB} onnx onnx_proto nsync_cpp)
list(APPEND onnxruntime_logging_apis_test_LIBS onnxruntime_session onnxruntime_util onnxruntime_lora onnxruntime_framework onnxruntime_common onnxruntime_graph onnxruntime_providers onnxruntime_mlas onnxruntime_optimizer onnxruntime_flatbuffers iconv re2 ${PROTOBUF_LIB} onnx onnx_proto)
endif()

if(NOT WIN32)
list(APPEND onnxruntime_logging_apis_test_LIBS nsync::nsync_cpp ${CMAKE_DL_LIBS})
list(APPEND onnxruntime_logging_apis_test_LIBS ${CMAKE_DL_LIBS})
endif()

AddTest(DYN
Expand Down
4 changes: 2 additions & 2 deletions cmake/onnxruntime_webassembly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ target_compile_options(onnx PRIVATE -Wno-unused-parameter -Wno-unused-variable)

if (onnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB)
bundle_static_library(onnxruntime_webassembly
nsync::nsync_cpp

${PROTOBUF_LIB}
onnx
onnx_proto
Expand Down Expand Up @@ -175,7 +175,7 @@ else()
endif()

target_link_libraries(onnxruntime_webassembly PRIVATE
nsync::nsync_cpp

${PROTOBUF_LIB}
onnx
onnx_proto
Expand Down
3 changes: 1 addition & 2 deletions include/onnxruntime/core/common/logging/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "core/common/logging/macros.h"
#include "core/common/logging/severity.h"
#include "core/common/logging/sink_types.h"
#include "core/platform/ort_mutex.h"
#include "date/date.h"

/*
Expand Down Expand Up @@ -259,7 +258,7 @@ class LoggingManager final {

std::unique_ptr<ISink> sink_;
#ifdef _WIN32
mutable OrtMutex sink_mutex_;
mutable std::mutex sink_mutex_;
#endif
Severity default_min_severity_;
const bool default_filter_user_data_;
Expand Down
3 changes: 1 addition & 2 deletions include/onnxruntime/core/graph/schema_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "core/graph/constants.h"
#include "core/common/common.h"
#include "core/common/status.h"
#include "core/platform/ort_mutex.h"

namespace onnxruntime {
using OpName_Domain_Version_Schema_Map = std::unordered_map<
Expand Down Expand Up @@ -102,7 +101,7 @@ class OnnxRuntimeOpSchemaRegistry : public IOnnxRuntimeOpSchemaCollection {

common::Status RegisterOpSchemaInternal(ONNX_NAMESPACE::OpSchema&& op_schema);

OrtMutex mutex_;
std::mutex mutex_;

OpName_Domain_Version_Schema_Map map_;
DomainToVersionRangeMap domain_version_range_map_;
Expand Down
10 changes: 5 additions & 5 deletions include/onnxruntime/core/platform/Barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include <assert.h>

#include "core/common/spin_pause.h"
#include "core/platform/ort_mutex.h"

#include <mutex>
#include <condition_variable>

Check warning on line 15 in include/onnxruntime/core/platform/Barrier.h

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Found C++ system header after other header. Should be: Barrier.h, c system, c++ system, other. [build/include_order] [4] Raw Output: include/onnxruntime/core/platform/Barrier.h:15: Found C++ system header after other header. Should be: Barrier.h, c system, c++ system, other. [build/include_order] [4]
#include <atomic>

namespace onnxruntime {
Expand Down Expand Up @@ -40,7 +40,7 @@ class Barrier {
assert(((v + delta) & ~1) != 0);
return; // either count has not dropped to 0, or waiter is not waiting
}
std::unique_lock<OrtMutex> l(mu_);
std::unique_lock<std::mutex> l(mu_);
assert(!notified_);
notified_ = true;
cv_.notify_all();
Expand All @@ -55,16 +55,16 @@ class Barrier {
unsigned int v = state_.fetch_or(1, std::memory_order_acq_rel);
if ((v >> 1) == 0)
return;
std::unique_lock<OrtMutex> l(mu_);
std::unique_lock<std::mutex> l(mu_);
while (!notified_) {
cv_.wait(l);
}
}
}

private:
OrtMutex mu_;
OrtCondVar cv_;
std::mutex mu_;
std::condition_variable cv_;
std::atomic<unsigned int> state_; // low bit is waiter flag
bool notified_;
const bool spin_;
Expand Down
Loading

0 comments on commit bf8f057

Please sign in to comment.