Using memcpy on tensor data when the tensor is not contiguous
audiovention opened this issue · comments
audiovention commented
I see in some places in the codebase the implicit assumption that a tensor's memory is contiguous, without any checks/asserts.
For example "ggml_metal_set_tensor" (get_tensor as well) has:
memcpy((void *) ((uint8_t *) id_dst.contents + offs), t->data, ggml_nbytes(t));
I just want to confirm - this would produce wrong results if the tensor has non-identity strides right?
Georgi Gerganov commented
Yes that's correct. In some places the necessary checks / asserts are missing.