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

Method get

src/gopt/impl/global_layout_transform/profiler_cache.cpp:147–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147Maybe<ProfilerCache::Result> ProfilerCache::get(const Key& key) {
148 auto raw_buf = m_impl->get(key.category(), key.blob());
149 if (!raw_buf.valid())
150 return None;
151 // data type of cost is float
152 auto buf = static_cast<const uint8_t*>(raw_buf->ptr);
153 auto size = raw_buf->size;
154 mgb_assert(
155 buf && size == sizeof(float),
156 "ProfileCache invalid value: ptr=%p, size=%zu", buf, size);
157 auto read_f32 = [&]() {
158 auto ret = *reinterpret_cast<const float*>(buf);
159 return ret;
160 };
161 auto cost = read_f32();
162 return cost;
163}
164
165void ProfilerCache::put(const Key& key, Result& result) {
166 std::string val;

Callers 15

TESTFunction · 0.45
profile_operatorMethod · 0.45
profile_var_nodeMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TEST_PASSFunction · 0.45
applyMethod · 0.45
RelayoutPlaceholderMethod · 0.45
translate_passMethod · 0.45
do_replaceMethod · 0.45

Calls 3

categoryMethod · 0.80
blobMethod · 0.80
validMethod · 0.45

Tested by 6

TESTFunction · 0.36
profile_operatorMethod · 0.36
profile_var_nodeMethod · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TEST_PASSFunction · 0.36