Skip to content

Commit 0e9c0b7

Browse files
committed
move repack hack to test-backend-ops.cpp [no ci]
This is just to get the tests passing again and I'll try to find a better aproach to do this.
1 parent 17b2e26 commit 0e9c0b7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/test-backend-ops.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,8 +1222,18 @@ struct test_case {
12221222
if (node->op != GGML_OP_NONE && node->src[0]) {
12231223
for (const auto& [buft, buf] : extra_buf_map) {
12241224
size_t id = ggml_hash_find(&hash_set, node);
1225-
ggml_status status = ggml_backend_buffer_init_tensor(buf, node_copies[id]);
1226-
if (status != GGML_STATUS_SUCCESS) {
1225+
ggml_status status = ggml_backend_buffer_init_tensor(buf, node_copies[id]->src[0]);
1226+
if (status == GGML_STATUS_SUCCESS) {
1227+
if (node_copies[id]->src[0]->extra != nullptr) {
1228+
if (strcmp(ggml_backend_buft_name(buft),"CPU_REPACK") == 0) {
1229+
if (node_copies[id]->op == GGML_OP_MUL_MAT || node_copies[id]->op == GGML_OP_MUL_MAT_ID) {
1230+
if (ggml_n_dims(node_copies[id]->src[1]) == 2) {
1231+
node_copies[id]->src[0]->buffer = buf;
1232+
}
1233+
}
1234+
}
1235+
}
1236+
} else {
12271237
GGML_LOG_ERROR("%s: failed to initialize tensor in extra buffer type '%s' for graph copy\n", __func__, ggml_backend_buft_name(buft));
12281238
}
12291239
}

0 commit comments

Comments
 (0)