Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GPU] Fix weightless caching with low precision models #28641

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -1417,13 +1417,7 @@ bool fuse_type_to_constant(const std::shared_ptr<ov::Node>& node,
new_const->validate_and_infer_types();
new_const->set_friendly_name(constant->get_friendly_name());
ov::copy_runtime_info(constant, new_const);

const auto& rt_info = node->get_rt_info();
auto weightless_caching_attr = rt_info.find(ov::WeightlessCacheAttribute::get_type_info_static());
if (weightless_caching_attr != rt_info.end()) {
new_const->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] =
weightless_caching_attr->second;
}
ov::copy_weightless_cache_attr(constant, new_const);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace ov {

OPENVINO_API void copy_weightless_cache_attr(const std::shared_ptr<Node>& from, const std::shared_ptr<Node>& to);

/**
* @brief Holds weightless caching attributes of a single constant.
*
Expand Down
10 changes: 10 additions & 0 deletions src/core/src/op/util/weightless_caching_attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@
bool ov::WeightlessCacheAttribute::is_copyable() const {
return false;
}

OPENVINO_API void ov::copy_weightless_cache_attr(const std::shared_ptr<ov::Node>& from,
const std::shared_ptr<ov::Node>& to) {
const auto& rt_info = from->get_rt_info();
auto weightless_caching_attr = rt_info.find(ov::WeightlessCacheAttribute::get_type_info_static());

if (weightless_caching_attr != rt_info.end()) {
to->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] = weightless_caching_attr->second;
}
}
2 changes: 2 additions & 0 deletions src/core/src/pass/constant_folding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "openvino/cc/pass/itt.hpp"
#include "openvino/core/constant_fold_utils.hpp"
#include "openvino/core/rt_info.hpp"
#include "openvino/core/rt_info/weightless_caching_attributes.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/op/convert.hpp"
#include "openvino/op/util/op_types.hpp"
Expand Down Expand Up @@ -153,6 +154,7 @@ bool ov::pass::ConstantFolding::run_on_model(const std::shared_ptr<ov::Model>& m
copy_runtime_info_from_input_values(original_node);
// Propagate runtime info attributes to replacement
copy_runtime_info(original_node, replacement_ptr);
ov::copy_weightless_cache_attr(original_node, replacement_ptr);

rewritten = true;
}
Expand Down
Loading
Loading