1 /** 2 * Copyright 2021 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_MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_ASCEND_LAUNCH_MUL_H_ 18 #define MINDSPORE_MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_ASCEND_LAUNCH_MUL_H_ 19 20 #include <vector> 21 #include <memory> 22 #include "runtime/device/launch_mul.h" 23 #include "runtime/device/ascend/ascend_launch_kernel.h" 24 25 namespace mindspore::device::ascend { 26 class AscendLaunchMul : public AscendLaunchKernel, public LaunchMul { 27 public: AscendLaunchMul(void * stream,TypeId dtype,size_t total_size)28 AscendLaunchMul(void *stream, TypeId dtype, size_t total_size) 29 : AscendLaunchKernel(stream), LaunchMul(dtype, total_size) {} 30 ~AscendLaunchMul() override = default; 31 SetInputAddr(uint8_t * input1_addr)32 void SetInputAddr(uint8_t *input1_addr) override { input1_addr_ = input1_addr; } 33 void FreeDeviceMem(void *addr) override; 34 size_t AlignSizeForLaunchKernel(size_t size) override; 35 uint8_t *AllocDeviceMem(size_t size) override; 36 void KernelSelect(const std::shared_ptr<session::KernelGraph> &kernel_graph) override; 37 void KernelBuild(const std::shared_ptr<session::KernelGraph> &kernel_graph) override; 38 39 void LaunchOpKernel() override; 40 void FreeLaunchDeviceMem() override; 41 void CopyHostMemToDevice(size_t origin_size, size_t dst_size) override; 42 }; 43 } // namespace mindspore::device::ascend 44 45 #endif // MINDSPORE_MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_ASCEND_LAUNCH_MUL_H_ 46