Skip to content

[Web] Decode packed BF16 tensor records in place - #20167

Open
akaashrp wants to merge 1 commit into
apache:mainfrom
akaashrp:memory/04-inplace-bf16-decode
Open

[Web] Decode packed BF16 tensor records in place#20167
akaashrp wants to merge 1 commit into
apache:mainfrom
akaashrp:memory/04-inplace-bf16-decode

Conversation

@akaashrp

@akaashrp akaashrp commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

WIP: merge #20166 first

Reduce peak WASM memory during BF16 tensor-cache loading by decoding directly in the final float32 CPU tensor allocation. The packed BF16 input is copied into the lower half of the destination tensor and expanded backward, preventing output writes from overwriting unread input. This removes the separate FFI byte-array allocation previously required during decoding. Leave the existing decoder as a fallback when the new WASM entry point is unavailable.

Packed BF16 decoding currently uses separate input and output storage. Add a Wasm entry point that expands values backward in the destination buffer after the packed bytes have been copied into its lower half.

Use the in-place path when the entry point is available and keep the existing decoder otherwise. Both paths account for DLTensor byte_offset.
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.

1 participant