* Early return for zero size calls to get_tensor.
Signed-off-by: Adam Treat <redacted>
* Update ggml-kompute.cpp
Co-authored-by: Georgi Gerganov <redacted>
* Update ggml-kompute.cpp
Co-authored-by: Georgi Gerganov <redacted>
* Add an early return to the get/set tensor when the size is null.
Signed-off-by: Adam Treat <redacted>
* Early return after the assertions.
Signed-off-by: Adam Treat <redacted>
* Since we do the early return in the generic backend now no reason to do so here as well.
Signed-off-by: Adam Treat <redacted>
---------
Signed-off-by: Adam Treat <redacted>
Co-authored-by: Georgi Gerganov <redacted>
GGML_ASSERT(buf != NULL && "tensor buffer not set");
GGML_ASSERT(offset + size <= ggml_nbytes(tensor) && "tensor write out of bounds");
+ if (!size) {
+ return;
+ }
+
tensor->buffer->iface.set_tensor(buf, tensor, data, offset, size);
}
GGML_ASSERT(tensor->buffer != NULL && "tensor buffer not set");
GGML_ASSERT(offset + size <= ggml_nbytes(tensor) && "tensor read out of bounds");
+ if (!size) {
+ return;
+ }
+
tensor->buffer->iface.get_tensor(buf, tensor, data, offset, size);
}