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), label(label), callLayer(callLayer)
24 : {
25 3 : repFuncBlock = std::make_shared<CcuRepFuncBlock>(label);
26 3 : AppendToContext(context, repFuncBlock);
27 :
28 3 : curActiveBlock = CurrentBlock(context);
29 :
30 3 : SetCurrentBlock(context, repFuncBlock);
31 :
32 9 : HCCL_INFO("Enter block %s, last block %s", repFuncBlock->Describe().c_str(), curActiveBlock->Describe().c_str());
33 3 : }
34 :
35 3 : FuncBlock::~FuncBlock()
36 : {
37 3 : DECTOR_TRY_CATCH("FuncBlock", repFuncBlock->SetCallLayer(callLayer));
38 3 : DECTOR_TRY_CATCH("FuncBlock", SetCurrentBlock(context, curActiveBlock));
39 3 : }
40 :
41 : }; // namespace CcuRep
42 : }; // namespace Hccl
|