Skip to content

[NvTensorRTRTX EP]: Add missing override specifiers to suppress warnings#27288

Open
theHamsta wants to merge 1 commit intomicrosoft:mainfrom
theHamsta:sseitz/nvep-warnings
Open

[NvTensorRTRTX EP]: Add missing override specifiers to suppress warnings#27288
theHamsta wants to merge 1 commit intomicrosoft:mainfrom
theHamsta:sseitz/nvep-warnings

Conversation

@theHamsta
Copy link
Contributor

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-override with this PR in TRT NV EP.

/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(); }

Motivation and Context

Fixing clang warnings enables builds with clang on Linux since -Werror enforces warning-free builds.

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(); }
```
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 override to NvExecutionProvider::GetDeviceId() and NvExecutionProvider::Sync().
  • Add override to NvProviderFactory::CreateProvider(const OrtSessionOptions&, const OrtLogger&).
  • Add override to Nv_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.

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.

1 participant