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_KERNEL_H_ 18 #define MINDSPORE_MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_ASCEND_LAUNCH_KERNEL_H_ 19 20 #include <vector> 21 #include <memory> 22 #include "runtime/device/launch_kernel.h" 23 24 namespace mindspore::device::ascend { 25 class AscendLaunchKernel : public LaunchKernel { 26 public: AscendLaunchKernel(void * stream)27 explicit AscendLaunchKernel(void *stream) : LaunchKernel(stream) {} 28 virtual ~AscendLaunchKernel() = default; 29 30 void FreeDeviceMem(void *addr) override; 31 size_t AlignSizeForLaunchKernel(size_t size) override; 32 uint8_t *AllocDeviceMem(size_t size) override; 33 void KernelSelect(const std::shared_ptr<session::KernelGraph> &kernel_graph) override; 34 void KernelBuild(const std::shared_ptr<session::KernelGraph> &kernel_graph) override; 35 36 void SetInputAddr(uint8_t *input_addr) override = 0; 37 void LaunchOpKernel() override = 0; 38 void FreeLaunchDeviceMem() override = 0; 39 }; 40 } // namespace mindspore::device::ascend 41 42 #endif // MINDSPORE_MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_ASCEND_LAUNCH_KERNEL_H_ 43