[NvTensorRTRTX EP]: Add missing override specifiers to suppress warnings#27288
Open
theHamsta wants to merge 1 commit intomicrosoft:mainfrom
Open
[NvTensorRTRTX EP]: Add missing override specifiers to suppress warnings#27288theHamsta wants to merge 1 commit intomicrosoft:mainfrom
theHamsta wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Compilation on Clang toolchains fails due to this warning (among
others) since ONNX runtime compiles with -Werror by default.
```
/home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h:309:7: error: 'GetDeviceId' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
309 | int GetDeviceId() const { return device_id_; }
| ^
/home/stephan/projects/onnxruntime-winai/include/onnxruntime/core/framework/execution_provider.h:183:15: note: overridden virtual function is here
183 | virtual int GetDeviceId() const { return default_device_.Id(); }
| ^
In file included from /home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/nv_tensorrt_rtx/nv_provider_factory.cc:18:
/home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h:310:10: error: 'Sync' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
310 | Status Sync() const;
| ^
/home/stephan/projects/onnxruntime-winai/include/onnxruntime/core/framework/execution_provider.h:231:26: note: overridden virtual function is here
231 | virtual common::Status Sync() const { return Status::OK(); }
| ^
/home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/nv_tensorrt_rtx/nv_provider_factory.cc:63:39: error: 'CreateProvider' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
63 | std::unique_ptr<IExecutionProvider> CreateProvider(const OrtSessionOptions& session_options,
| ^
/home/stephan/projects/onnxruntime-winai/include/onnxruntime/core/providers/providers.h:29:47: note: overridden virtual function is here
29 | virtual std::unique_ptr<IExecutionProvider> CreateProvider(const OrtSessionOptions& session_options,
| ^
/home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/nv_tensorrt_rtx/nv_provider_factory.cc:112:46: error: 'CreateExecutionProviderFactory' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
112 | std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory(const void* param) {
| ^
/home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/shared_library/provider_host_api.h:19:54: note: overridden virtual function is here
19 | virtual std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory(const void* /*provider_options*/) { return nullptr;
/home/stephan/projects/onnxruntime-winai/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h:309:7: error: 'GetDeviceId' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
309 | int GetDeviceId() const { return device_id_; }
| ^
/home/stephan/projects/onnxruntime-winai/include/onnxruntime/core/framework/execution_provider.h:183:15: note: overridden virtual function is here
183 | virtual int GetDeviceId() const { return default_device_.Id(); }
```
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Clang -Winconsistent-missing-override build failures (with -Werror) in the NvTensorRTRTX execution provider by adding missing override specifiers to methods that already override virtual base-class APIs.
Changes:
- Add
overridetoNvExecutionProvider::GetDeviceId()andNvExecutionProvider::Sync(). - Add
overridetoNvProviderFactory::CreateProvider(const OrtSessionOptions&, const OrtLogger&). - Add
overridetoNv_Provider::CreateExecutionProviderFactory(const void*).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| onnxruntime/core/providers/nv_tensorrt_rtx/nv_provider_factory.cc | Marks overridden factory/provider interface methods with override to satisfy Clang’s consistency warning. |
| onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.h | Marks overridden IExecutionProvider methods with override to satisfy Clang’s consistency warning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Compilation on Clang toolchains on Linux currently fails due to this warning (among others) since ONNX runtime compiles with -Werror by default. We address
-Winconsistent-missing-overridewith this PR in TRT NV EP.Motivation and Context
Fixing clang warnings enables builds with clang on Linux since
-Werrorenforces warning-free builds.