Skip to content

Commit

Permalink
ggml: stashing changes due to computer change
Browse files Browse the repository at this point in the history
  • Loading branch information
danbev committed Aug 21, 2024
1 parent 0627b9e commit 5619c81
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
10 changes: 5 additions & 5 deletions fundamentals/ggml/add.dot
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
digraph G {
newrank = true;
rankdir = LR;
"0x7f399b010400" [ style = filled; fillcolor = white; shape = record; label="c (f32)|0 [1, 1] | <x>x+y"; ]
"0x7f399b0100c0" [ style = filled; fillcolor = pink; shape = record; label="<x>a (f32)|CONST 0 [1, 1] | (3.0e+00)"; ]
"0x7f399b010260" [ style = filled; fillcolor = pink; shape = record; label="<x>b (f32)|CONST 1 [1, 1] | (2.0e+00)"; ]
"0x7f399b0100c0":x -> "0x7f399b010400":x [ arrowhead = vee; style = solid; label = "src 0"; ]
"0x7f399b010260":x -> "0x7f399b010400":x [ arrowhead = vee; style = solid; label = "src 1"; ]
"0x7cd9a220f3b0" [ style = filled; fillcolor = white; shape = record; label="c (f32)|0 [1, 1] | <x>x+y"; ]
"0x7cd9a220f0b0" [ style = filled; fillcolor = pink; shape = record; label="<x>a (f32)|CONST 0 [1, 1] | (3.0e+00)"; ]
"0x7cd9a220f230" [ style = filled; fillcolor = pink; shape = record; label="<x>b (f32)|CONST 1 [1, 1] | (2.0e+00)"; ]
"0x7cd9a220f0b0":x -> "0x7cd9a220f3b0":x [ arrowhead = vee; style = solid; label = "src 0"; ]
"0x7cd9a220f230":x -> "0x7cd9a220f3b0":x [ arrowhead = vee; style = solid; label = "src 1"; ]
}
10 changes: 5 additions & 5 deletions fundamentals/ggml/get-rows.dot
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
digraph G {
newrank = true;
rankdir = LR;
"0x7ffa76000380" [ style = filled; fillcolor = white; shape = record; label="rows (f32)|0 [2, 2] | <x>get_rows(x)"; ]
"0x7ffa76000030" [ style = filled; fillcolor = pink; shape = record; label="<x>a (f32)|CONST 0 [2, 3]"; ]
"0x7ffa760001e0" [ style = filled; fillcolor = pink; shape = record; label="<x>indices (i32)|CONST 1 [2, 1] | (2, 0)"; ]
"0x7ffa76000030":x -> "0x7ffa76000380":x [ arrowhead = vee; style = solid; label = "src 0"; ]
"0x7ffa760001e0":x -> "0x7ffa76000380":x [ arrowhead = vee; style = solid; label = "src 1"; ]
"0x73b8fe3ff340" [ style = filled; fillcolor = white; shape = record; label="rows (f32)|0 [2, 2] | <x>get_rows(x)"; ]
"0x73b8fe3ff030" [ style = filled; fillcolor = pink; shape = record; label="<x>a (f32)|CONST 0 [2, 3]"; ]
"0x73b8fe3ff1c0" [ style = filled; fillcolor = pink; shape = record; label="<x>indices (i32)|CONST 1 [2, 1] | (2, 0)"; ]
"0x73b8fe3ff030":x -> "0x73b8fe3ff340":x [ arrowhead = vee; style = solid; label = "src 0"; ]
"0x73b8fe3ff1c0":x -> "0x73b8fe3ff340":x [ arrowhead = vee; style = solid; label = "src 1"; ]
}
10 changes: 5 additions & 5 deletions fundamentals/ggml/mul.dot
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
digraph G {
newrank = true;
rankdir = LR;
"0x7fe28d400380" [ style = filled; fillcolor = white; shape = record; label="result (f32)|0 [3, 1] | <x>X*Y"; ]
"0x7fe28d400030" [ style = filled; fillcolor = pink; shape = record; label="<x>a (f32)|CONST 0 [2, 3]"; ]
"0x7fe28d4001e0" [ style = filled; fillcolor = pink; shape = record; label="<x>b (f32)|CONST 1 [2, 1] | (7.0e+00, 8.0e+00)"; ]
"0x7fe28d400030":x -> "0x7fe28d400380":x [ arrowhead = vee; style = solid; label = "src 0"; ]
"0x7fe28d4001e0":x -> "0x7fe28d400380":x [ arrowhead = vee; style = solid; label = "src 1"; ]
"0x7d11a53ff340" [ style = filled; fillcolor = white; shape = record; label="result (f32)|0 [3, 1] | <x>X*Y"; ]
"0x7d11a53ff030" [ style = filled; fillcolor = pink; shape = record; label="<x>a (f32)|CONST 0 [2, 3]"; ]
"0x7d11a53ff1c0" [ style = filled; fillcolor = pink; shape = record; label="<x>b (f32)|CONST 1 [2, 1] | (7.0e+00, 8.0e+00)"; ]
"0x7d11a53ff030":x -> "0x7d11a53ff340":x [ arrowhead = vee; style = solid; label = "src 0"; ]
"0x7d11a53ff1c0":x -> "0x7d11a53ff340":x [ arrowhead = vee; style = solid; label = "src 1"; ]
}
9 changes: 7 additions & 2 deletions fundamentals/ggml/src/matrix-mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main(int argc, char **argv) {
ggml_set_i32_nd(b, 0, 0, 0, 0, 7);
ggml_set_i32_nd(b, 1, 0, 0, 0, 8);

// Note that ggml_mul_mat() transposes the secod matrix b.
// Note that ggml_mul_mat() transposes the second matrix b.
struct ggml_tensor* result = ggml_mul_mat(ctx, a, b);
ggml_set_name(result, "result");
/*
Expand All @@ -62,7 +62,12 @@ int main(int argc, char **argv) {

struct ggml_cgraph* c_graph = ggml_new_graph(ctx);
ggml_build_forward_expand(c_graph, result);
ggml_graph_compute_with_ctx(ctx, c_graph, 4);
int n_threads = 4;
enum ggml_status st = ggml_graph_compute_with_ctx(ctx, c_graph, n_threads);
if (st != GGML_STATUS_SUCCESS) {
printf("could not compute graph\n");
return 1;
}

printf("result tensor type: %s\n", ggml_type_name(result->type));
printf("result dim: %d\n", ggml_n_dims(result));
Expand Down

0 comments on commit 5619c81

Please sign in to comment.