Update py-onnx-runtime to 1.10; update CMS patch (#30725)
* Update py-onnx-runtime to 1.10; update CMS patch * Update package.py
This commit is contained in:
parent
30f2394782
commit
fb2730d87f
2 changed files with 146 additions and 0 deletions
142
var/spack/repos/builtin/packages/py-onnx-runtime/cms_1_10.patch
Normal file
142
var/spack/repos/builtin/packages/py-onnx-runtime/cms_1_10.patch
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
||||||
|
index acbde7f56a8..eb9f7bb9fbf 100644
|
||||||
|
--- a/cmake/CMakeLists.txt
|
||||||
|
+++ b/cmake/CMakeLists.txt
|
||||||
|
@@ -718,7 +718,7 @@ if (onnxruntime_BUILD_BENCHMARKS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
-if (NOT WIN32 AND NOT onnxruntime_PREFER_SYSTEM_LIB)
|
||||||
|
+if (NOT WIN32)
|
||||||
|
add_subdirectory(${PROJECT_SOURCE_DIR}/external/nsync EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
|
# External dependencies
|
||||||
|
diff --git a/include/onnxruntime/core/platform/ort_mutex.h b/include/onnxruntime/core/platform/ort_mutex.h
|
||||||
|
index e24665f5142..ddc11953fbc 100644
|
||||||
|
--- a/include/onnxruntime/core/platform/ort_mutex.h
|
||||||
|
+++ b/include/onnxruntime/core/platform/ort_mutex.h
|
||||||
|
@@ -101,7 +101,7 @@ std::cv_status OrtCondVar::wait_for(std::unique_lock<OrtMutex>& cond_mutex,
|
||||||
|
return steady_clock::now() - steady_now < rel_time ? std::cv_status::no_timeout : std::cv_status::timeout;
|
||||||
|
}
|
||||||
|
} // namespace onnxruntime
|
||||||
|
-#else
|
||||||
|
+#elif !defined(__aarch64__)
|
||||||
|
#include "nsync.h"
|
||||||
|
#include <mutex> //for unique_lock
|
||||||
|
#include <condition_variable> //for cv_status
|
||||||
|
@@ -186,4 +186,11 @@ std::cv_status OrtCondVar::wait_for(std::unique_lock<OrtMutex>& cond_mutex,
|
||||||
|
return steady_clock::now() - steady_now < rel_time ? std::cv_status::no_timeout : std::cv_status::timeout;
|
||||||
|
}
|
||||||
|
}; // namespace onnxruntime
|
||||||
|
+#else
|
||||||
|
+#include <mutex>
|
||||||
|
+#include <condition_variable>
|
||||||
|
+namespace onnxruntime {
|
||||||
|
+using OrtMutex = std::mutex;
|
||||||
|
+using OrtCondVar = std::condition_variable;
|
||||||
|
+} // namespace onnxruntime
|
||||||
|
#endif
|
||||||
|
diff --git a/include/onnxruntime/core/session/onnxruntime_cxx_api.h b/include/onnxruntime/core/session/onnxruntime_cxx_api.h
|
||||||
|
index 048421099bd..4430185d496 100644
|
||||||
|
--- a/include/onnxruntime/core/session/onnxruntime_cxx_api.h
|
||||||
|
+++ b/include/onnxruntime/core/session/onnxruntime_cxx_api.h
|
||||||
|
@@ -379,9 +379,9 @@ struct ModelMetadata : Base<OrtModelMetadata> {
|
||||||
|
*/
|
||||||
|
struct Session : Base<OrtSession> {
|
||||||
|
explicit Session(std::nullptr_t) {} ///< Create an empty Session object, must be assigned a valid one to be used
|
||||||
|
- Session(Env& env, const ORTCHAR_T* model_path, const SessionOptions& options); ///< Wraps OrtApi::CreateSession
|
||||||
|
- Session(Env& env, const ORTCHAR_T* model_path, const SessionOptions& options, OrtPrepackedWeightsContainer* prepacked_weights_container); ///< Wraps OrtApi::CreateSessionWithPrepackedWeightsContainer
|
||||||
|
- Session(Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options); ///< Wraps OrtApi::CreateSessionFromArray
|
||||||
|
+ Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options); ///< Wraps OrtApi::CreateSession
|
||||||
|
+ Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options, OrtPrepackedWeightsContainer* prepacked_weights_container); ///< Wraps OrtApi::CreateSessionWithPrepackedWeightsContainer
|
||||||
|
+ Session(const Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options); ///< Wraps OrtApi::CreateSessionFromArray
|
||||||
|
|
||||||
|
/** \brief Run the model returning results in an Ort allocated vector.
|
||||||
|
*
|
||||||
|
diff --git a/include/onnxruntime/core/session/onnxruntime_cxx_inline.h b/include/onnxruntime/core/session/onnxruntime_cxx_inline.h
|
||||||
|
index 1f31dffca87..b9d2cdfc475 100644
|
||||||
|
--- a/include/onnxruntime/core/session/onnxruntime_cxx_inline.h
|
||||||
|
+++ b/include/onnxruntime/core/session/onnxruntime_cxx_inline.h
|
||||||
|
@@ -538,16 +538,16 @@ inline SessionOptions& SessionOptions::AppendExecutionProvider_OpenVINO(const Or
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline Session::Session(Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
|
||||||
|
+inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
|
||||||
|
ThrowOnError(GetApi().CreateSession(env, model_path, options, &p_));
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline Session::Session(Env& env, const ORTCHAR_T* model_path, const SessionOptions& options,
|
||||||
|
+inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options,
|
||||||
|
OrtPrepackedWeightsContainer* prepacked_weights_container) {
|
||||||
|
ThrowOnError(GetApi().CreateSessionWithPrepackedWeightsContainer(env, model_path, options, prepacked_weights_container, &p_));
|
||||||
|
}
|
||||||
|
|
||||||
|
-inline Session::Session(Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options) {
|
||||||
|
+inline Session::Session(const Env& env, const void* model_data, size_t model_data_length, const SessionOptions& options) {
|
||||||
|
ThrowOnError(GetApi().CreateSessionFromArray(env, model_data, model_data_length, options, &p_));
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/onnxruntime/core/mlas/lib/platform.cpp b/onnxruntime/core/mlas/lib/platform.cpp
|
||||||
|
index de7fee8c07a..6d97cf07a05 100644
|
||||||
|
--- a/onnxruntime/core/mlas/lib/platform.cpp
|
||||||
|
+++ b/onnxruntime/core/mlas/lib/platform.cpp
|
||||||
|
@@ -16,6 +16,7 @@ Module Name:
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "mlasi.h"
|
||||||
|
+#include <string>
|
||||||
|
|
||||||
|
#if defined(MLAS_TARGET_POWER) && defined(__linux__)
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
@@ -197,8 +198,11 @@ Return Value:
|
||||||
|
//
|
||||||
|
|
||||||
|
uint64_t xcr0 = MlasReadExtendedControlRegister(_XCR_XFEATURE_ENABLED_MASK);
|
||||||
|
+ const char *cpu_opt = std::getenv("MLAS_DYNAMIC_CPU_ARCH");
|
||||||
|
+ if (cpu_opt == nullptr) cpu_opt = "99";
|
||||||
|
+ auto opt = std::stoi(cpu_opt);
|
||||||
|
|
||||||
|
- if ((xcr0 & 0x6) == 0x6) {
|
||||||
|
+ if (opt > 0 && (xcr0 & 0x6) == 0x6) {
|
||||||
|
|
||||||
|
this->GemmFloatKernel = MlasGemmFloatKernelAvx;
|
||||||
|
|
||||||
|
@@ -231,7 +235,7 @@ Return Value:
|
||||||
|
__cpuid_count(7, 0, Cpuid7[0], Cpuid7[1], Cpuid7[2], Cpuid7[3]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- if (((Cpuid1[2] & 0x1000) != 0) && ((Cpuid7[1] & 0x20) != 0)) {
|
||||||
|
+ if (opt > 1 && ((Cpuid1[2] & 0x1000) != 0) && ((Cpuid7[1] & 0x20) != 0)) {
|
||||||
|
|
||||||
|
this->GemmU8S8Dispatch = &MlasGemmU8S8DispatchAvx2;
|
||||||
|
this->GemmU8S8Kernel = MlasGemmU8S8KernelAvx2;
|
||||||
|
@@ -290,7 +294,7 @@ Return Value:
|
||||||
|
// operating system supports saving AVX512F state.
|
||||||
|
//
|
||||||
|
|
||||||
|
- if (((Cpuid7[1] & 0x10000) != 0) && ((xcr0 & 0xE0) == 0xE0)) {
|
||||||
|
+ if (opt > 2 && ((Cpuid7[1] & 0x10000) != 0) && ((xcr0 & 0xE0) == 0xE0)) {
|
||||||
|
|
||||||
|
this->GemmFloatKernel = MlasGemmFloatKernelAvx512F;
|
||||||
|
this->GemmDoubleKernel = MlasGemmDoubleKernelAvx512F;
|
||||||
|
diff --git a/onnxruntime/core/platform/posix/ort_mutex.cc b/onnxruntime/core/platform/posix/ort_mutex.cc
|
||||||
|
index 8a5d41eb360..89111c9daa5 100644
|
||||||
|
--- a/onnxruntime/core/platform/posix/ort_mutex.cc
|
||||||
|
+++ b/onnxruntime/core/platform/posix/ort_mutex.cc
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
+#if !defined(__aarch64__)
|
||||||
|
#include "core/common/common.h"
|
||||||
|
#include "core/platform/ort_mutex.h"
|
||||||
|
#include <assert.h>
|
||||||
|
@@ -40,4 +41,5 @@ void OrtCondVar::wait(std::unique_lock<OrtMutex>& lk) {
|
||||||
|
nsync::nsync_cv_wait(&native_cv_object, lk.mutex()->native_handle());
|
||||||
|
}
|
||||||
|
|
||||||
|
-} // namespace onnxruntime
|
||||||
|
\ No newline at end of file
|
||||||
|
+} // namespace onnxruntime
|
||||||
|
+#endif
|
|
@ -19,6 +19,7 @@ class PyOnnxRuntime(CMakePackage, PythonPackage):
|
||||||
homepage = "https://github.com/microsoft/onnxruntime"
|
homepage = "https://github.com/microsoft/onnxruntime"
|
||||||
git = "https://github.com/microsoft/onnxruntime.git"
|
git = "https://github.com/microsoft/onnxruntime.git"
|
||||||
|
|
||||||
|
version('1.10.0', tag='v1.10.0', submodules=True)
|
||||||
version('1.7.2', tag='v1.7.2', submodules=True)
|
version('1.7.2', tag='v1.7.2', submodules=True)
|
||||||
|
|
||||||
variant('cuda', default=False, description='Build with CUDA support')
|
variant('cuda', default=False, description='Build with CUDA support')
|
||||||
|
@ -35,6 +36,7 @@ class PyOnnxRuntime(CMakePackage, PythonPackage):
|
||||||
depends_on('py-cerberus', type=('build', 'run'))
|
depends_on('py-cerberus', type=('build', 'run'))
|
||||||
depends_on('py-wheel', type='build')
|
depends_on('py-wheel', type='build')
|
||||||
depends_on('py-onnx', type=('build', 'run'))
|
depends_on('py-onnx', type=('build', 'run'))
|
||||||
|
depends_on('py-flatbuffers', type=('build', 'run'))
|
||||||
depends_on('zlib')
|
depends_on('zlib')
|
||||||
depends_on('libpng')
|
depends_on('libpng')
|
||||||
depends_on('py-pybind11', type='build')
|
depends_on('py-pybind11', type='build')
|
||||||
|
@ -47,6 +49,8 @@ class PyOnnxRuntime(CMakePackage, PythonPackage):
|
||||||
# Adopted from CMS experiment's fork of onnxruntime
|
# Adopted from CMS experiment's fork of onnxruntime
|
||||||
# https://github.com/cms-externals/onnxruntime/compare/5bc92df...d594f80
|
# https://github.com/cms-externals/onnxruntime/compare/5bc92df...d594f80
|
||||||
patch('cms.patch', level=1, when='@1.7.2')
|
patch('cms.patch', level=1, when='@1.7.2')
|
||||||
|
# https://github.com/cms-externals/onnxruntime/compare/0d9030e...7a6355a
|
||||||
|
patch('cms_1_10.patch', whe='@1.10')
|
||||||
# https://github.com/microsoft/onnxruntime/issues/4234#issuecomment-698077636
|
# https://github.com/microsoft/onnxruntime/issues/4234#issuecomment-698077636
|
||||||
patch('libiconv.patch', level=0, when='@1.7.2')
|
patch('libiconv.patch', level=0, when='@1.7.2')
|
||||||
# https://github.com/microsoft/onnxruntime/commit/de4089f8cbe0baffe56a363cc3a41595cc8f0809.patch
|
# https://github.com/microsoft/onnxruntime/commit/de4089f8cbe0baffe56a363cc3a41595cc8f0809.patch
|
||||||
|
|
Loading…
Reference in a new issue