Repository navigation
[executorch][native-vulkan] Run bf16 methods in f32 on the Vulkan engine - #25095
Open
digantdesai wants to merge 1 commit into
Open
digantdesai wants to merge 1 commit into
digantdesai wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/25095
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit 1e7adcb with merge base 925c1bd ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Nov 14, 2026
This PR needs a
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
ET-VK has no bf16 storage, so the Native Vulkan engine rejected every bf16 method when it compiled. It now runs them in f32 on the device, the way it already runs int64 as int32.
device_dtypemaps BFloat16 to Float, and bf16 constants are widened to f32 host copies at load, next to the int64 narrowing. The method still reports bf16 frominput_dtypeandoutput_dtype, so callers pass and receive bf16 as before.A bf16 tensor holds bf16 values at the host boundary whatever the host dtype:
set_inputrounds BFloat16 or Float host data to bf16, andget_outputrounds the f32 result to the nearest bf16 before writing BFloat16 or Float. Other host dtypes are rejected. Between ops, values stay f32, so a method with several ops skips the bf16 rounding eager applies after each one, and its results match eager within bf16 tolerance rather than exactly. For example,(1 + 2^-8) - 1returns2^-8, where eager returns 0.Every widened constant stays on the heap until prepack releases it, so loading a bf16 model needs about twice its bf16 weight size in extra host memory.
Memory planning now sizes each request by its device dtype, which doubles bf16 requests and halves int64 ones. ET-VK sizes each shared object from the tensors bound to it, so this only keeps the planner's ordering consistent with the device sizes.
buffer_attention_fitsalso counts SDPA attention weights at the device element size, so a bf16 attention no longer picks buffer storage up to twice the storage buffer limit.LowerRMSNormalso accepts bf16 norms, which now run the f32et_vk.rms_normkernel. Quantized linears and embeddings with bf16 scales still fail, becauseFuseQuantizedLinearandFuseQuantizedEmbeddingmatch only f32 and f16 scales.Authored with Claude Code.
Differential Revision: D131119348
NOTE FOR REVIEWERS: This PR has internal Meta-specific changes or comments, please review them on Phabricator!