webgpu : avoid crash when offset is not multiple of 4 in WebGPU ggml_backend_tensor_get() implementation - #28045
Conversation
…backend_tensor_get() implementation
|
@ggerganov WebGPU CI failed anyway because of #27960, so #28071 is needed too. |
ef89f4f to
1510317
Compare
Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
1510317 to
b74c0f6
Compare
@CISC Should be OK now, but needs re-approval |
@fairydreaming FYI, We format the WebGPU C++ code with clangd version 22 or later. But the EditorConfig error looks like it's already been resolved :) |
@yomaytk Yeah, the reason was DOS/Windows EOL characters that GitHub added when I accepted @CISC review changes |
…backend_tensor_get() implementation (ggml-org#28045) * webgpu : avoid crash when offset is not multiple of 4 in WebGPU ggml_backend_tensor_get() implementation * chore : improve code readability Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co> --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com> Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
…backend_tensor_get() implementation (ggml-org#28045) * webgpu : avoid crash when offset is not multiple of 4 in WebGPU ggml_backend_tensor_get() implementation * chore : improve code readability Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co> --------- Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com> Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
Overview
WebGPU uses
CopyBufferToBuffer()that requires size and offsets to be multiplies of 4 in itsggml_backend_tensor_get()implementation. While the implementation rounds size internally, offset was not rounded, so it crashed for offset values not equal to a multiple of 4.Additional information
This fix adds a local offset to make sure the global offset passed to
CopyBufferToBuffer()is a multiple of 4.Requirements