1 /** 2 * Copyright 2022-2023 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_CCSRC_PLUGIN_DEVICE_CPU_KERNEL_RPC_RPC_RECV_KERNEL_H_ 18 #define MINDSPORE_CCSRC_PLUGIN_DEVICE_CPU_KERNEL_RPC_RPC_RECV_KERNEL_H_ 19 20 #include <vector> 21 #include "plugin/device/cpu/kernel/rpc/rpc_kernel.h" 22 23 namespace mindspore { 24 namespace kernel { 25 // RpcRecvKernel receives data from another process across network communication. It can not be launched until remote 26 // data is received and inputs are ready. 27 class RpcRecvKernelMod : public RpcKernelMod { 28 public: RpcRecvKernelMod()29 RpcRecvKernelMod() : recv_monad_(false) {} 30 ~RpcRecvKernelMod() override = default; 31 32 bool Launch(const std::vector<KernelTensor *> &inputs, const std::vector<KernelTensor *> &, 33 const std::vector<KernelTensor *> &) override; 34 35 bool Init(const std::vector<KernelTensor *> &inputs, const std::vector<KernelTensor *> &outputs) override; 36 set_real_data_offset(const std::vector<size_t> & real_data_offset)37 void set_real_data_offset(const std::vector<size_t> &real_data_offset) { real_data_offset_ = real_data_offset; } 38 39 std::vector<KernelAttr> GetOpSupport() override; 40 41 private: 42 // Whether this RpcRecv node receives a monda data. 43 bool recv_monad_; 44 45 // When this kernel receives dynamic shape data, the data must be parsed by offset set by RecvActor. 46 std::vector<size_t> real_data_offset_; 47 }; 48 } // namespace kernel 49 } // namespace mindspore 50 51 #endif // MINDSPORE_CCSRC_PLUGIN_DEVICE_CPU_KERNEL_RPC_RPC_RECV_KERNEL_H_ 52