Giter Club home page Giter Club logo

Comments (15)

snnn avatar snnn commented on July 17, 2024 1

The "com.microsoft:EPContext" op is a contrib op, for implementing TensorRT EP.

from onnxruntime.

xadupre avatar xadupre commented on July 17, 2024

Thanks for reporting this issue, it seems method AdjustOutputSizeAsPolicy is sometimes excluded if DISABLE_CONTRIB_OPS is on, sometimes not like here https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/shared_library/provider_bridge_provider.cc#L586

from onnxruntime.

MiroPsota avatar MiroPsota commented on July 17, 2024

It indeed builds without onnxruntime_DISABLE_CONTRIB_OPS=ON. Any tips how to fix it for 1.18.1?

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

I submitted a PR for this.

from onnxruntime.

MiroPsota avatar MiroPsota commented on July 17, 2024

I tried this fix already, but then I could not create CUDAExecutionProvider:

[E:onnxruntime:Default, provider_bridge_ort.cc:1745 TryGetProviderInfo_CUDA] <redacted>/onnxruntime-1.18.1/onnxruntime/core/session/provider_bridge_ort.cc:1426 onnxruntime::Provider& onnxruntime::ProviderLibrary::Get() [ONNXRuntimeError] : 1 : FAIL : Failed to load library libonnxruntime_providers_cuda.so with error: <redacted>/python3.11/site-packages/onnxruntime/capi/libonnxruntime_providers_cuda.so: undefined symbol: _ZN11onnxruntime4cuda21BuildKernelCreateInfoINS0_57kCudaExecutionProvider_GridSample_kOnnxDomain_ver16_floatEEENS_16KernelCreateInfoEv

which is after demangling

onnxruntime::KernelCreateInfo onnxruntime::cuda::BuildKernelCreateInfo<onnxruntime::cuda::kCudaExecutionProvider_GridSample_kOnnxDomain_ver16_float>()

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

A side question: may I know why do you need to set onnxruntime_DISABLE_CONTRIB_OPS to ON? The build option is for reducing binary size. However, CUDA itself is already very large. Disabling contrib ops does not help much.

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

I will update the PR.

from onnxruntime.

MiroPsota avatar MiroPsota commented on July 17, 2024

I like the smaller size, but I also appreciate the much faster compilation. I think it's more than 2-3 times faster on my PC, and I'm currently compiling for just one CUDA architecture. This difference includes the fact that I can use more threads, as compiling contrib kernels takes up too much RAM.

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

Would you mind trying it again? Now it should be good.

from onnxruntime.

MiroPsota avatar MiroPsota commented on July 17, 2024

I applied the patch to version 1.18.1 with TRT 8.6 as described here and CUDAExecutionProvider works.

Probably not related to the PR:
However, when I run my model for the first time with the TensorRT Execution Provider (EP) and contrib ops disabled, it creates an .engine file and throws the following error:

RUNTIME_EXCEPTION : Exception during initialization: <path>/onnxruntime/core/providers/tensorrt/onnx_ctx_model_helper.cc:127 onnx::ModelProto* onnxruntime::CreateCtxModel(const onnxruntime::GraphViewer&, std::string, char*, size_t, int64_t, std::string, std::string, const onnxruntime::logging::Logger*) graph_build.Resolve().IsOK() was false. 

Subsequent runs are successful if the .engine file is present in the cache. However, if I delete the .engine file, it fails again. This issue does not occur when contrib ops are enabled. I will investigate further and maybe open an another issue.

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

Open onnxruntime/core/providers/tensorrt/onnx_ctx_model_helper.cc, find line 127, replace ORT_ENFORCE with ORT_THROW_IF_ERROR.

The new code should be:

ORT_THROW_IF_ERROR(graph_build.Resolve());

Then please let us know what error message you see.

from onnxruntime.

MiroPsota avatar MiroPsota commented on July 17, 2024
[E:onnxruntime:, inference_session.cc:2044 operator()] Exception during initialization: <path>/onnxruntime/core/providers/tensorrt/onnx_ctx_model_helper.cc:127 onnx::ModelProto* onnxruntime::CreateCtxModel(const onnxruntime::GraphViewer&, std::string, char*, size_t, int64_t, std::string, std::string, const onnxruntime::logging::Logger*) [ONNXRuntimeError] : 1 : FAIL : Fatal error: com.microsoft:EPContext(-1) is not a registered function/op

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

Ok .. As it says , it is not supported. You may open a new issue for this error.

from onnxruntime.

MiroPsota avatar MiroPsota commented on July 17, 2024

The interesting thing is that it will create an .engine file and it works with subsequent runs, until I delete the .engine file, with no errors and correct output.

from onnxruntime.

snnn avatar snnn commented on July 17, 2024

The issue has been fixed in #20695

from onnxruntime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.