1 /** 2 * Copyright 2019 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_BACKEND_KERNEL_COMPILER_ASCEND_KERNEL_MOD_H_ 18 #define MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_ASCEND_KERNEL_MOD_H_ 19 20 #include <vector> 21 #include <memory> 22 #include "runtime/device/ascend/ge_runtime/task_info.h" 23 #include "backend/kernel_compiler/kernel.h" 24 #ifndef ENABLE_SECURITY 25 #include "debug/data_dump/dump_json_parser.h" 26 #endif 27 28 using TaskInfoPtr = std::shared_ptr<mindspore::ge::model_runner::TaskInfo>; 29 namespace mindspore { 30 namespace kernel { 31 class AscendKernelMod : public KernelMod { 32 public: 33 virtual std::vector<TaskInfoPtr> GenTask(const std::vector<AddressPtr> &, const std::vector<AddressPtr> &, 34 const std::vector<AddressPtr> &, uint32_t) = 0; block_dim()35 uint32_t block_dim() { return block_dim_; } stream_id()36 uint32_t stream_id() { return stream_id_; } NeedDump()37 virtual bool NeedDump() { 38 #ifndef ENABLE_SECURITY 39 const auto &dump_json = DumpJsonParser::GetInstance(); 40 return dump_json.NeedDump(fullname_) && dump_json.async_dump_enabled() && dump_json.op_debug_mode() == 0 && 41 !is_monad_; 42 #else 43 return false; 44 #endif 45 } 46 47 protected: 48 uint32_t block_dim_{1}; 49 uint32_t stream_id_{0}; 50 }; 51 } // namespace kernel 52 } // namespace mindspore 53 54 #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_ASCEND_KERNEL_MOD_H_ 55