mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Get build working on Xcode 16 (#22168)
This commit is contained in:
parent
ce13f651d8
commit
209ff86d52
10 changed files with 231 additions and 200 deletions
389
.github/workflows/mac.yml
vendored
389
.github/workflows/mac.yml
vendored
|
|
@ -1,192 +1,197 @@
|
|||
name: Mac_CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- rel-*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- rel-*
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
python_version: 3.11
|
||||
xcode_version: 15.2
|
||||
|
||||
jobs:
|
||||
ARM64:
|
||||
runs-on: macos-14
|
||||
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.python_version }}
|
||||
|
||||
- name: Verify ARM64 machine
|
||||
shell: python
|
||||
run: |
|
||||
import platform
|
||||
assert platform.machine() == "arm64", "This job expects to be run on an ARM64 machine."
|
||||
|
||||
- name: Use Xcode ${{ env.xcode_version }}
|
||||
shell: bash
|
||||
run: |
|
||||
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
|
||||
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build and test
|
||||
shell: bash
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir ./build \
|
||||
--update \
|
||||
--build --parallel \
|
||||
--test \
|
||||
--build_shared_lib \
|
||||
--build_objc \
|
||||
--use_coreml \
|
||||
--use_xnnpack \
|
||||
--use_binskim_compliant_compile_flags
|
||||
|
||||
Vcpkg:
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.python_version }}
|
||||
|
||||
- name: "Run vcpkg(x64-osx)"
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
|
||||
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
|
||||
runVcpkgInstall: true
|
||||
vcpkgJsonGlob: "cmake/vcpkg.json"
|
||||
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
|
||||
env:
|
||||
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
|
||||
VCPKG_DEFAULT_TRIPLET: "x64-osx"
|
||||
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
|
||||
|
||||
- name: "Run compile_schema.py"
|
||||
run: |
|
||||
# Runner's host triplet should be x64-osx or arm64-osx
|
||||
export FLATC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/flatbuffers"
|
||||
export PATH="$FLATC_DIR:$PATH"
|
||||
flatc --version
|
||||
python onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc "$(which flatc)"
|
||||
|
||||
- name: "Detect protoc"
|
||||
id: protoc-detect
|
||||
run: |
|
||||
export PROTOC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/protobuf"
|
||||
export PATH="$PROTOC_DIR:$PATH"
|
||||
protoc --version
|
||||
echo "protoc_path=$(which protoc)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: "Run build.py(x64-osx)"
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir "build/x64-osx" \
|
||||
--skip_submodule_sync \
|
||||
--skip_tests \
|
||||
--compile_no_warning_as_error \
|
||||
--parallel \
|
||||
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
|
||||
--osx_arch x86_64 \
|
||||
--use_vcpkg \
|
||||
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
|
||||
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-osx" \
|
||||
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
|
||||
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
|
||||
shell: bash
|
||||
|
||||
- name: "Run vcpkg(arm64-osx)"
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
|
||||
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
|
||||
runVcpkgInstall: true
|
||||
vcpkgJsonGlob: "cmake/vcpkg.json"
|
||||
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
|
||||
env:
|
||||
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
|
||||
VCPKG_DEFAULT_TRIPLET: "arm64-osx"
|
||||
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
|
||||
|
||||
- name: "Run build.py(arm64-osx)"
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir "build/arm64-osx" \
|
||||
--skip_submodule_sync \
|
||||
--skip_tests \
|
||||
--compile_no_warning_as_error \
|
||||
--parallel \
|
||||
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
|
||||
--osx_arch arm64 \
|
||||
--use_vcpkg \
|
||||
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
|
||||
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-osx" \
|
||||
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
|
||||
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
|
||||
shell: bash
|
||||
|
||||
Objective-C-StaticAnalysis:
|
||||
runs-on: macos-14
|
||||
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.python_version }}
|
||||
|
||||
- name: Use Xcode ${{ env.xcode_version }}
|
||||
shell: bash
|
||||
run: |
|
||||
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
|
||||
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Generate compile_commands.json and ONNX protobuf files
|
||||
shell: bash
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir ./build \
|
||||
--cmake_generator "Unix Makefiles" \
|
||||
--config Debug \
|
||||
--build_shared_lib \
|
||||
--use_coreml \
|
||||
--build_objc \
|
||||
--enable_training_apis \
|
||||
--cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
--use_binskim_compliant_compile_flags \
|
||||
--update \
|
||||
--build --parallel \
|
||||
--target onnx_proto
|
||||
|
||||
- name: Analyze Objective-C/C++ source code
|
||||
shell: bash
|
||||
run: |
|
||||
CLANG_TIDY_CHECKS="-*,clang-analyzer-*"
|
||||
|
||||
"$(brew --prefix llvm@15)/bin/clang-tidy" \
|
||||
-p=./build/Debug \
|
||||
--checks="${CLANG_TIDY_CHECKS}" \
|
||||
--warnings-as-errors="${CLANG_TIDY_CHECKS}" \
|
||||
--header-filter="objectivec/include|objectivec|onnxruntime/core" \
|
||||
./objectivec/*.mm \
|
||||
./onnxruntime/core/platform/apple/logging/apple_log_sink.mm \
|
||||
./onnxruntime/core/providers/coreml/model/*.mm
|
||||
name: Mac_CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- rel-*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- rel-*
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
python_version: 3.11
|
||||
|
||||
jobs:
|
||||
ARM64:
|
||||
runs-on: macos-14
|
||||
|
||||
env:
|
||||
xcode_version: 16
|
||||
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.python_version }}
|
||||
|
||||
- name: Verify ARM64 machine
|
||||
shell: python
|
||||
run: |
|
||||
import platform
|
||||
assert platform.machine() == "arm64", "This job expects to be run on an ARM64 machine."
|
||||
|
||||
- name: Use Xcode ${{ env.xcode_version }}
|
||||
shell: bash
|
||||
run: |
|
||||
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
|
||||
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build and test
|
||||
shell: bash
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir ./build \
|
||||
--update \
|
||||
--build --parallel \
|
||||
--test \
|
||||
--build_shared_lib \
|
||||
--build_objc \
|
||||
--use_coreml \
|
||||
--use_xnnpack \
|
||||
--use_binskim_compliant_compile_flags
|
||||
|
||||
Vcpkg:
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.python_version }}
|
||||
|
||||
- name: "Run vcpkg(x64-osx)"
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
|
||||
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
|
||||
runVcpkgInstall: true
|
||||
vcpkgJsonGlob: "cmake/vcpkg.json"
|
||||
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
|
||||
env:
|
||||
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
|
||||
VCPKG_DEFAULT_TRIPLET: "x64-osx"
|
||||
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
|
||||
|
||||
- name: "Run compile_schema.py"
|
||||
run: |
|
||||
# Runner's host triplet should be x64-osx or arm64-osx
|
||||
export FLATC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/flatbuffers"
|
||||
export PATH="$FLATC_DIR:$PATH"
|
||||
flatc --version
|
||||
python onnxruntime/core/flatbuffers/schema/compile_schema.py --flatc "$(which flatc)"
|
||||
|
||||
- name: "Detect protoc"
|
||||
id: protoc-detect
|
||||
run: |
|
||||
export PROTOC_DIR="${{ github.workspace }}/.build/${{ runner.arch }}-osx/tools/protobuf"
|
||||
export PATH="$PROTOC_DIR:$PATH"
|
||||
protoc --version
|
||||
echo "protoc_path=$(which protoc)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: "Run build.py(x64-osx)"
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir "build/x64-osx" \
|
||||
--skip_submodule_sync \
|
||||
--skip_tests \
|
||||
--compile_no_warning_as_error \
|
||||
--parallel \
|
||||
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
|
||||
--osx_arch x86_64 \
|
||||
--use_vcpkg \
|
||||
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
|
||||
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=x64-osx" \
|
||||
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
|
||||
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
|
||||
shell: bash
|
||||
|
||||
- name: "Run vcpkg(arm64-osx)"
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgDirectory: "${{ runner.temp }}/vcpkg"
|
||||
vcpkgGitCommitId: "1de2026f28ead93ff1773e6e680387643e914ea1" # 2024.07.12
|
||||
runVcpkgInstall: true
|
||||
vcpkgJsonGlob: "cmake/vcpkg.json"
|
||||
vcpkgConfigurationJsonGlob: "cmake/vcpkg-configuration.json"
|
||||
env:
|
||||
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/.build"
|
||||
VCPKG_DEFAULT_TRIPLET: "arm64-osx"
|
||||
# VCPKG_BINARY_SOURCES: "default" # https://learn.microsoft.com/en-us/vcpkg/reference/binarycaching
|
||||
|
||||
- name: "Run build.py(arm64-osx)"
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir "build/arm64-osx" \
|
||||
--skip_submodule_sync \
|
||||
--skip_tests \
|
||||
--compile_no_warning_as_error \
|
||||
--parallel \
|
||||
--path_to_protoc_exe "${{ steps.protoc-detect.outputs.protoc_path }}" \
|
||||
--osx_arch arm64 \
|
||||
--use_vcpkg \
|
||||
--cmake_extra_defines "CMAKE_TOOLCHAIN_FILE:FILEPATH=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
|
||||
--cmake_extra_defines "VCPKG_TARGET_TRIPLET=arm64-osx" \
|
||||
--cmake_extra_defines "VCPKG_INSTALLED_DIR:PATH=${{ github.workspace }}/.build" \
|
||||
--cmake_extra_defines "VCPKG_INSTALL_OPTIONS=--x-feature=tests"
|
||||
shell: bash
|
||||
|
||||
Objective-C-StaticAnalysis:
|
||||
runs-on: macos-14
|
||||
|
||||
env:
|
||||
xcode_version: 15.2
|
||||
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.python_version }}
|
||||
|
||||
- name: Use Xcode ${{ env.xcode_version }}
|
||||
shell: bash
|
||||
run: |
|
||||
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
|
||||
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Generate compile_commands.json and ONNX protobuf files
|
||||
shell: bash
|
||||
run: |
|
||||
python ./tools/ci_build/build.py \
|
||||
--build_dir ./build \
|
||||
--cmake_generator "Unix Makefiles" \
|
||||
--config Debug \
|
||||
--build_shared_lib \
|
||||
--use_coreml \
|
||||
--build_objc \
|
||||
--enable_training_apis \
|
||||
--cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
--use_binskim_compliant_compile_flags \
|
||||
--update \
|
||||
--build --parallel \
|
||||
--target onnx_proto
|
||||
|
||||
- name: Analyze Objective-C/C++ source code
|
||||
shell: bash
|
||||
run: |
|
||||
CLANG_TIDY_CHECKS="-*,clang-analyzer-*"
|
||||
|
||||
"$(brew --prefix llvm@15)/bin/clang-tidy" \
|
||||
-p=./build/Debug \
|
||||
--checks="${CLANG_TIDY_CHECKS}" \
|
||||
--warnings-as-errors="${CLANG_TIDY_CHECKS}" \
|
||||
--header-filter="objectivec/include|objectivec|onnxruntime/core" \
|
||||
./objectivec/*.mm \
|
||||
./onnxruntime/core/platform/apple/logging/apple_log_sink.mm \
|
||||
./onnxruntime/core/providers/coreml/model/*.mm
|
||||
|
|
|
|||
|
|
@ -642,10 +642,12 @@ else()
|
|||
check_cxx_compiler_flag(-Wcast-function-type HAS_CAST_FUNCTION_TYPE)
|
||||
check_cxx_compiler_flag(-Wcatch-value HAS_CATCH_VALUE)
|
||||
check_cxx_compiler_flag(-Wclass-memaccess HAS_CLASS_MEMACCESS)
|
||||
check_cxx_compiler_flag(-Wdangling-reference HAS_DANGLING_REFERENCE)
|
||||
check_cxx_compiler_flag(-Wdeprecated-anon-enum-enum-conversion HAS_DEPRECATED_ANON_ENUM_ENUM_CONVERSION)
|
||||
check_cxx_compiler_flag(-Wdeprecated-builtins HAS_DEPRECATED_BUILTINS)
|
||||
check_cxx_compiler_flag(-Wdeprecated-copy HAS_DEPRECATED_COPY)
|
||||
check_cxx_compiler_flag(-Wdeprecated-declarations HAS_DEPRECATED_DECLARATIONS)
|
||||
check_cxx_compiler_flag(-Wdeprecated-this-capture HAS_DEPRECATED_THIS_CAPTURE)
|
||||
check_cxx_compiler_flag(-Wenum-constexpr-conversion HAS_ENUM_CONSTEXPR_CONVERSION)
|
||||
check_cxx_compiler_flag(-Wformat-truncation HAS_FORMAT_TRUNCATION)
|
||||
check_cxx_compiler_flag(-Wignored-attributes HAS_IGNORED_ATTRIBUTES)
|
||||
|
|
@ -656,15 +658,15 @@ else()
|
|||
check_cxx_compiler_flag(-Wshorten-64-to-32 HAS_SHORTEN_64_TO_32)
|
||||
check_cxx_compiler_flag(-Wstrict-aliasing HAS_STRICT_ALIASING)
|
||||
check_nvcc_compiler_flag(-Wstrict-aliasing NVCC_HAS_STRICT_ALIASING)
|
||||
check_cxx_compiler_flag(-Wstringop-overflow HAS_STRINGOP_OVERFLOW)
|
||||
check_cxx_compiler_flag(-Wtautological-pointer-compare HAS_TAUTOLOGICAL_POINTER_COMPARE)
|
||||
check_cxx_compiler_flag(-Wundefined-var-template HAS_UNDEFINED_VAR_TEMPLATE)
|
||||
check_cxx_compiler_flag(-Wunused-but-set-parameter HAS_UNUSED_BUT_SET_PARAMETER)
|
||||
check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE)
|
||||
check_cxx_compiler_flag(-Wunused-variable HAS_UNUSED_VARIABLE)
|
||||
check_cxx_compiler_flag(-Wuseless-cast HAS_USELESS_CAST)
|
||||
check_cxx_compiler_flag(-Wstringop-overflow HAS_STRINGOP_OVERFLOW)
|
||||
|
||||
if(onnxruntime_ENABLE_TRAINING_APIS)
|
||||
check_cxx_compiler_flag(-Wdangling-reference HAS_DANGLING_REFERENCE)
|
||||
if(HAS_DANGLING_REFERENCE)
|
||||
list(APPEND ORT_WARNING_FLAGS -Wno-dangling-reference)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ if (NOT WIN32)
|
|||
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
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#cmakedefine HAS_CLASS_MEMACCESS
|
||||
#cmakedefine HAS_DEPRECATED_COPY
|
||||
#cmakedefine HAS_DEPRECATED_DECLARATIONS
|
||||
#cmakedefine HAS_DEPRECATED_THIS_CAPTURE
|
||||
#cmakedefine HAS_FORMAT_TRUNCATION
|
||||
#cmakedefine HAS_IGNORED_ATTRIBUTES
|
||||
#cmakedefine HAS_MAYBE_UNINITIALIZED
|
||||
|
|
|
|||
|
|
@ -893,8 +893,6 @@ if (MSVC)
|
|||
set_property(SOURCE "${TEST_SRC_DIR}/optimizer/graph_transform_test.cc"
|
||||
"${TEST_SRC_DIR}/optimizer/qdq_transformer_test.cc"
|
||||
APPEND PROPERTY COMPILE_OPTIONS "/bigobj")
|
||||
set_property(SOURCE "${TEST_SRC_DIR}/optimizer/qdq_transformer_test.cc"
|
||||
APPEND PROPERTY COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_compile_options(onnxruntime_test_all PRIVATE "-Wno-parentheses")
|
||||
endif()
|
||||
|
|
|
|||
14
cmake/patches/nsync/nsync_1.26.0.patch
Normal file
14
cmake/patches/nsync/nsync_1.26.0.patch
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/public/nsync_atomic.h b/public/nsync_atomic.h
|
||||
index aebe4f7..466a262 100644
|
||||
--- a/public/nsync_atomic.h
|
||||
+++ b/public/nsync_atomic.h
|
||||
@@ -45,7 +45,8 @@ NSYNC_CPP_END_
|
||||
NSYNC_CPP_START_
|
||||
typedef std::atomic<uint32_t> nsync_atomic_uint32_;
|
||||
NSYNC_CPP_END_
|
||||
-#define NSYNC_ATOMIC_UINT32_INIT_ ATOMIC_VAR_INIT (0)
|
||||
+// Replace deprecated ATOMIC_VAR_INIT with std::atomic<uint32_t> brace initialization
|
||||
+#define NSYNC_ATOMIC_UINT32_INIT_ { 0 }
|
||||
#define NSYNC_ATOMIC_UINT32_LOAD_(p) (std::atomic_load (p))
|
||||
#define NSYNC_ATOMIC_UINT32_STORE_(p,v) (std::atomic_store ((p), (uint32_t) (v)))
|
||||
#define NSYNC_ATOMIC_UINT32_PTR_(p) (p)
|
||||
|
|
@ -49,6 +49,12 @@
|
|||
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
|
||||
#endif
|
||||
|
||||
// eigen-src/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h:215:9:
|
||||
// error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
|
||||
#ifdef HAS_DEPRECATED_THIS_CAPTURE
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-this-capture"
|
||||
#endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
// build\windows\debug\external\eigen3\unsupported\eigen\cxx11\src/Tensor/Tensor.h(76):
|
||||
// warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
|
||||
|
|
|
|||
|
|
@ -86,6 +86,11 @@ Status EmbedLayerNorm<T>::Compute(OpKernelContext* context) const {
|
|||
std::atomic_bool failed{false};
|
||||
|
||||
int n = batch_size * sequence_length;
|
||||
|
||||
// Put epsilon into local variable here to avoid the need to capture 'this' in the TryBatchParallelFor() lambda.
|
||||
// Using the copy capture default (=) to implicitly capture 'this' is deprecated.
|
||||
const float epsilon_value = epsilon();
|
||||
|
||||
concurrency::ThreadPool::TryBatchParallelFor(
|
||||
context->GetOperatorThreadPool(), n, [=, &failed](ptrdiff_t index) {
|
||||
int word_col_index = input_ids_data[index];
|
||||
|
|
@ -136,7 +141,7 @@ Status EmbedLayerNorm<T>::Compute(OpKernelContext* context) const {
|
|||
y[i] = a;
|
||||
sum += a * a;
|
||||
}
|
||||
T e = sqrt(sum / hidden_size + static_cast<T>(epsilon()));
|
||||
T e = sqrt(sum / hidden_size + static_cast<T>(epsilon_value));
|
||||
for (int i = 0; i < hidden_size; i++) {
|
||||
y[i] = y[i] / e * gamma_data[i] + beta_data[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2770,7 +2770,8 @@ common::Status InferenceSession::RunAsync(const RunOptions* run_options,
|
|||
if (!tp || concurrency::ThreadPool::DegreeOfParallelism(tp) < 2) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "intra op thread pool must have at least one thread for RunAsync");
|
||||
}
|
||||
std::function<void()> run_fn = [=]() {
|
||||
std::function<void()> run_fn = [run_options, feed_names, feeds, fetch_names, fetches, num_fetches,
|
||||
callback, user_data, this]() {
|
||||
Status status = Status::OK();
|
||||
ORT_TRY {
|
||||
if (run_options) {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ using namespace ONNX_NAMESPACE;
|
|||
namespace onnxruntime {
|
||||
namespace test {
|
||||
|
||||
static const std::string MODEL_FOLDER = "testdata/transform/";
|
||||
|
||||
TEST(OptimizerTest, Basic) {
|
||||
Model model("OptimizerBasic", false, ModelMetaData(), PathString(), IOnnxRuntimeOpSchemaRegistryList(),
|
||||
{{kOnnxDomain, 12}}, {}, DefaultLoggingManager().DefaultLogger());
|
||||
|
|
|
|||
Loading…
Reference in a new issue