ggml-et : remove useless alloca() (#29663)

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
Adrien Gallouët
2026-09-30 15:14:45 +02:00
committed by GitHub
parent 3b3d022b82
commit bdeb855b30
+6 -7
View File
@@ -15,6 +15,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#if __has_include(<filesystem>)
@@ -32,9 +33,7 @@ namespace fs = std::experimental::filesystem;
* @brief prints the metadata of a single tensorf
*/
static void ggml_et_dump_tensor_metadata(const ggml_tensor * ggtensor, size_t indent_level, const char * title) {
char * spaces = (char *) alloca(indent_level + 1);
memset(spaces, ' ', indent_level);
spaces[indent_level] = '\0';
std::string spaces(indent_level, ' ');
fprintf(stderr,
"%s%s: %s\n"
"%s type: %s\n"
@@ -43,10 +42,10 @@ static void ggml_et_dump_tensor_metadata(const ggml_tensor * ggtensor, size_t in
"%s op: %s\n"
"%s data: %p\n"
"%s src0: %p\n",
spaces, title, ggtensor->name, spaces, ggml_type_name(ggtensor->type), spaces, (long long) ggtensor->ne[0],
(long long) ggtensor->ne[1], (long long) ggtensor->ne[2], (long long) ggtensor->ne[3], spaces,
ggtensor->nb[0], ggtensor->nb[1], ggtensor->nb[2], ggtensor->nb[3], spaces, ggml_op_name(ggtensor->op),
spaces, ggtensor->data, spaces, (void *) ggtensor->src[0]);
spaces.c_str(), title, ggtensor->name, spaces.c_str(), ggml_type_name(ggtensor->type), spaces.c_str(), (long long) ggtensor->ne[0],
(long long) ggtensor->ne[1], (long long) ggtensor->ne[2], (long long) ggtensor->ne[3], spaces.c_str(),
ggtensor->nb[0], ggtensor->nb[1], ggtensor->nb[2], ggtensor->nb[3], spaces.c_str(), ggml_op_name(ggtensor->op),
spaces.c_str(), ggtensor->data, spaces.c_str(), (void *) ggtensor->src[0]);
}
/*