ggml : fix row size compute to avoid overflows

This commit is contained in:
Georgi Gerganov 2023-12-14 13:49:20 +02:00
parent 8a7cfaf946
commit ed866f550b
No known key found for this signature in database
GPG key ID: 449E073F9DC10735

3
ggml.c
View file

@ -2012,7 +2012,8 @@ size_t ggml_type_size(enum ggml_type type) {
}
size_t ggml_row_size(enum ggml_type type, int64_t ne) {
return (ggml_type_size(type)*ne)/ggml_blck_size(type);
assert(ne % ggml_blck_size(type) == 0);
return ggml_type_size(type)*ne/ggml_blck_size(type);
}
double ggml_type_sizef(enum ggml_type type) {