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_CCSRC_RUNTIME_FRAMEWORK_ACTOR_DEBUG_ACTOR_H_ 18 #define MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_DEBUG_ACTOR_H_ 19 20 #include <vector> 21 #include "runtime/framework/actor/actor_common.h" 22 #include "runtime/framework/device_tensor_store.h" 23 #include "runtime/hardware/device_context.h" 24 25 namespace mindspore { 26 namespace runtime { 27 using mindspore::device::DeviceContext; 28 using mindspore::kernel::KernelLaunchInfo; 29 30 // The debug actor is used to debug and dump kernel info, it gets the kernel real time execution info in the device, so 31 // it is synchronous and blocked. 32 class DebugActor : public ActorBase { 33 public: DebugActor()34 DebugActor() : ActorBase("DebugActor") {} 35 ~DebugActor() override = default; 36 37 // The debug of each node. 38 void Debug(const AnfNodePtr &node, const KernelLaunchInfo *launch_info_, const DeviceContext *device_context, 39 OpContext<DeviceTensor> *const op_context, const AID *from_aid); 40 41 // The debug on step begin. 42 void DebugOnStepBegin(std::vector<KernelGraphPtr> graphs, std::vector<DeviceContext *> device_contexts, 43 OpContext<DeviceTensor> *const op_context, const AID *from_aid); 44 45 // The debug on step end. 46 void DebugOnStepEnd(OpContext<DeviceTensor> *const op_context, const AID *from_aid); 47 48 private: 49 // class members 50 uint32_t exec_order_ = 0; 51 }; 52 53 } // namespace runtime 54 } // namespace mindspore 55 56 #endif // MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_DEBUG_ACTOR_H_ 57