Repository navigation
perftest: Use plugin EP device allocators for input/output buffers - #32244
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Updates perftest to select allocators exposed by plugin EP devices.
Changes:
- Returns selected plugin EP devices during session setup.
- Chooses a default or host-accessible plugin allocator.
- Falls back to the CPU allocator for ambiguous/unavailable devices.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
onnxruntime/test/perftest/utils.h |
Declares plugin device and allocator-selection APIs. |
onnxruntime/test/perftest/common_utils.cc |
Implements selected-device tracking and allocator lookup. |
onnxruntime/test/perftest/ort_test_session.cc |
Applies the selected allocator to perftest buffers. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
7a786fa to
f2f28be
Compare
|
Should we have an option to make it configurable? |
Added an option to force cpu allocator, leaving plugin EP allocators as default as they would be best for performance. |
|
The issue mentioned above needs to be addressed.
|
Chi Lo (@chilo-ms) Adressed it in may last commit. |
Description
Adds support for using a plugin EP device's own allocator for input/output buffers in
onnxruntime_perf_test, instead of always using the CPU allocator.--plugin_eps),onnxruntime_perf_testnow selects an allocator from the appendedOrtEpDevice: it prefers the device's default (device-only) allocator, falls back to its host-accessible allocator, and falls back to the CPU allocator if neither is available or if more than one EP device was appended (no single unambiguous allocator to pick).-r) and pre-allocated fixed-shape outputs now use this allocator instead of the CPU allocator.Ort::Env::CopyTensor), instead of being copied per-Run()implicitly.std::stringis placement-constructed by ORT directly into the tensor's owned memory and can't safely live in device-only memory.[Plugin EP]-prefixed logging indicating which allocator was selected.Motivation and Context
onnxruntime_perf_testpreviously always allocated input/output buffers on the CPU when running with plugin EPs. For plugin EPs whose kernels expect device-resident inputs/outputs, this meant everyRun()iteration paid for an implicit host↔device copy that was entirely avoidable, skewing per-iteration latency measurements away from the EP's actual compute cost. Selecting and reusing the EP device's own allocator up front lets perf numbers better reflect steady-state inference cost for plugin EPs.