Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
3 : * Description: ccu representation implementation file
4 : * Author: sunzhepeng
5 : * Create: 2024-06-17
6 : */
7 :
8 : #include "ccu_rep_v1.h"
9 : #include "ccu_kernel.h"
10 : #include "ccu_interface_assist_v1.h"
11 :
12 : #include "string_util.h"
13 : #include "exception_util.h"
14 : #include "ccu_api_exception.h"
15 :
16 : #include "ccu_ins_generator_base.h"
17 :
18 : namespace hcomm {
19 : namespace CcuRep {
20 :
21 2 : FuncCall::FuncCall(CcuRepContext *context, std::string label) : context(context), label(label)
22 : {
23 2 : CcuInsGeneratorBase* insGenPtr = context->GetInsGenerator();
24 2 : Hccl::CHECK_NULLPTR(insGenPtr, "[FuncCall::FuncCall](label) insGenPtr is nullptr!");
25 2 : repFuncCall = std::make_shared<CcuRepFuncCall>(insGenPtr, label);
26 2 : }
27 :
28 1 : FuncCall::FuncCall(CcuRepContext *context, const Variable &funcAddr) : context(context)
29 : {
30 1 : CcuInsGeneratorBase* insGenPtr = context->GetInsGenerator();
31 1 : Hccl::CHECK_NULLPTR(insGenPtr, "[FuncCall::FuncCall](funcAddr) insGenPtr is nullptr!");
32 1 : repFuncCall = std::make_shared<CcuRepFuncCall>(insGenPtr, funcAddr);
33 1 : }
34 :
35 3 : void FuncCall::AppendToContext()
36 : {
37 3 : if (context == nullptr) {
38 0 : Hccl::THROW<Hccl::CcuApiException>("context is nullptr, func call, append to context");
39 : }
40 3 : return context->Append(repFuncCall);
41 : }
42 :
43 : }; // namespace CcuRep
44 : }; // namespace hcomm
|