Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion onnxruntime/core/framework/allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,19 @@ ORT_API_STATUS_IMPL(OrtApis::CreateMemoryInfo, _In_ const char* name1, enum OrtA
OrtDevice(OrtDevice::GPU, OrtDevice::MemType::DEFAULT, OrtDevice::VendorIds::AMD, device_id),
mem_type1);
} else if (strcmp(name1, onnxruntime::WEBGPU_BUFFER) == 0 ||
strcmp(name1, onnxruntime::WEBNN_TENSOR) == 0) {
strcmp(name1, onnxruntime::WEBNN_TENSOR) == 0 ||
// PR #27207 (merged to main/1.25.x, not in 1.24.x) shortened the WebGPU/WebNN
// memory info names from "WebGPU_Buffer"/"WebNN_Tensor" to "WebGPU_Buf"/"WebNN_Ten"
// to enable Small String Optimization (SSO) on wasm32 (emscripten), where strings
// must be <= 10 chars for SSO.
//
// A WebGPU/WebNN plugin EP built against 1.25.x will use the new short names.
// Accept both old and new names here so that plugin EPs targeting either 1.24.x
// or 1.25.x can work with this 1.24.x runtime.
//
// See: https://github.com/microsoft/onnxruntime/pull/27207
strcmp(name1, "WebGPU_Buf") == 0 ||
strcmp(name1, "WebNN_Ten") == 0) {
Comment on lines +240 to +252

Copilot AI Feb 27, 2026

Copy link

Choose a reason for hiding this comment

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

This change also adds support for the WebNN short name ("WebNN_Ten"), but the PR title/description only mention WebGPU. Please update the PR description (or remove the WebNN part) so the change scope matches what’s being shipped.

Copilot uses AI. Check for mistakes.
Comment on lines +241 to +252

Copilot AI Feb 27, 2026

Copy link

Choose a reason for hiding this comment

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

There’s no regression test ensuring CreateMemoryInfo accepts the new short aliases and produces a usable memory info for subsequent allocator/device matching. Adding a small shared_lib test that calls the public C/C++ API with "WebGPU_Buf" (and optionally "WebNN_Ten") would help prevent future breakage of this compatibility behavior.

Copilot uses AI. Check for mistakes.
*out = new OrtMemoryInfo(
name1, type,
OrtDevice(OrtDevice::GPU, OrtDevice::MemType::DEFAULT, OrtDevice::VendorIds::NONE, device_id),
Expand Down
Loading