[GPU] Add OneDNN post ops description in graph dump mode (#9371)

This commit is contained in:
Sergey Shlyapnikov 2021-12-23 09:58:35 +03:00 committed by GitHub
parent 20ee7fd242
commit 507a498269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 1 deletions

View File

@ -9,6 +9,10 @@
#include "intel_gpu/runtime/device.hpp"
#include "intel_gpu/primitives/primitive.hpp"
#ifdef ENABLE_ONEDNN_FOR_GPU
#include "program_node.h"
#endif
#include <string>
#include <sstream>
@ -270,4 +274,26 @@ inline std::string allocation_type_to_str(allocation_type type) {
}
}
#ifdef ENABLE_ONEDNN_FOR_GPU
inline std::string onednn_post_op_type_to_str(onednn_post_op_type type) {
switch (type) {
case onednn_post_op_type::eltwise_act: return "eltwise_act";
case onednn_post_op_type::eltwise_clip: return "eltwise_clip";
case onednn_post_op_type::eltwise_linear: return "eltwise_linear";
case onednn_post_op_type::eltwise_round: return "eltwise_round";
case onednn_post_op_type::binary_mul: return "binary_mul";
case onednn_post_op_type::binary_add: return "binary_add";
case onednn_post_op_type::binary_max: return "binary_max";
case onednn_post_op_type::binary_min: return "binary_min";
case onednn_post_op_type::binary_relu: return "binary_relu";
case onednn_post_op_type::scale: return "scale";
case onednn_post_op_type::sum: return "sum";
case onednn_post_op_type::optimized: return "optimized";
case onednn_post_op_type::optimized_eltwise: return "optimized_eltwise";
case onednn_post_op_type::optimized_sum: return "optimized_sum";
default: return "unknown";
}
}
#endif
} // namespace cldnn

View File

@ -101,7 +101,6 @@ std::unique_ptr<json_composite> program_node::desc_to_json() const {
node_info->add("in data flow", bool_to_str(data_flow));
node_info->add("output", bool_to_str(output));
json_composite fused_nodes_info;
size_t index = 0;
for (auto& fused_desc : get_fused_primitives()) {
@ -122,6 +121,22 @@ std::unique_ptr<json_composite> program_node::desc_to_json() const {
}
node_info->add("fused primitives", fused_nodes_info);
#ifdef ENABLE_ONEDNN_FOR_GPU
auto& onednn_post_ops = get_fused_primitives_onednn();
if (onednn_post_ops.size()) {
size_t post_op_index = 0;
json_composite post_ops_info;
for (auto& fused_prim_desc : onednn_post_ops) {
json_composite post_op_info;
post_op_info.add("post op", onednn_post_op_type_to_str(fused_prim_desc.op_type));
post_op_info.add("memory dependency", fused_prim_desc.mem_dep);
post_op_info.add("memory offset", fused_prim_desc.mem_offset);
post_ops_info.add("post ops idx " + std::to_string(post_op_index++), post_op_info);
}
node_info->add("onednn post ops", post_ops_info);
}
#endif
std::vector<std::string> deps_ptrs;
{
bool empty = true;