Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "ccu_rep.h"
12 : #include "ccu_ctx.h"
13 : #include "ccu_interface_assist.h"
14 :
15 : #include "string_util.h"
16 : #include "exception_util.h"
17 : #include "ccu_api_exception.h"
18 :
19 : namespace Hccl {
20 : namespace CcuRep {
21 :
22 3 : FuncBlock::FuncBlock(CcuRepContext* context, std::string label, uint16_t callLayer)
23 3 : : context(context),
24 3 : label(label),
25 3 : callLayer(callLayer)
26 : {
27 3 : repFuncBlock = std::make_shared<CcuRepFuncBlock>(label);
28 3 : AppendToContext(context, repFuncBlock);
29 :
30 3 : curActiveBlock = CurrentBlock(context);
31 :
32 3 : SetCurrentBlock(context, repFuncBlock);
33 :
34 9 : HCCL_INFO(
35 : "Enter block %s, last block %s", repFuncBlock->Describe().c_str(), curActiveBlock->Describe().c_str());
36 3 : }
37 :
38 3 : FuncBlock::~FuncBlock()
39 : {
40 3 : DECTOR_TRY_CATCH("FuncBlock", repFuncBlock->SetCallLayer(callLayer));
41 3 : DECTOR_TRY_CATCH("FuncBlock", SetCurrentBlock(context, curActiveBlock));
42 3 : }
43 :
44 : }; // namespace CcuRep
45 : }; // namespace Hccl
|