Skip to content

[onnxruntime] add features#51180

Draft
abique wants to merge 1 commit intomicrosoft:masterfrom
abique:onnxruntime-features
Draft

[onnxruntime] add features#51180
abique wants to merge 1 commit intomicrosoft:masterfrom
abique:onnxruntime-features

Conversation

@abique
Copy link
Copy Markdown
Contributor

@abique abique commented Apr 15, 2026

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version, or no changes were necessary.
  • Any fixed CI baseline and CI feature baseline entries are removed from that file, or no entries needed to be changed.
  • All patch files in the port are applied and succeed.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

@abique abique force-pushed the onnxruntime-features branch 2 times, most recently from e096f40 to 95bf787 Compare April 15, 2026 11:48
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@abique abique force-pushed the onnxruntime-features branch from 95bf787 to 87f64ea Compare April 15, 2026 13:49
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@abique abique marked this pull request as ready for review April 15, 2026 13:49
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@abique
Copy link
Copy Markdown
Contributor Author

abique commented Apr 15, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 51180 in repo microsoft/vcpkg

@abique
Copy link
Copy Markdown
Contributor Author

abique commented Apr 15, 2026

arm64_osx was canceled for some reasons.

@BillyONeal
Copy link
Copy Markdown
Member

BillyONeal commented Apr 15, 2026

arm64_osx was canceled for some reasons.

It wasn't actually cancelled; when a push was done in between and the build was cancelled and restarted, GitHub got the cancellation notice of the first build but something got lost delivering the 'started running again' for the second.

arm64_osx actually completed now, but there are still legitimate build failures; for example:

/vcpkg/scripts/azure-pipelines/../ci.feature.baseline.txt: error: onnxruntime[core,cuda]:x64-linux build failed but was expected to pass
note: if onnxruntime[cuda] succeeds when built with other features but not alone, consider adding `onnxruntime[core,cuda]:x64-linux=combination-fails`
note: if onnxruntime[cuda] always fails, consider adding `onnxruntime[cuda]:x64-linux=feature-fails`, which will mark this test as failing, and remove onnxruntime[cuda] from combined feature testing
note: if some features are required, consider effectively always enabling those parts in portfile.cmake for onnxruntime, or consider adding `onnxruntime[required-feature]=options` to include 'required-feature' in all tests
/vcpkg/scripts/azure-pipelines/../ci.feature.baseline.txt: error: onnxruntime[core,cuda,openvino,xnnpack]:x64-linux build failed but was expected to pass
note: consider adding `onnxruntime=fail`, `onnxruntime:x64-linux=fail`, `onnxruntime[core,cuda,openvino,xnnpack]:x64-linux=combination-fails`, or equivalent skips, or by marking mutually exclusive features as options

My guess is that we need onnxruntime[cuda]:x64-linux=feature-fails in $/scripts/ci.feature.baseline.txt?

(There are other failures, this is just the first one I ran into)

@BillyONeal BillyONeal marked this pull request as draft April 15, 2026 18:54
@abique
Copy link
Copy Markdown
Contributor Author

abique commented Apr 16, 2026

The error on Linux seems to be:

/usr/local/cuda-12.9/bin/nvcc -forward-unknown-to-host-compiler -DCOMPILE_HOPPER_TMA_GEMMS -DCPUINFO_SUPPORTED_PLATFORM=1 -DCUTLASS_ENABLE_CUBLAS=1 -DCUTLASS_ENABLE_CUDNN=1 -DDEBUG_NODE_INPUTS_OUTPUTS -DDISABLE_CUSPARSE_DEPRECATED -DEIGEN_MPL2_ONLY -DEIGEN_USE_THREADS -DENABLE_CPU_FP16_TRAINING_OPS -DENABLE_CUDA_NHWC_OPS -DENABLE_FP4 -DENABLE_FP8 -DHAS_STRING_VIEW=1 -DONLY_C_LOCALE=0 -DONNX_ML=1 -DONNX_NAMESPACE=onnx -DORT_ENABLE_STREAM -DPLATFORM_POSIX -DUSE_CUDA=1 -DUSE_FLASH_ATTENTION=1 -D_GNU_SOURCE -Donnxruntime_providers_cuda_EXPORTS -I/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/include/onnxruntime -I/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/include/onnxruntime/core/session -I/mnt/vcpkg-ci/b/onnxruntime/x64-linux-dbg -I/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/onnxruntime -isystem /mnt/vcpkg-ci/installed/x64-linux/include -isystem /usr/local/cuda-12.9/targets/x86_64-linux/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include/eigen3 -Xcudafe --diag_suppress=2803 -Wno-deprecated-gpu-targets -Xfatbin=-compress-all --expt-relaxed-constexpr --Werror default-stream-launch -Xcudafe "--diag_suppress=bad_friend_decl" -Xcudafe "--diag_suppress=unsigned_compare_with_zero" -Xcudafe "--diag_suppress=expr_has_no_effect" -g "--generate-code=arch=compute_60,code=[sm_60]" "--generate-code=arch=compute_70,code=[sm_70]" "--generate-code=arch=compute_75,code=[sm_75]" "--generate-code=arch=compute_80,code=[sm_80]" "--generate-code=arch=compute_86,code=[sm_86]" "--generate-code=arch=compute_89,code=[sm_89]" "--generate-code=arch=compute_90a,code=[sm_90a]" "--generate-code=arch=compute_100a,code=[sm_100a]" "--generate-code=arch=compute_120a,code=[sm_120a]" -Xcompiler=-fPIC -Xcudafe --diag_suppress=conversion_function_not_usable --compiler-options -Wall --compiler-options -Wno-deprecated-copy --compiler-options -Wno-nonnull-compare --compiler-options -Wno-interference-size -Xcompiler -Wno-nonnull-compare -Xcompiler -Wno-interference-size --threads 1 --relocatable-device-code=true --diag-suppress=221 -Xcompiler -Wno-reorder -Xcompiler -Wno-error=sign-compare -Xptxas=-w -MD -MT CMakeFiles/onnxruntime_providers_cuda.dir/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/onnxruntime/contrib_ops/cuda/moe/ft_moe/moe_kernel.cu.o -MF CMakeFiles/onnxruntime_providers_cuda.dir/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/onnxruntime/contrib_ops/cuda/moe/ft_moe/moe_kernel.cu.o.d -x cu -rdc=true -c /mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/onnxruntime/contrib_ops/cuda/moe/ft_moe/moe_kernel.cu -o CMakeFiles/onnxruntime_providers_cuda.dir/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/onnxruntime/contrib_ops/cuda/moe/ft_moe/moe_kernel.cu.o
/mnt/vcpkg-ci/installed/x64-linux/include/google/protobuf/message_lite.h(298): error: variable cannot have incomplete type "google::protobuf::internal::EnumTraitsImpl::Undefined"
    static Undefined value;
    ^

