Skip to content

Add rms_norm op + named-data upload#19893

Open
JulianCloudNTH wants to merge 1 commit into
pytorch:mainfrom
JulianCloudNTH:export-D106887028
Open

Add rms_norm op + named-data upload#19893
JulianCloudNTH wants to merge 1 commit into
pytorch:mainfrom
JulianCloudNTH:export-D106887028

Conversation

@JulianCloudNTH
Copy link
Copy Markdown

Summary:
Adds the et_vk.rms_norm.default operator to the WebGPU backend (WGSL compute shader using a cooperative tree reduction, one workgroup per row) and fixes constant upload so the op's weight loads correctly.

The Vulkan serializer that the WebGPU backend reuses stores every non-empty constant (e.g. the rms_norm weight) in the PTE's named-data map with offset == UINT64_MAX and a named_key, rather than inline in the VK00 blob. WebGPUGraph::build previously handled only inline constants, so the weight was never uploaded and the op returned all zeros. build now also fetches named-data constants via NamedDataMap::get_data, mirroring the path VulkanBackend already uses. aten.add was unaffected since it has no constant tensors.

The shader and CPU reference mirror the Vulkan implementation (backends/vulkan/runtime/graph/ops/impl/RmsNorm.cpp, backends/vulkan/runtime/graph/ops/glsl/rms_norm_buffer.glsl); indexing assumes contiguous fp32 inputs.

Differential Revision: D106887028

Summary:
Adds the `et_vk.rms_norm.default` operator to the WebGPU backend (WGSL compute shader using a cooperative tree reduction, one workgroup per row) and fixes constant upload so the op's weight loads correctly.

The Vulkan serializer that the WebGPU backend reuses stores every non-empty constant (e.g. the rms_norm weight) in the PTE's named-data map with `offset == UINT64_MAX` and a `named_key`, rather than inline in the VK00 blob. `WebGPUGraph::build` previously handled only inline constants, so the weight was never uploaded and the op returned all zeros. `build` now also fetches named-data constants via `NamedDataMap::get_data`, mirroring the path `VulkanBackend` already uses. `aten.add` was unaffected since it has no constant tensors.

The shader and CPU reference mirror the Vulkan implementation (`backends/vulkan/runtime/graph/ops/impl/RmsNorm.cpp`, `backends/vulkan/runtime/graph/ops/glsl/rms_norm_buffer.glsl`); indexing assumes contiguous fp32 inputs.

Differential Revision: D106887028
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 30, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19893

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit b484870 with merge base 5395f20 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 30, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 30, 2026

@JulianCloudNTH has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106887028.

@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant