Skip to content

Handle null plugin EP allocators - #32683

Merged
Vineeth Chelur (crvineeth97) merged 3 commits into
microsoft:mainfrom
crvineeth97:vchelur/fix-null-plugin-ep-allocator
Sep 22, 2026
Merged

Vineeth Chelur (crvineeth97) merged 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.

@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.

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 Resolved
Vineeth Chelur added 3 commits September 21, 2026 15:05
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) force-pushed the vchelur/fix-null-plugin-ep-allocator branch from 6522266 to 06707b7 Compare September 21, 2026 22:05
@crvineeth97
Vineeth Chelur (crvineeth97) merged commit 536f161 into microsoft:main Sep 22, 2026
92 of 94 checks passed
@crvineeth97
Vineeth Chelur (crvineeth97) deleted the vchelur/fix-null-plugin-ep-allocator branch September 22, 2026 00:16
This was referenced Nov 2, 2026
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