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

Method set_option

imperative/src/impl/interpreter/interpreter_impl.cpp:595–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595void ChannelImpl::set_option(std::string name, size_t value) {
596 MGB_LOCK_GUARD(m_spin);
597 assert_available();
598 auto& state = get_channel_state();
599 state.options.set_option(name, value);
600 // FIXME
601 if (name == "enable_dtr_auto_drop" && value) {
602 auto custom_allocator = [&](CompNode device, size_t size) {
603 auto blob = Blob::make(device, size);
604 alloc_tensor_with_evict(blob.get());
605 return blob->storage();
606 };
607 BlobManager::inst()->set_allocator(custom_allocator);
608 }
609 if (Profiler::is_profiling()) {
610 m_worker.add_task(
611 {Profiler::next_id(), SetOption{name, value},
612 get_channel_state().stack_manager.dump()});
613 } else {
614 m_worker.add_task({
615 Profiler::next_id(),
616 SetOption{name, value},
617 });
618 }
619}
620
621void ChannelImpl::clear_candidates() {
622 MGB_LOCK_GUARD(m_spin);

Callers 2

init_tensorFunction · 0.80
process_one_taskMethod · 0.80

Calls 8

instFunction · 0.85
is_profilingFunction · 0.85
storageMethod · 0.80
makeFunction · 0.50
getMethod · 0.45
set_allocatorMethod · 0.45
add_taskMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected