-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[onnx] update ONNXIFI build output and host dependencies #20112
Conversation
* https://github.com/houseroad/foxi * install the project's copyright (MIT) * pytorch requires `foxi_loader` The CMake target will be renamed to `onnxifi_*` for convenience.
The new feature creats onnxifi.dll and some others. This requires the port to support |
Please ping me if this PR is ready for review or you need some help. |
Checked the protject's CI logs. It turned out onnx/onnx_proto are ALWAYS static. Specify it in CMakeLists.txt because vcpkg configures `BUILD_SHARED_LIBS=ON` If the triplet requires it. There are no `ONNXIFI_ENABLE_EXT=ON` case. Removed the misused build options in portfile. Add port feature `protobuf-lite` which is in build option.
* remove SHARED for `onnxifi_wrapper` and `onnxifi_dummy`
I just read the guideline again, and I made a wrong decision. Using I will find another workaround for #17199. |
* also remove redundant part in patch files
Let me take a look at why dynamic build doesn't work. |
In the official readme:
Since vcpkg is currently unable to establish a cross-triplet dependency, I think it's good now. |
Got it. I will update patch and check it soon. |
* onnxifi targets will be static either
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.
This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!
After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 9d892ff9270f2d2fe3b8e490471f0a7dfa78981e -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/o-/onnx.json b/versions/o-/onnx.json
index 47f5b67..6641b09 100644
--- a/versions/o-/onnx.json
+++ b/versions/o-/onnx.json
@@ -11,4 +11,4 @@
"port-version": 0
}
]
-}
\ No newline at end of file
+}
"dependencies": [ | ||
"pybind11" | ||
] | ||
"description": "Build Python binaries" |
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.
Why delete the dependency pybind11
?
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.
This was necessary when I tried to use FimdPython3 with find_package pybind11. But doing that blocks search of NumPy component. Same as the PR note
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.
That is, the port needs Python 3 pybind but our pybind11 port is for Python 2?
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.
No. It was quite confusing to me. Let me explain with PR comments...
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.
OK. commented below. #20112 (comment)
@@ -24,11 +22,11 @@ | |||
} | |||
], | |||
"features": { | |||
"protobuf-lite": { |
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.
Features can't "remove" functionality or control alternatives; this should probably be a feature named protobuf which does the full thing and is in the default-features set.
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 see. But I think default-features: ["protobuf"]
can give misunderstanding.
Some users may think onnx[core,pybind11]
is valid and it won't use protobuf.
protobuf in pybind11.dependencies
will look weird.
But this one looks weird either in my opinion....
{
"dependencies": [
"protobuf",
"python3"
],
"default-features": [
"protobuf"
],
"features": {
"protobuf": {
"description": "Build with full protobuf library"
},
"protobuf-lite": {
"description": "Use lite protobuf instead of full"
},
"pybind11": {
"description": "Build Python binaries"
}
}
}
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.
Some users may think onnx[core,pybind11] is valid and it won't use protobuf.
I believe that is unavoidable.
protobuf in pybind11.dependencies will look weird.
You can add onnx[core,protobuf]
as a dependency of the pybind11
feature to express dependencies between features.
Does using protobuf-lite
remove the protobuf dependency? If so, the dependency should be moved to the protobuf feature.
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 will add dependency to onnx[core,protobuf]
for pybind11
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.
By the way, protobuf-lite
also requires protobuf
library and ptoroc
in its tool.
Handling Python3 issues in portfileIt seems like we have 3 use-cases for Since CMake 3.12, Case 1. Python3 InterpreterMost port that uses # portfile.cmake
vcpkg_find_acquire_program(PYTHON3)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DPython3_EXECUTABLE=${PYTHON3}
# ...
) # CMakeLists.txt
find_package(Python3 COMPONENTS Interpreter) If there is a port which have to solve Case 2. Python3 DevelopmentCurrently, in Windows environment, # CMakeLists.txt
find_package(Python3 REQUIRED COMPONENTS Development) # requires Python's header files This case, we can install the port # portfile.cmake
# vcpkg_find_acquire_program(PYTHON3)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
# Only python.exe in Windows. We can't search Development component
# -DPython3_EXECUTABLE=${PYTHON3}
# search header files in ${vcpkg_root}/installed/${target_triplet}/include/python3/...
-DPython3_ROOT_DIR=${CURRENT_INSTALLED_DIR}
) But, {
"dependencies": [
"python3",
{
"name": "python3",
"host": true
}
]
} Here, we can still use "pybind11" together to solve Case 3. Python3 NumPyThis case requires find_package(Python3 COMPONENTS NumPy) The port However, if a project requires install of python packages, it is highly possible that those python packages are from a virtual environment. I think ONNX is for 3rd case ports. That is, a port using ONNX wouldn't like to mix port If so, mixing |
Tagging requires:discussion to resolve the python mess. :/ |
I give up this PR. |
What does your PR fix?
1. Feature for ONNXIFIPytorch project is using ONNX with this project's source code. (foxi_loader
)After a survey, I found there are differences in ONNX's public headers.~~Making it to a separate port requires overwrite of those files. ~~
For #17199, replace related source files before build.~~Then install the project's LICENSE (MIT) file with ONNX copyright. ~~
By this way, CMake target originally namedfoxi_*
will be built asonnxifi_*
.2. Remove Host dependencies (help/suggestion needed)
In #18073, I used
python3
for host dependencies to ensurepybind11
andfind_package(Python3 COMPONENTS Development
).#17199 uses
NumPy
(whenfind_package(Python3)
).Seems like it should be prepared not by port but from environment...
3. Removed
ONNXIFI_EXT
option usageI had a wrong understanding of the
ONNXIFI_EXT
build option. The project doesn't specify it in its CI. Removed it inportfile.cmake
4. New feature
protobuf-lite
for build optionONNX_USE_LITE_PROTO
5.
onnxifi
related targets always generate STATIC library in WindowsChecked the project's CI. It doesn't provide
BUILD_SHARED_LIBS
, so it seems likeonnx.lib
andonnx_proto.lib
are default output....Which triplets are supported/not supported? Have you updated the CI baseline?
No changes in triplet support.
Does your PR follow the maintainer guide?
Checking it.