Skip to content

[ExecuTorch][WebGPU] Test coverage for the f16 KV cache#20771

Open
JCNTH wants to merge 1 commit into
gh/JCNTH/9/basefrom
gh/JCNTH/9/head
Open

[ExecuTorch][WebGPU] Test coverage for the f16 KV cache#20771
JCNTH wants to merge 1 commit into
gh/JCNTH/9/basefrom
gh/JCNTH/9/head

Conversation

@JCNTH

@JCNTH JCNTH commented Jul 7, 2026

Copy link
Copy Markdown

Stack from ghstack (oldest at bottom):

  • (to be filled)

Tests for the opt-in f16 KV cache (stacked op diff). When built with EXECUTORCH_WEBGPU_KV_F16 and run on a shader-f16 device, the SDPA op stores the K/V cache as f16, so the entire existing sdpa_with_kv_cache golden suite (config sweep + replay + dynamic decode) exercises the f16-KV path with no new goldens needed; this diff loosens the SDPA numeric tolerance to the f16 read-precision floor when — and only when — that path is active.

Key changes:

  • test_webgpu_native.cpp sdpa_within_tol — under #ifdef WGPU_BACKEND_KV_F16, compare at abs 2e-3 / rel 1e-2 when the device negotiated shader-f16, else keep the strict f32 abs 1e-4 / rel 1e-3. Every SDPA config/replay/decode golden then validates the f16-KV output through the existing exemplars.

Constraints: the default (flag-OFF) test build is unchanged; on a non-shader-f16 device (including the CI software adapter) the f16 KV path stays inactive and the strict f32 tolerance applies, so there is no CI behavior change. The f16-KV numeric validation is therefore shader-f16-device-only (Canary/Metal), matching the op's opt-in gating; no CI script change (mirrors the steel-f16 tests).

Co-authored-with: Claude Code.

Differential Revision: D110919973

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Cancelled Job

As of commit b2d3cef with merge base f8c8334 (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

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

@github-actions

github-actions Bot commented Jul 7, 2026

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants