Repository navigation
rpc : keep backend tensor extras on the server - #341
Merged
Merged
Conversation
Backends like OpenCL keep per-tensor state in tensor->extra. init_tensor creates it and set_tensor can replace it (re-laid-out quantized weights). The RPC server deserializes a new tensor for each command, so this state was lost and OpenCL asserted in set_tensor (GGML_ASSERT(extra)). Keep the extras on the server, keyed by buffer, data, type and shape. Attach them on deserialization, store the new extra after writes, use the parent extra for graph views, and drop them when the buffer is freed. Backends whose init_tensor does not set an extra are not affected. Add test-rpc-extras: a CPU-backed device with OpenCL-style extras behind an in-process RPC server. It fails without this change. Assisted-by: Claude Opus 5.5
Fixes the GGML_BACKEND_DL link failure on windows / x64-openblas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An RPC server creates a new ggml_tensor per command; the extra is what persists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s extra Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCL reads the whole tensor from the source when re-laying it out, which over-read the received payload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Overview
The RPC server deserializes a new tensor for every command, so backends that keep state in
tensor->extra(OpenCL) lose it and abort inset_tensor. This keeps the extras on the server, keyed by buffer, data, type and shape.view_src.ggml_nbytes.Backends without extras (CPU, Metal, Vulkan) are unaffected. This is #339 ported to
temp-11018.Testing
test-rpc-extrasfails without this change and passes with it.test-rpc-*pass.Requirements
🤖 Generated with Claude Code