MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / deserialize_policy

Function deserialize_policy

src/rdnn/impl/profiler.cpp:45–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45megdnn::ExecutionPolicy deserialize_policy(
46 const char* buf, uint32_t size, uint32_t& offset) {
47 megdnn::ExecutionPolicy ret;
48#define cb(_val, _type) \
49 _val = megdnn::Algorithm::deserialize_read_pod<_type>(buf, offset); \
50 offset += sizeof(_val)
51
52 cb(ret.algo.handle_type, megdnn::Handle::HandleType);
53 cb(ret.algo.type, uint32_t);
54
55 uint32_t param_size = 0;
56 uint32_t name_size = 0;
57 cb(param_size, uint32_t);
58 cb(name_size, uint32_t);
59 if (param_size > 0) {
60 ret.algo.param = std::string(buf + offset, param_size);
61 offset += param_size;
62 }
63 if (name_size > 0) {
64 ret.algo.name = std::string(buf + offset, name_size);
65 offset += name_size;
66 }
67
68 uint32_t nr_policy = 0;
69 cb(nr_policy, uint32_t);
70#undef cb
71
72 for (uint32_t i = 0; i < nr_policy; i++) {
73 ret.sub_policy.push_back(deserialize_policy(buf, size, offset));
74 }
75 return ret;
76}
77} // namespace
78
79namespace mgb {

Callers 1

deserializeMethod · 0.85

Calls 2

cbFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected