Minor Update

This commit is contained in:
zhanmyz 2025-03-11 15:16:40 +08:00 committed by Mustafa Cavus
parent 467a5ddf04
commit b14b49d5f6
2 changed files with 19 additions and 13 deletions

View File

@ -813,7 +813,7 @@ void ggml_backend_openvino_dup_bytes(struct ggml_tensor *dst) {
auto order_const = ov::op::v0::Constant::create(ov::element::i64, {order.size()}, order);
auto transpose = std::make_shared<ov::op::v1::Transpose>(input_param, order_const);
ov::Shape target_shape = { dst->ne[2], dst->ne[1], dst->ne[0] }; // {1, 7, 3072}
ov::Shape target_shape = { static_cast<size_t>(dst->ne[2]), static_cast<size_t>(dst->ne[1]), static_cast<size_t>(dst->ne[0]) }; // {1, 7, 3072}
std::vector<int64_t> target_shape_vec = { static_cast<int64_t>(dst->ne[2]),
static_cast<int64_t>(dst->ne[1]),
static_cast<int64_t>(dst->ne[0]) };
@ -866,7 +866,7 @@ void ggml_backend_openvino_cpy(struct ggml_tensor *dst) {
std::shared_ptr<ov::Model> model;
if (ggml_is_contiguous(dst)) {
// Contiguous Case: Flatten src and reshape to dst shape
ov::Shape flattened_shape = {ggml_nelements(src0)};
ov::Shape flattened_shape = {static_cast<size_t>(ggml_nelements(src0))};
auto flatten = std::make_shared<ov::op::v1::Reshape>(
src_input, ov::op::v0::Constant::create(ov::element::i64, {1}, flattened_shape), false);
@ -1013,12 +1013,12 @@ static enum ggml_status ggml_backend_openvino_graph_compute(ggml_backend_t backe
// } else {
for (int i = 0; i < cgraph->n_nodes; i++) {
if (std::find(permute_indices.begin(), permute_indices.end(), i) != permute_indices.end()) {
ggml_backend_openvino_permute(cgraph->nodes[i]);
if (std::find(view_indices.begin(), view_indices.end(), i) != view_indices.end()) {
ggml_backend_openvino_view(cgraph->nodes[i]);
// } else if (std::find(mul_mat_indices.begin(), mul_mat_indices.end(), i) != mul_mat_indices.end()) {
// ggml_backend_openvino_mul_mat(cgraph->nodes[i]);
} else if (std::find(view_indices.begin(), view_indices.end(), i) != view_indices.end()) {
ggml_backend_openvino_view(cgraph->nodes[i]);
// } else if (std::find(permute_indices.begin(), permute_indices.end(), i) != permute_indices.end()) {
// ggml_backend_openvino_permute(cgraph->nodes[i]);
// } else if (std::find(cont_indices.begin(), cont_indices.end(), i) != cont_indices.end()) {
// ggml_backend_openvino_dup_bytes(cgraph->nodes[i]);
// } else if (std::find(transpose_indices.begin(), transpose_indices.end(), i) != transpose_indices.end()) {

View File

@ -231,7 +231,7 @@ void ggml_graph_op_print(const struct ggml_cgraph * cgraph) {
file << "n_nodes = " << cgraph->n_nodes << "\n";
file << " " << std::setw(3) << "nodes"
<< std::setw(15) << "shape"
<< std::setw(16) << "op"
<< std::setw(20) << "op"
<< std::setw(20) << "name"
<< std::setw(3) << " "
<< std::setw(50) << "stride"
@ -242,21 +242,24 @@ void ggml_graph_op_print(const struct ggml_cgraph * cgraph) {
file << " - " << std::setw(3) << i << ": [ "
<< std::setw(5) << node->ne[0] << ", "
<< std::setw(5) << node->ne[1] << ", "
<< std::setw(5) << node->ne[2] << "] "
<< std::setw(5) << node->ne[2] << ", "
<< std::setw(5) << node->ne[3] << "] "
<< std::left << std::setw(20) << ggml_op_name(node->op) << std::right << " "
<< std::left << std::setw(44) << node->name << std::right
<< ((node->flags & GGML_TENSOR_FLAG_PARAM) ? "x" : node->grad ? "g" : " ")
<< std::setw(2) << "[ "
<< std::setw(0) << node->nb[0] << ", "
<< std::setw(5) << node->nb[1] << ", "
<< std::setw(5) << node->nb[2] << "] "
<< std::setw(5) << node->nb[2] << ", "
<< std::setw(5) << node->nb[3] << "] "
<< "\n";
if (node->src[0]) {
file << std::setw(10) << " [ "
<< std::setw(5) << node->src[0]->ne[0] << ", "
<< std::setw(5) << node->src[0]->ne[1] << ", "
<< std::setw(5) << node->src[0]->ne[2] << "] "
<< std::setw(5) << node->src[0]->ne[2] << ", "
<< std::setw(5) << node->src[0]->ne[3] << "] "
<< std::setw(12)
<< "0: " << std::left << std::setw(12) << ggml_op_name(node->src[0]->op) << std::right;
// // Custom logic to handle '\000'
@ -269,14 +272,16 @@ void ggml_graph_op_print(const struct ggml_cgraph * cgraph) {
<< std::setw(16) << "[ "
<< std::setw(0) << node->src[0]->nb[0] << ", "
<< std::setw(5) << node->src[0]->nb[1] << ", "
<< std::setw(5) << node->src[0]->nb[2] << "] "
<< std::setw(5) << node->src[0]->nb[2] << ", "
<< std::setw(5) << node->src[0]->nb[3] << "] "
<< "\n";
}
if (node->src[1]) {
file << std::setw(10) << " [ "
<< std::setw(5) << node->src[1]->ne[0] << ", "
<< std::setw(5) << node->src[1]->ne[1] << ", "
<< std::setw(5) << node->src[1]->ne[2] << "] "
<< std::setw(5) << node->src[1]->ne[2] << ", "
<< std::setw(5) << node->src[1]->ne[3] << "] "
<< std::setw(12)
<< "1: " << std::left << std::setw(12) << ggml_op_name(node->src[1]->op) << std::right;
// // Custom logic to handle '\000'
@ -289,7 +294,8 @@ void ggml_graph_op_print(const struct ggml_cgraph * cgraph) {
<< std::setw(16) << "[ "
<< std::setw(0) << node->src[1]->nb[0] << ", "
<< std::setw(5) << node->src[1]->nb[1] << ", "
<< std::setw(5) << node->src[1]->nb[2] << "] "
<< std::setw(5) << node->src[1]->nb[2] << ", "
<< std::setw(5) << node->src[1]->nb[3] << "] "
<< "\n";
}
}