Skip to content

Accept legacy WebGPU/WebNN memory info names for backward compatibility#27637

Merged
fs-eire merged 1 commit intomainfrom
fs-eire/legacy-webgpu-meminfo-names
Mar 13, 2026
Merged

Accept legacy WebGPU/WebNN memory info names for backward compatibility#27637
fs-eire merged 1 commit intomainfrom
fs-eire/legacy-webgpu-meminfo-names

Conversation

@fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Mar 12, 2026

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 #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

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 allows released onnxruntime-genai
(which still uses the old long names) to work with main branch ORT.

The normalization is critical because downstream code (external data
loader, WebGPU context) compares memory info names against the current
constants. Without normalization, those comparisons would fail.

See: #27207
See: #27475

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fs-eire fs-eire enabled auto-merge (squash) March 13, 2026 05:21
@fs-eire fs-eire merged commit 94661a4 into main Mar 13, 2026
101 of 103 checks passed
@fs-eire fs-eire deleted the fs-eire/legacy-webgpu-meminfo-names branch March 13, 2026 06:08
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.

2 participants