onnxruntime
94661a49 - Accept legacy WebGPU/WebNN memory info names for backward compatibility (#27637)

Commit
199 days ago
Accept legacy WebGPU/WebNN memory info names for backward compatibility (#27637) ### Description Accept pre-1.25 names `"WebGPU_Buffer"`/`"WebNN_Tensor"` as aliases in `CreateMemoryInfo` and normalize them to the current short names `"WebGPU_Buf"`/`"WebNN_Ten"`. This is the **reverse** of https://github.com/microsoft/onnxruntime/pull/27475 (which added forward compatibility in the 1.24.x patch branch). ### Motivation and Context Released onnxruntime-genai still uses the old (pre-1.25) long names when calling `CreateMemoryInfo`. Without this change, those calls fail with `ORT_INVALID_ARGUMENT` on main branch. ### Key Design Decision When an old name is detected, it is **normalized** to the current short constant (e.g., `"WebGPU_Buffer"` -> `"WebGPU_Buf"`). This is critical because downstream code (e.g., `external_data_loader.cc`, `webgpu_context.cc`) compares `OrtMemoryInfo.name` against the current constants. Simply passing through the old name would cause those comparisons to fail. ### Changes - `onnxruntime/core/framework/allocator.cc`: Accept and normalize legacy names in `CreateMemoryInfo` - `onnxruntime/test/shared_lib/test_allocator.cc`: Add test verifying legacy names are accepted and normalized ### See Also - https://github.com/microsoft/onnxruntime/pull/27207 (original rename) - https://github.com/microsoft/onnxruntime/pull/27475 (forward compat in 1.24.x) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
Parents
Loading