| 713 | |
| 714 | template<typename T> |
| 715 | Maybe<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 | |
| 731 | template Maybe<void> InstructionsBuilder::AccessBlobByCallback( |
| 732 | const std::shared_ptr<one::LocalTensor> tensor, |
no test coverage detected