| 67 | // A participant in a Collective. |
| 68 | struct Participant { |
| 69 | Participant(se::StreamExecutor* executor, se::Stream* tensor_stream, |
| 70 | const DeviceBase::GpuDeviceInfo* info, const Tensor* input, Tensor* output, |
| 71 | int global_rank, DoneCallback done_callback) |
| 72 | : executor(executor), |
| 73 | tensor_stream(tensor_stream), |
| 74 | event_mgr(info->event_mgr), |
| 75 | gpu_device_id(info->gpu_id), |
| 76 | #if TENSORFLOW_USE_ROCM |
| 77 | context(static_cast<GPUDeviceContext*>(info->default_context)), |
| 78 | #endif |
| 79 | input(input), |
| 80 | input_event(nullptr), |
| 81 | output(output), |
| 82 | global_rank(global_rank), |
| 83 | done_callback(std::move(done_callback)), |
| 84 | root(false) { |
| 85 | DCHECK(executor != nullptr); |
| 86 | DCHECK(event_mgr != nullptr); |
| 87 | DCHECK(tensor_stream != nullptr); |
| 88 | if (input != nullptr) { |
| 89 | input_event = absl::make_unique<se::Event>(executor); |
| 90 | input_event->Init(); |
| 91 | tensor_stream->ThenRecordEvent(input_event.get()); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // StreamExecutor for the device. Expected to be live for process lifetime. |
| 96 | se::StreamExecutor* const executor = nullptr; |