Skip to content

Commit e77a4c3

Browse files
SlyEchoYellowRoseCx
authored andcommitted
Merge 'origin/master' into hipblas
1 parent cc4c4e3 commit e77a4c3

File tree

3 files changed

+185
-115
lines changed

3 files changed

+185
-115
lines changed

ggml-alloc.c

+8
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@ static void allocate_node(struct ggml_allocr * alloc, struct ggml_tensor * node)
394394
if (parent == NULL) {
395395
break;
396396
}
397+
398+
// if the node's data is external, then we cannot re-use it
399+
if ((char *) parent->data < (char *) alloc->data ||
400+
(char *) parent->data >= ((char *) alloc->data + alloc->size)) {
401+
AT_PRINTF("not reusing parent %s for %s as %p is external\n", parent->name, node->name, parent->data);
402+
continue;
403+
}
404+
397405
struct hash_node * p_hn = hash_get(ht, parent);
398406
if (parent->data != NULL && p_hn->n_children == 1 && p_hn->n_views == 0 && ggml_are_same_layout(node, parent)) {
399407
if (ggml_is_view(parent)) {

0 commit comments

Comments
 (0)