From 46dc0b5f2106e1db6146c1c7c0d9c64577eb78b7 Mon Sep 17 00:00:00 2001 From: Adrian Lizarraga Date: Wed, 22 Jan 2025 21:26:24 -0800 Subject: [PATCH 1/2] [QNN EP] Add LoggingManager::HasDefaultLogger() to provider bridge API (#23467) ### Description Fixes QNN EP builds due to missing function in provider bridge API: `logging::LoggingManager::HasDefaultLogger()` ### Motivation and Context A [recent PR](https://github.com/microsoft/onnxruntime/pull/23120) made QNN EP a shared library. A [different PR](https://github.com/microsoft/onnxruntime/pull/23435) added use of a new function to QNN EP that was not part of the provider bridge API. The CI did not catch it because main was not merged into the first PR before merging. --- onnxruntime/core/providers/shared_library/provider_interfaces.h | 1 + .../core/providers/shared_library/provider_wrappedtypes.h | 1 + onnxruntime/core/session/provider_bridge_ort.cc | 1 + 3 files changed, 3 insertions(+) diff --git a/onnxruntime/core/providers/shared_library/provider_interfaces.h b/onnxruntime/core/providers/shared_library/provider_interfaces.h index d22cb2ed00069..962d10d8952d6 100644 --- a/onnxruntime/core/providers/shared_library/provider_interfaces.h +++ b/onnxruntime/core/providers/shared_library/provider_interfaces.h @@ -286,6 +286,7 @@ struct ProviderHost { // logging::LoggingManager virtual const logging::Logger& logging__LoggingManager__DefaultLogger() = 0; + virtual bool logging__LoggingManager__HasDefaultLogger() = 0; // logging::Capture virtual std::unique_ptr logging__Capture__construct(const logging::Logger& logger, diff --git a/onnxruntime/core/providers/shared_library/provider_wrappedtypes.h b/onnxruntime/core/providers/shared_library/provider_wrappedtypes.h index 1b6c29e68670d..e434935343663 100644 --- a/onnxruntime/core/providers/shared_library/provider_wrappedtypes.h +++ b/onnxruntime/core/providers/shared_library/provider_wrappedtypes.h @@ -32,6 +32,7 @@ struct Logger final { struct LoggingManager final { static const Logger& DefaultLogger() { return g_host->logging__LoggingManager__DefaultLogger(); } + static bool HasDefaultLogger() { return g_host->logging__LoggingManager__HasDefaultLogger(); } PROVIDER_DISALLOW_ALL(LoggingManager) }; diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc index 3239e2b6e36e9..d7c6dab72fde8 100644 --- a/onnxruntime/core/session/provider_bridge_ort.cc +++ b/onnxruntime/core/session/provider_bridge_ort.cc @@ -397,6 +397,7 @@ struct ProviderHostImpl : ProviderHost { // logging::LoggingManager (wrapped) const logging::Logger& logging__LoggingManager__DefaultLogger() override { return logging::LoggingManager::DefaultLogger(); } + bool logging__LoggingManager__HasDefaultLogger() override { return logging::LoggingManager::HasDefaultLogger(); } // logging::Capture (wrapped) std::unique_ptr logging__Capture__construct(const logging::Logger& logger, From 06fc73b7d4d80bd97e140776590d98b868c7bc3a Mon Sep 17 00:00:00 2001 From: Adrian Lizarraga Date: Thu, 23 Jan 2025 08:54:55 -0800 Subject: [PATCH 2/2] [TRT EP Perf Tool] Add annotations import to python script to support annotations on Python 3.8 (#23466) ### Description Adds `from __future__ import annotations` to python script to support annotations on Python 3.8. ### Motivation and Context Pipeline that runs this script is using Ubuntu 20.04's default python version (3.8), which does not support annotations unless one imports from __future__. --- onnxruntime/python/tools/tensorrt/perf/build/build_image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/onnxruntime/python/tools/tensorrt/perf/build/build_image.py b/onnxruntime/python/tools/tensorrt/perf/build/build_image.py index 0384300b99445..7f418af06a4ec 100644 --- a/onnxruntime/python/tools/tensorrt/perf/build/build_image.py +++ b/onnxruntime/python/tools/tensorrt/perf/build/build_image.py @@ -6,6 +6,8 @@ Builds an Ubuntu-based Docker image with TensorRT. """ +from __future__ import annotations + import argparse import os import pty