Skip to content

Handle null plugin EP allocators - #32683

Open
Vineeth Chelur (crvineeth97) wants to merge 3 commits into
microsoft:mainfrom
crvineeth97:vchelur/fix-null-plugin-ep-allocator
Open

Vineeth Chelur (crvineeth97) wants to merge 3 commits into
microsoft:mainfrom
crvineeth97:vchelur/fix-null-plugin-ep-allocator

Conversation

@crvineeth97

@crvineeth97 Vineeth Chelur (crvineeth97) commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Why

When the QNN HTP shared-memory allocator is disabled, QNN can validly return success with a null per-session HOST_ACCESSIBLE allocator to request ORT's default CPU allocator. PluginExecutionProvider::CreatePreferredAllocators instead dereferenced the null pointer during session initialization. CPU memory allocation here is independent of CPU execution-provider fallback.

What Changed

Skip a null per-session allocator before querying allocator metadata or taking ownership. Add regression coverage for this path.

How Tested

Added OrtEpLibrary.PluginEp_NullSessionAllocatorUsesDefaultCpuAllocator. Not run locally because this worktree has no existing compatible ORT build cache.

OrtEp and OrtEpFactory CreateAllocator may succeed with a null allocator to request default CPU allocation. Skip that optional preferred allocator before Info() and ownership wrapping; preserve errors and non-null ownership paths.

Add a default-off example EP option returning success/null for HOST_ACCESSIBLE session memory and reuse the Mul inference regression helper. CPU execution-provider fallback policy is unchanged.
@crvineeth97
Vineeth Chelur (crvineeth97) marked this pull request as ready for review September 17, 2026 20:48
Copilot AI balanced review requested due to automatic review settings September 17, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Factory allocator creation can still dereference null during EP-library registration.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds null allocator handling for plugin EP session allocators.

Changes:

  • Skips null preferred allocators.
  • Adds an example EP configuration option.
  • Adds regression coverage for the per-session path.
File summaries
File Description
test_execution.cc Adds regression test.
ep.h Adds allocator configuration flag.
ep.cc Returns null for host-accessible allocation.
ep_factory.cc Parses the test configuration.
ep_plugin_provider_interfaces.cc Skips null session allocators.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread onnxruntime/core/session/plugin_ep/ep_plugin_provider_interfaces.cc Outdated
Comment thread onnxruntime/core/session/plugin_ep/ep_plugin_provider_interfaces.cc

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The functional paths and regression coverage are sound; the remaining feedback concerns public API documentation.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread onnxruntime/core/session/environment.cc Outdated
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.

3 participants