1 error detected in the compilation of "/mnt/vcpkg-ci/b/onnxruntime/src/v1.23.2-43def2af1b.clean/onnxruntime/contrib_ops/cuda/moe/ft_moe/moe_kernel.cu".

@abique abique force-pushed the onnxruntime-features branch from 87f64ea to 75a98c5 Compare April 16, 2026 08:54
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@abique abique marked this pull request as ready for review April 16, 2026 12:56
Comment thread ports/onnxruntime/fix-cmake-mlas.patch
Comment on lines +9 to +10
- target_link_options(onnxruntime PRIVATE ${onnxruntime_DELAYLOAD_FLAGS})
+ target_link_options(onnxruntime INTERFACE ${onnxruntime_DELAYLOAD_FLAGS})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this change is trying to do? (It seems strange to force customers to delayload but not delayload yourself.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't remember why I had to do this, I'd have to undo it to see what error showed up.


#include "core/common/flatbuffers.h"

+#if 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be trying to regenerate these rather than removing Flatbuffers' version lock here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to do that, and I don't know either where this idea that it needs to exactly match the version is coming from.
I believe it did break in the past but I'm not sure it is still the case with ongoing versions.
At least I didn't find anything in flatbuffer's documentation, and my deployment showed that it worked for me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillyONeal Please refer here to #49596 which still waits for VCPKG-Team-Review

)

if ("coreml" IN_LIST FEATURES)
vcpkg_from_github(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be its own port? (I'm looking to see if that has been considered, not necessarily asking you to do it)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onnxruntime takes a few files from that repo and compiles it itself, including generating some .proto file.

At least that's how it is currently done in onnxruntime.

Making another package? Maybe, but that'd make the build even more complex.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that by doing it this way as a patch we are making vcpkg the thing that is whacking flatbuffers over the head, and customers quite reasonably can come to us saying "why did you patch this out, you introduced security bug XYZ" or similar.

I understand you might not be familiar with how to do this correctly but there is a reason many of these components were turned off in vcpkg's registry before.

If this merges then the vcpkg maintainers need to be able to explain why our product is doing it and what the implications of that are. For some kinds of build/packaging changes we're happy to speak confidently that we know more about build tools than most component owners. But explicitly disregarding something that an upstream maintainer has gone out of their way to do generally has a high bar. (See also https://learn.microsoft.com/vcpkg/contributing/maintainer-guide#patching )

# relocates the onnxruntime_providers_* binaries before vcpkg_copy_pdbs()
function(reolocate_ort_providers)
if(VCPKG_TARGET_IS_WINDOWS AND (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic"))
if(VCPKG_TARGET_IS_WINDOWS AND ((VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") OR ("openvino" IN_LIST FEATURES)))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it can't be correct: turning on openvino changes how other providers are dealt with?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openvino provider builds as shared library regardless of vcpkg's setting.
They force that in onnxruntime.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could otherwise say that openvino isn't supported in dynamic builds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openvino provider builds as shared library regardless of vcpkg's setting.

Doesn't that mean we should do something like if ("openvino" IN LIST FEATURES) vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) endif() ?

@abique
Copy link
Copy Markdown
Contributor Author

abique commented Apr 17, 2026

I'm maybe being a bit naive here, but onnx and onnxruntime are both Microsoft efforts. Could we imagine some internal collaboration between vcpkg and onnx* to make them a first class citizen?

@abique
Copy link
Copy Markdown
Contributor Author

abique commented Apr 17, 2026

I'm going on holidays for a week, feel free to take this PR and modify/merge it 👍

@BillyONeal
Copy link
Copy Markdown
Member

I'm maybe being a bit naive here, but onnx and onnxruntime are both Microsoft efforts. Could we imagine some internal collaboration between vcpkg and onnx* to make them a first class citizen?

From the perspective of vcpkg's curated registry, there is no reason to treat onnxruntime any differently than any other port. Just because maintainers of both happen to be employed at Microsoft does not mean that we magically know each others' userbases, design constraints, or inner workings.

The rules vcpkg imposes on ports are about maintaining integrity of the registry itself because component owners rarely consider "what if two people did this" and "what about people who depend on something that depends on me" type of questions, for a large pile of historical reasons that boiled down to "just copy pasta their source is so much easier".

@BillyONeal
Copy link
Copy Markdown
Member

I'm going on holidays for a week, feel free to take this PR and modify/merge it 👍

For this reason I'm setting this to draft. When you come back and can speak to the particular patches feel free to re-mark "Ready for review"

@BillyONeal BillyONeal marked this pull request as draft April 17, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants