Skip to content

Commit

Permalink
update ggml to 2024-10-03
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Sky committed Nov 20, 2024
1 parent ac54e00 commit c9c9810
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ggml
Submodule ggml updated 97 files
+89 −1 AUTHORS
+12 −2 CMakeLists.txt
+18 −86 README.md
+4 −0 examples/CMakeLists.txt
+2 −0 examples/common-ggml.cpp
+1 −1 examples/gpt-2/main-alloc.cpp
+0 −6 examples/gpt-2/main-backend.cpp
+1 −6 examples/gpt-2/main-batched.cpp
+1 −3 examples/gpt-2/main-sched.cpp
+1 −1 examples/mnist/CMakeLists.txt
+69 −53 examples/mnist/README.md
+279 −110 examples/mnist/mnist-common.cpp
+61 −34 examples/mnist/mnist-common.h
+24 −16 examples/mnist/mnist-eval.cpp
+4 −6 examples/mnist/mnist-train-cnn.py
+5 −4 examples/mnist/mnist-train-fc.py
+5 −5 examples/mnist/mnist-train.cpp
+7 −0 examples/perf-metal/CMakeLists.txt
+152 −0 examples/perf-metal/perf-metal.cpp
+1 −1 examples/sam/main.cpp
+1 −7 examples/simple/simple-backend.cpp
+1 −1 examples/simple/simple-ctx.cpp
+2 −2 include/ggml-alloc.h
+146 −59 include/ggml-backend.h
+3 −3 include/ggml-blas.h
+15 −8 include/ggml-cann.h
+17 −15 include/ggml-cuda.h
+4 −7 include/ggml-metal.h
+5 −5 include/ggml-rpc.h
+8 −8 include/ggml-sycl.h
+7 −7 include/ggml-vulkan.h
+189 −135 include/ggml.h
+20 −6 scripts/sync-llama-am.sh
+1 −1 scripts/sync-llama.last
+75 −43 src/CMakeLists.txt
+2,127 −1,098 src/ggml-aarch64.c
+6 −0 src/ggml-alloc.c
+155 −70 src/ggml-backend-impl.h
+58 −6 src/ggml-backend.c
+2,496 −0 src/ggml-backend.cpp
+9 −10 src/ggml-blas.cpp
+162 −97 src/ggml-cann.cpp
+1 −0 src/ggml-cann/common.h
+20 −0 src/ggml-common.h
+614 −0 src/ggml-cpu-impl.h
+487 −207 src/ggml-cuda.cu
+79 −0 src/ggml-cuda/argmax.cu
+3 −0 src/ggml-cuda/argmax.cuh
+67 −0 src/ggml-cuda/binbcast.cu
+2 −0 src/ggml-cuda/binbcast.cuh
+19 −0 src/ggml-cuda/common.cuh
+64 −0 src/ggml-cuda/count-equal.cu
+5 −0 src/ggml-cuda/count-equal.cuh
+70 −16 src/ggml-cuda/cpy.cu
+62 −2 src/ggml-cuda/cross-entropy-loss.cu
+2 −0 src/ggml-cuda/cross-entropy-loss.cuh
+1 −1 src/ggml-cuda/fattn-tile-f16.cu
+5 −1 src/ggml-cuda/fattn-tile-f32.cu
+3 −3 src/ggml-cuda/fattn-vec-f16.cuh
+3 −3 src/ggml-cuda/fattn.cu
+0 −1 src/ggml-cuda/im2col.cu
+5 −1 src/ggml-cuda/mmq.cu
+2 −2 src/ggml-cuda/mmq.cuh
+80 −0 src/ggml-cuda/opt-step-adamw.cu
+5 −0 src/ggml-cuda/opt-step-adamw.cuh
+51 −0 src/ggml-cuda/out-prod.cu
+3 −0 src/ggml-cuda/out-prod.cuh
+89 −0 src/ggml-cuda/rwkv-wkv.cu
+5 −0 src/ggml-cuda/rwkv-wkv.cuh
+47 −0 src/ggml-cuda/sum.cu
+5 −0 src/ggml-cuda/sum.cuh
+86 −0 src/ggml-cuda/unary.cu
+9 −0 src/ggml-cuda/unary.cuh
+1 −0 src/ggml-cuda/vendors/hip.h
+2 −39 src/ggml-cuda/vendors/musa.h
+39 −606 src/ggml-impl.h
+4 −24 src/ggml-kompute.cpp
+1,961 −1,839 src/ggml-metal.m
+7 −7 src/ggml-metal.metal
+965 −85 src/ggml-quants.c
+15 −4 src/ggml-quants.h
+38 −36 src/ggml-rpc.cpp
+67 −66 src/ggml-sycl.cpp
+0 −1 src/ggml-sycl/common.hpp
+2 −2 src/ggml-sycl/dmmv.cpp
+344 −335 src/ggml-vulkan.cpp
+2,152 −1,385 src/ggml.c
+4 −6 src/vulkan-shaders/argsort.comp
+5 −0 src/vulkan-shaders/vulkan-shaders-gen.cpp
+1,406 −270 tests/test-backend-ops.cpp
+24 −30 tests/test-conv-transpose-1d.cpp
+5 −11 tests/test-conv1d.cpp
+5 −11 tests/test-conv2d.cpp
+8 −4 tests/test-grad0.cpp
+1 −6 tests/test-mul-mat.cpp
+6 −0 tests/test-quantize-fns.cpp
+2 −2 tests/test1.c
25 changes: 13 additions & 12 deletions ggml_extend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,21 @@ __STATIC_INLINE__ ggml_fp16_t ggml_tensor_get_f16(const ggml_tensor* tensor, int

static struct ggml_tensor* get_tensor_from_graph(struct ggml_cgraph* gf, const char* name) {
struct ggml_tensor* res = NULL;
for (int i = 0; i < gf->n_nodes; i++) {
// printf("%d, %s \n", i, gf->nodes[i]->name);
if (strcmp(ggml_get_name(gf->nodes[i]), name) == 0) {
res = gf->nodes[i];
break;
}
}
for (int i = 0; i < gf->n_leafs; i++) {
// printf("%d, %s \n", i, gf->leafs[i]->name);
if (strcmp(ggml_get_name(gf->leafs[i]), name) == 0) {
res = gf->leafs[i];
for (int i = 0; i < ggml_graph_n_nodes(gf); i++) {
struct ggml_tensor* node = ggml_graph_node(gf, i);
// printf("%d, %s \n", i, ggml_get_name(node));
if (strcmp(ggml_get_name(node), name) == 0) {
res = node;
break;
}
}
//for (int i = 0; i < gf->n_leafs; i++) {
// // printf("%d, %s \n", i, gf->leafs[i]->name);
// if (strcmp(ggml_get_name(gf->leafs[i]), name) == 0) {
// res = gf->leafs[i];
// break;
// }
//}
return res;
}

Expand Down Expand Up @@ -1118,7 +1119,7 @@ struct GGMLRunner {
ggml_graph_print(gf);
#endif
if (output != NULL) {
auto result = gf->nodes[gf->n_nodes - 1];
auto result = ggml_graph_node(gf, -1);
if (*output == NULL && output_ctx != NULL) {
*output = ggml_dup_tensor(output_ctx, result);
}
Expand Down
3 changes: 3 additions & 0 deletions stable-diffusion.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ggml.h"
#include "ggml_extend.hpp"

#include "model.h"
Expand Down Expand Up @@ -47,6 +48,8 @@ const char* sampling_methods_str[] = {
"LCM",
};

//static_assert((int)SD_TYPE_COUNT == (int)GGML_TYPE_COUNT);

/*================================================== Helper Functions ================================================*/

void calculate_alphas_cumprod(float* alphas_cumprod,
Expand Down
2 changes: 2 additions & 0 deletions stable-diffusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ enum sd_type_t {
SD_TYPE_Q4_0_4_4 = 31,
SD_TYPE_Q4_0_4_8 = 32,
SD_TYPE_Q4_0_8_8 = 33,
SD_TYPE_TQ1_0 = 34,
SD_TYPE_TQ2_0 = 35,
SD_TYPE_COUNT,
};

Expand Down

0 comments on commit c9c9810

Please sign in to comment.