Skip to content

Commit 4fe646f

Browse files
committed
sync : update tests + fix max op params to 64
ggml-ci
1 parent e819070 commit 4fe646f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

ggml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
#define GGML_MAX_CONTEXTS 64
220220
#define GGML_MAX_SRC 6
221221
#define GGML_MAX_NAME 64
222-
#define GGML_MAX_OP_PARAMS 32
222+
#define GGML_MAX_OP_PARAMS 64
223223
#define GGML_DEFAULT_N_THREADS 4
224224
#define GGML_DEFAULT_GRAPH_SIZE 2048
225225
#if UINTPTR_MAX == 0xFFFFFFFF

tests/test-grad0.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ static bool check_gradient(
231231
printf("GGML_N_THREADS = %d\n", n_threads);
232232
}
233233

234-
struct ggml_cgraph * gf = ggml_build_forward_ctx(ctx0, f);
235-
struct ggml_cgraph * gb = ggml_new_graph(ctx0);
236-
*gb = *gf;
234+
struct ggml_cgraph * gf = ggml_new_graph_custom(ctx0, GGML_DEFAULT_GRAPH_SIZE, true);
235+
struct ggml_cgraph * gb = ggml_new_graph_custom(ctx0, GGML_DEFAULT_GRAPH_SIZE, true);
236+
ggml_build_forward_expand(gf, f);
237+
ggml_graph_cpy(gf, gb);
237238
ggml_build_backward_expand(ctx0, gf, gb, false);
238239

239240
ggml_graph_compute_with_ctx(ctx0, gf, n_threads);

tests/test-opt.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ int main(void) {
109109
struct ggml_tensor * d = ggml_sub(ctx, c, ab);
110110
struct ggml_tensor * e = ggml_sum(ctx, ggml_sqr(ctx, d));
111111

112-
struct ggml_cgraph ge = ggml_build_forward(e);
113-
ggml_graph_reset(&ge);
112+
struct ggml_cgraph * ge = ggml_new_graph_custom(ctx, GGML_DEFAULT_GRAPH_SIZE, true);
113+
ggml_build_forward_expand(ge, e);
114+
ggml_graph_reset(ge);
114115

115-
ggml_graph_compute_with_ctx(ctx, &ge, /*n_threads*/ 1);
116+
ggml_graph_compute_with_ctx(ctx, ge, /*n_threads*/ 1);
116117

117118
const float fe = ggml_get_f32_1d(e, 0);
118119
printf("%s: e = %.4f\n", __func__, fe);
@@ -121,9 +122,9 @@ int main(void) {
121122

122123
ggml_opt(ctx, opt_params, e);
123124

124-
ggml_graph_reset(&ge);
125+
ggml_graph_reset(ge);
125126

126-
ggml_graph_compute_with_ctx(ctx, &ge, /*n_threads*/ 1);
127+
ggml_graph_compute_with_ctx(ctx, ge, /*n_threads*/ 1);
127128

128129
const float fe_opt = ggml_get_f32_1d(e, 0);
129130
printf("%s: original e = %.4f\n", __func__, fe);

0 commit comments

Comments
 (0)