| 249 | } |
| 250 | |
| 251 | StatusOr<std::unique_ptr<GlobalData>> Client::Execute( |
| 252 | const ExecutionHandle& handle, absl::Span<GlobalData* const> arguments, |
| 253 | ExecutionProfile* execution_profile) { |
| 254 | ExecuteRequest request; |
| 255 | *request.mutable_handle() = handle; |
| 256 | for (GlobalData* argument : arguments) { |
| 257 | CHECK(argument != nullptr) << "Argument pointers must not be null."; |
| 258 | *request.add_arguments() = argument->handle(); |
| 259 | } |
| 260 | |
| 261 | ExecuteResponse response; |
| 262 | VLOG(1) << "making execute request: " << request.ShortDebugString(); |
| 263 | Status s = stub_->Execute(&request, &response); |
| 264 | VLOG(1) << "done with request"; |
| 265 | |
| 266 | if (!s.ok()) { |
| 267 | return s; |
| 268 | } |
| 269 | |
| 270 | if (execution_profile != nullptr) { |
| 271 | *execution_profile = response.profile(); |
| 272 | } |
| 273 | |
| 274 | return absl::make_unique<GlobalData>(stub_, response.output()); |
| 275 | } |
| 276 | |
| 277 | StatusOr<std::unique_ptr<GlobalData>> Client::Execute( |
| 278 | const XlaComputation& computation, absl::Span<GlobalData* const> arguments, |