From e124cf8e768d6f909f9288159fef4161ac7fe2ac Mon Sep 17 00:00:00 2001 From: vivianw-amd Date: Fri, 10 May 2024 00:01:23 -0700 Subject: [PATCH] set unload to false to prevent crash when linux lib load not successfully (#20626) ### Description during VITSIAI shared library load, set unload to false to prevent crash when linux lib load not successfully ### Motivation and Context for Linux environment, when library not loaded successfully, it will end up with crash without giving any useful message. the fix is to prevent the crash and give the useful message when shared library not loaded correctly. --- onnxruntime/core/session/provider_bridge_ort.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc index 80bd301c20..35c22797a2 100644 --- a/onnxruntime/core/session/provider_bridge_ort.cc +++ b/onnxruntime/core/session/provider_bridge_ort.cc @@ -1495,7 +1495,12 @@ static ProviderLibrary s_library_rocm(LIBRARY_PREFIX ORT_TSTR("onnxruntime_provi #endif ); static ProviderLibrary s_library_dnnl(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_dnnl") LIBRARY_EXTENSION); -static ProviderLibrary s_library_vitisai(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_vitisai") LIBRARY_EXTENSION); +static ProviderLibrary s_library_vitisai(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_vitisai") LIBRARY_EXTENSION +#ifndef _WIN32 + , + false /* unload - On Linux if we unload the vitisai shared provider we crash */ +#endif +); static ProviderLibrary s_library_openvino(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_openvino") LIBRARY_EXTENSION); static ProviderLibrary s_library_tensorrt(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_tensorrt") LIBRARY_EXTENSION #ifndef _WIN32