Skip to content

Commit 3ab0967

Browse files
[CPU] Fix load failure when using ov_dir for SDPA models (#29149)
### Details: - *The process of core.compile_model() for first run(create cache):* - *plugin.compile_model()* - *Transformations(m_model) // apply ngraph transformation for m_model* - *...* - *compiled_model.export_model()* - *ModelSerializer.operator<< // serialize the m_model* - *call `visit_attributes` of each node to save attributes in m_model* - *...* - *The process of core.compile_model() for second+ run(load cache):* - *core.load_model_from_cache()* - *...* - *plugin.import_model()* - *ModelDeserializer.operator>> // deserialize into m_model* - *call `visit_attributes` of each node to restore attributes in m_model* - *...* - *So `visit_attributes` is needed if op has attributes* ### Tickets: - *[162979](https://jira.devtools.intel.com/browse/CVS-162979)*
1 parent b4a2278 commit 3ab0967

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/qkv_proj.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,18 @@ std::shared_ptr<Node> QKVProjectionNode::clone_with_new_inputs(const ov::OutputV
3737
check_new_args_count(this, new_args);
3838
return std::make_shared<QKVProjectionNode>(new_args, m_config);
3939
}
40+
41+
bool QKVProjectionNode::visit_attributes(ov::AttributeVisitor& visitor) {
42+
INTERNAL_OP_SCOPE(QKVProjectionNode_visit_attributes);
43+
visitor.start_structure("config");
44+
visitor.on_attribute("quantized", m_config.quantized);
45+
visitor.on_attribute("hidden_size", m_config.hidden_size);
46+
visitor.on_attribute("proj_size0", m_config.proj_size0);
47+
visitor.on_attribute("proj_size1", m_config.proj_size1);
48+
visitor.on_attribute("proj_size2", m_config.proj_size2);
49+
visitor.on_attribute("weights_combined", m_config.weights_combined);
50+
visitor.finish_structure();
51+
return true;
52+
}
53+
4054
} // namespace ov::intel_cpu

src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/qkv_proj.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class QKVProjectionNode : public ov::op::Op {
2828
validate_and_infer_types();
2929
}
3030

31+
bool visit_attributes(ov::AttributeVisitor& visitor) override;
32+
3133
void validate_and_infer_types() override;
3234

3335
std::shared_ptr<Node> clone_with_new_inputs(const ov::OutputVector& new_args) const override;

0 commit comments

Comments
 (0)