MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / AccessBlobByCallback

Method AccessBlobByCallback

oneflow/core/framework/instructions_builder.cpp:715–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713
714template<typename T>
715Maybe<void> InstructionsBuilder::AccessBlobByCallback(
716 const T tensor,
717 const std::function<void(ep::Stream*, const std::shared_ptr<vm::EagerBlobObject>&)>& callback,
718 const std::string& modifier) {
719 const std::shared_ptr<vm::EagerBlobObject>& eager_blob_object = JUST(tensor->eager_blob_object());
720 Symbol<Stream> stream = JUST(GetAccessStream(tensor));
721 JUST(SoftSyncStream({eager_blob_object}, stream));
722 auto instruction = intrusive::make_shared<vm::Instruction>(
723 // Never replace `stream` with producer_stream or last_used_stream.
724 JUST(Singleton<VirtualMachine>::Get()->GetVmStream(stream)),
725 std::make_shared<vm::AccessBlobArgCbInstructionPolicy>(eager_blob_object, callback,
726 modifier));
727 instruction_list_->EmplaceBack(std::move(instruction));
728 return Maybe<void>::Ok();
729}
730
731template Maybe<void> InstructionsBuilder::AccessBlobByCallback(
732 const std::shared_ptr<one::LocalTensor> tensor,

Callers 5

EagerLocalTensorZerosFunction · 0.80
ConvertToIndexingTensorFunction · 0.80
zeros_Method · 0.80
from_bufferMethod · 0.80

Calls 5

GetAccessStreamFunction · 0.85
GetFunction · 0.85
GetVmStreamMethod · 0.80
eager_blob_objectMethod · 0.45
EmplaceBackMethod · 0.45

Tested by

no test coverage detected