| 63 | } |
| 64 | |
| 65 | void CollectiveBoxingGenericKernel::ForwardDataContent(KernelContext* ctx) const { |
| 66 | RequestHandle* request_handle = |
| 67 | CHECK_NOTNULL(dynamic_cast<CollectiveBoxingKernelState*>(ctx->state().get())) |
| 68 | ->request_handle(); |
| 69 | const void* send_buff = nullptr; |
| 70 | void* recv_buff = nullptr; |
| 71 | const RankDesc& rank_desc = this->op_conf().collective_boxing_generic_conf().rank_desc(); |
| 72 | const DataType data_type = rank_desc.op_desc().data_type(); |
| 73 | if (GenericOpHasInput(rank_desc)) { |
| 74 | const Blob* in = ctx->BnInOp2Blob("in"); |
| 75 | CHECK_EQ(in->data_type(), data_type); |
| 76 | CHECK(in->shape() == ShapeView(GenericOpGetInputShape(rank_desc))); |
| 77 | send_buff = in->dptr(); |
| 78 | } |
| 79 | if (GenericOpHasOutput(rank_desc)) { |
| 80 | Blob* out = ctx->BnInOp2Blob("out"); |
| 81 | CHECK_EQ(out->data_type(), data_type); |
| 82 | CHECK(out->shape() == ShapeView(GenericOpGetOutputShape(rank_desc))); |
| 83 | recv_buff = out->mut_dptr(); |
| 84 | } |
| 85 | auto* actor_ctx = GetCollectiveBoxingActorContext(ctx); |
| 86 | actor_ctx->Schedule(request_handle, send_buff, recv_buff); |
| 87 | } |
| 88 | |
| 89 | REGISTER_KERNEL(OperatorConf::kCollectiveBoxingGenericConf, CollectiveBoxingGenericKernel); |
| 90 |
nothing calls this directly
no test coverage detected