-
Notifications
You must be signed in to change notification settings - Fork 3
Add onnxruntime #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add onnxruntime #19
Conversation
82dc03f to
6804927
Compare
This reverts commit 56f3512. Removing CreateFile2 calls was insufficient to enable win7 support. There are win8+ API calls which are not straightforward to replace: onnxruntime\core\platform\windows\env_time.cc(31): error C2065: 'GetSystemTimePreciseAsFileTime': undeclared identifier
|
Added conan patch which allows to keep macos-intel 10.13 and ios 12.0 min OS versions. |
|
I think there is issue with FILE_READ_ATTRIBUTES vs GENERIC_READ in W7 patch? Also keeping 192 which means v142 toolset is needed to keep proper support for builded components for Windows 7. |
A hasty copy-paste on my side it seems, but that's irrelevant as I reverted the commit due to other compile errors.
Thanks for pointing that out, I was under the impression "if it compiles, it runs" :) The compiler version is back to 192 for windows 7 now. |
|
Seems your patches were almost close. This should be Windows 7 compatible patch https://github.com/GeorgeK1ng/vcmi-dependencies/actions/runs/19713613028 - compiled just fine. So you need to grab there Windows 7 patch and recipe ones to allow v142 toolset. |
0e42897 to
76afc17
Compare
|
@GeorgeK1ng Thank you! I have added your suggested patch, finally the win7/win8 split is removed - the last remaining conan change in the PR has been dealt with. |
kambala-decapitator
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also update PR description to match the current state
| - name: Build recipes with our patches | ||
| run: | | ||
| set -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will remove it. But if I may I ask: why? Don't you find it helpful for troubleshooting?
| # Patch conan recipe to prevent dragging libcurl as a dependency | ||
| # (can't be done via VCMI's conanfile as onnxruntime is built beforehand) | ||
| git apply --ignore-whitespace ../conan_patches/onnxruntime/recipe.diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pass date/*:use_system_tz_db as an option to conan create or simply place it in our profile, to common I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conan recipe also contains this change:
def _compilers_minimum_version(self):
return {
"Visual Studio": "17",
- "msvc": "193",
+ "msvc": "192",
"gcc": "9",It can't be set through command-line options AFAIK, which means the patch remains anyway. Does it still make sense to extract the date/*:use_system_tz_db into a cmdline option and wouldn't that make it harder to follow?
| if [[ $package == qt ]] ; then | ||
| packagePath="$recipePathQt/5.x.x" | ||
| elif [[ $package =~ ^onnx ]] && ${{ contains(matrix.conan_options, 'with_onnxruntime=False') }} ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I don't see such option in the matrix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove the qt check then as well?
| # Some are both build and host requirements and must not be removed | ||
| # => exclude them from the list | ||
| cat $buildPackagesFile $hostPackagesFile | jq -s ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unclear why this is needed, no info in PR description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a package is both a build and a host requirement, the old logic removes it. This leads to Missing prebuilt package error because conan is invoked with build=never in the VCMI build. In this case, zlib and protobuf were build requirements and were removed, which made them "missing" during VCMI build. This graph might help:
graph-msvc-x64.html
|
|
||
| #Set global compile flags for all the source code(including third_party code like protobuf) | ||
| #This section must be before any add_subdirectory, otherwise build may fail because /MD,/MT mismatch | ||
| +message(STATUS "MSVC=${MSVC} | CMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME} | CMAKE_C_COMPILER_ARCHITECTURE_ID=${CMAKE_C_COMPILER_ARCHITECTURE_ID} | CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to remove these debug messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not forgotten, I have left them on purpose. Please see my reply to your next comment regarding x86 vs X86.
| set(onnxruntime_target_platform "ARM") | ||
| enable_language(ASM_MARMASM) | ||
| - elseif (onnxruntime_target_platform STREQUAL "x64" OR onnxruntime_target_platform STREQUAL "x86_64" OR onnxruntime_target_platform STREQUAL "AMD64" OR CMAKE_GENERATOR MATCHES "Win64") | ||
| + elseif (onnxruntime_target_platform MATCHES "[Xx]64" OR onnxruntime_target_platform MATCHES "[Xx]86_64" OR onnxruntime_target_platform STREQUAL "AMD64" OR CMAKE_GENERATOR MATCHES "Win64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it really start with capital X?
also not really clear why touching x64 if the patch is for x86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently it can. Not sure where that comes from, but I find onnxruntime's target platform logic rather confusing. This is why I left the debug messages.
| - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | ||
| - OPEN_EXISTING, | ||
| - ¶m)}; | ||
| + wil::unique_hfile file_handle{CreateFileW( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these CreateFile2 -> CreateFileW changes worsening anything on Win 8+? If so, you could use runtime check for OS version or function availability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing extra. Should be still same result.
| - patch_file: "patches/android-64.diff" | ||
| patch_description: | | ||
| Fixes error for arm64-v8a targets: | ||
| onnxruntime/core/mlas/lib/mlasi.h:366:11: error: unknown type name 'bfloat16_t' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and what's the reason? Is it about minimum API level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't answer this question.
bfloat16 support seems introduced in Armv8.6-A in 2019, but onnxruntime/1.16.1 contains flags for armv8.2. This might cause issues on older chips where these optimized instructions are unavailable.
However, we should be safe. The MMAI models are not using bfloat16 arithmetic. I have tested the model with Samsung Galaxy A71 which has an ARM Cortex-A76 and Cortex-A55, both implementing Arm8.2-A and there have been no issues.
| onnxruntime/core/mlas/lib/mlasi.h:366:11: error: unknown type name 'bfloat16_t' | ||
| - patch_file: "patches/msvc-x86.diff" | ||
| patch_description: | | ||
| Fixes detection of x86 windows targets during cross-compilation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to upstream this patch? Or upstream dropped 32-bit support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would first wait to see if the models run on windows-x86 targets - I have no suitable hardware to test (honestly, I was surprised it even compiled. Hopefully it will run!)
|
@kambala-decapitator any further comments? |
|
will check over the weekend |
This PR contains changes needed to migrate MMAI from
libtorchtoonnxruntimeas @Laserlicht suggested hereIt adds
onnxruntime/1.18.1requirement with several patches address android-arm64 and windows-x86 compilation errors, as well as conan recipe errors from transitive dependencies.Please take a look and let me know if you have any comments.
The changes were tested with VCMI (develop branch) on MacOS 15 (arm), Windows 10 (x64), iOS 18 and Android 13 without noticing any issue.