Skip to content

Commit

Permalink
added cache blob descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
e-ddykim committed Nov 18, 2022
1 parent c5714d0 commit 1962d76
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ struct primitive_info {
CLDNN_DEFINE_TYPE_ID(PType) \
CLDNN_DEFINE_TYPE_STRING(PType)

#define GPU_DEFINE_PRIMITIVE_TYPE_ID(PType) \
#define GPU_DEFINE_PRIMITIVE_TYPE_ID(PType) \
primitive_type_id PType::type_id() { \
static primitive_type_base<PType> instance; \
return &instance; \
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/intel_gpu/src/graph/impls/ocl/primitive_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ struct typed_primitive_impl_ocl : public typed_primitive_impl<PType> {

bool is_cpu() const override { return false; }

// Cache blob format:
// [ kernel_selector::kernel_data ]
// [ kernel_id ]
// [ kernel_arguments ]
void save(BinaryOutputBuffer& ob) const override {
ob << make_data(&_kernel_data.internalBufferDataType, sizeof(kernel_selector::Datatype));
ob << _kernel_data.internalBufferSizes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ struct typed_primitive_onednn_impl : public typed_primitive_impl<PType> {

bool is_cpu() const override { return false; }

// Cache blob format:
// [ dnnl::primitive_attr ]
// [ dnnl::primitive_desc ]
// [ dnnl::cache_blob ]
void save(BinaryOutputBuffer& ob) const override {
if (_attrs.get() == nullptr) {
ob << false;
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/intel_gpu/src/graph/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ network::~network() {
}
}

// Cache blob format:
// [ cldnn::kernels_cache ]
// [ non executable primitive_inst ]
// [ executable primitive_inst ]
// [ memory reuse information ]
void network::save(cldnn::BinaryOutputBuffer& ob) {
kernels_cache kernels_cache(get_engine(), 0, {""});
for (const auto& p_inst : _exec_order) {
Expand Down
16 changes: 16 additions & 0 deletions src/plugins/intel_gpu/src/graph/primitive_inst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,22 @@ std::string primitive_inst::get_implementation_name() const {
return "undef";
}

// Cache blob format:
// [ primitive type ]
// for DATA_INST
// [ primtive_type_string ]
// [ kernel_impl_params ]
// [ output memory information ]
// [ data stored in memory ]
// for EXECUTABLE_INST
// [ kernel_arguments ]
// [ kernel_impl_params ]
// [ primitive_impl ]
// [ member variables of primitive_inst ]
// [ output memory information ]
// [ memory dependency information ]
// [ execution dependency information ]
// [ intermediate memory information ]
void primitive_inst::save(cldnn::BinaryOutputBuffer& ob) const {
if (type() == cldnn::data::type_id() ||
(type() == cldnn::mutable_data::type_id() && _impl == nullptr)) {
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/intel_gpu/src/plugin/compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ bool CompiledModel::is_serializable() {
return true;
}

// Cache blob format:
// [ ConstInputsDataMap / ConstOutputsDataMap ]
// [ ov::Node::Input/ ov::Node::Output ]
// [ ov::intel_gpu::Graph ]
void CompiledModel::Export(std::ostream& networkModel) {
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "CompiledModel::Export");
if (m_graphs.empty())
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/intel_gpu/src/plugin/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@ std::shared_ptr<ngraph::Function> Graph::GetExecGraphInfoByPrimitivesInfo(std::v
return std::make_shared<ngraph::Function>(results, params, "runtime_gpu_graph");
}

// Cache blob format:
// [ ov::intel_gpu::Program::inputLayouts ]
// [ ov::intel_gpu::Graph::primitiveIDs ]
// [ ov::intel_gpu::Graph::outputDims ]
// [ cldnn::network ]
void Graph::Export(cldnn::BinaryOutputBuffer &ob) {
ob << m_program->inputLayouts;
ob << primitiveIDs;
Expand Down

0 comments on commit 1962d76

Please sign in to comment.