Skip to content

Commit f8dfcc8

Browse files
Apply city96 lcpp.patch on tag b3962
Pre-applied patch for the ComfyUI-GGUF conversion toolchain (https://github.com/Randy420Marsh/ComfyUI-GGUF), originally distributed as tools/lcpp.patch in that repo. The patch: * Doubles GGML_MAX_NAME (64 -> 128) so quantization can preserve longer diffusion-model tensor names. * Adds gguf_set_tensor_ndim() to ggml.{h,c} so writer code can override the on-disk ndim metadata for tensors whose stored shape differs from the runtime ndim (used by Comfy diffusion archs where 5D tensors get reshaped to 4D for storage). * Adjusts src/llama.cpp tensor-name handling to use the new GGML_MAX_NAME bound. Source patch: tools/lcpp.patch in Randy420Marsh/ComfyUI-GGUF, sha-pinned against this exact b3962 commit (c8c07d6). Re-applies cleanly with 'git apply --check' here. Users of Randy420Marsh/ComfyUI-GGUF/tools should clone this branch directly instead of cloning ggml-org/llama.cpp + checking out b3962 + applying the patch by hand: git clone -b city96 https://github.com/Randy420Marsh/llama.cpp.git cd llama.cpp cmake -B build -DBUILD_SHARED_LIBS=ON cmake --build build --config Release -j Then llama-quantize, libggml.so, libllama.so live in build/bin and build/{src,ggml/src} as usual. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent c8c07d6 commit f8dfcc8

3 files changed

Lines changed: 346 additions & 2 deletions

File tree

ggml/include/ggml.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
#define GGML_MAX_OP_PARAMS 64
224224

225225
#ifndef GGML_MAX_NAME
226-
# define GGML_MAX_NAME 64
226+
# define GGML_MAX_NAME 128
227227
#endif
228228

229229
#define GGML_DEFAULT_N_THREADS 4
@@ -2449,6 +2449,7 @@ extern "C" {
24492449

24502450
// manage tensor info
24512451
GGML_API void gguf_add_tensor(struct gguf_context * ctx, const struct ggml_tensor * tensor);
2452+
GGML_API void gguf_set_tensor_ndim(struct gguf_context * ctx, const char * name, int n_dim);
24522453
GGML_API void gguf_set_tensor_type(struct gguf_context * ctx, const char * name, enum ggml_type type);
24532454
GGML_API void gguf_set_tensor_data(struct gguf_context * ctx, const char * name, const void * data, size_t size);
24542455

ggml/src/ggml.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22960,6 +22960,14 @@ void gguf_add_tensor(
2296022960
ctx->header.n_tensors++;
2296122961
}
2296222962

22963+
void gguf_set_tensor_ndim(struct gguf_context * ctx, const char * name, const int n_dim) {
22964+
const int idx = gguf_find_tensor(ctx, name);
22965+
if (idx < 0) {
22966+
GGML_ABORT("tensor not found");
22967+
}
22968+
ctx->infos[idx].n_dims = n_dim;
22969+
}
22970+
2296322971
void gguf_set_tensor_type(struct gguf_context * ctx, const char * name, enum ggml_type type) {
2296422972
const int idx = gguf_find_tensor(ctx, name);
2296522973
if (idx < 0) {

0 commit comments

Comments
 (0)