Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions ggml/include/ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,7 @@ extern "C" {

void * extra; // extra things e.g. for ggml-cuda.cu

char padding[16];
// add a struct ggml_tensor * named org_src, initialized to NULL, for keeping track of original source tensors in case of in-place operations
struct ggml_tensor * org_src;
char padding[8];
};

static const size_t GGML_TENSOR_SIZE = sizeof(struct ggml_tensor);
Expand Down
1 change: 0 additions & 1 deletion ggml/src/ggml-backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,6 @@ void ggml_backend_sched_split_graph(ggml_backend_sched_t sched, struct ggml_cgra
ggml_set_input(tensor_copy);
ggml_set_output(tensor_copy); // prevent ggml-alloc from overwriting the tensor
}
tensor_copy->org_src = src;
tensor_id_copy(src_id, cur_backend_id, c) = tensor_copy;
SET_CAUSE(tensor_copy, "4.cpy");
}
Expand Down
10 changes: 5 additions & 5 deletions ggml/src/ggml-openvino/ggml-decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,10 +1481,10 @@ void GgmlOvDecoder::compute_node_dynamic_dims() {
if (src == nullptr) {
continue;
}
ggml_tensor * root_src = nullptr;
if (src->org_src) {
root_src = src->org_src;
}
struct ggml_tensor * root_src = nullptr;
// if (src->org_src) {
// root_src = src->org_src;
// }
if (root_src) {
if (is_inp_tok(root_src, node) || is_inp_pos(root_src, node) || is_output_idx(root_src, node)) {
m_node_dynamic_dims[root_src] = 0;
Expand Down Expand Up @@ -1562,7 +1562,7 @@ void GgmlOvDecoder::compute_node_dynamic_dims() {
// identifies the dynamic dim even when two dims share the same size.
m_node_dynamic_dims[node] = -1;
if (m_node_dynamic_dims[node->src[0]] != -1) {
if (node->src[0]->op == GGML_OP_NONE && node->src[0]->org_src == nullptr) {
if (node->src[0]->op == GGML_OP_NONE) {
m_node_dynamic_dims[node] = m_node_dynamic_dims[node->src[0]];
break;
}
Expand Down
2 changes: 1 addition & 1 deletion ggml/src/ggml-openvino/ggml-decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class GgmlOvDecoder : public ov::frontend::ggml::GgmlDecoder {
void update_io(ggml_cgraph * cgraph);

inline static bool is_inp_tok(const ggml_tensor * tensor, const ggml_tensor * op) {
return op->op == GGML_OP_GET_ROWS && tensor == op->src[1] && op->src[0]->op == GGML_OP_NONE && op->src[0]->org_src == nullptr;
return op->op == GGML_OP_GET_ROWS && tensor == op->src[1] && op->src[0]->op == GGML_OP_NONE;
}

inline static bool is_inp_pos(const ggml_tensor * tensor, const ggml_tensor * op) {
Expand Down
1 change: 0 additions & 1 deletion ggml/src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,6 @@ static struct ggml_tensor * ggml_new_tensor_impl(
/*.name =*/ { 0 },
/*.extra =*/ NULL,
/*.padding =*/ { 0 },
/*.org_src =*/ NULL,
};

// TODO: this should not be needed as long as we don't rely on aligned SIMD loads
Expand Down
Loading