Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 : * Description: ccu representation store var implementation file
10 : */
11 :
12 : #include "ccu_rep_store_var_v1.h"
13 : #include "string_util.h"
14 : #include "ccu_rep_v1.h"
15 : #include "exception_util.h"
16 : #include "ccu_api_exception.h"
17 :
18 : #include "ccu_ins_generator_base.h"
19 : #include "ccu_kernel.h"
20 :
21 : namespace hcomm {
22 : namespace CcuRep {
23 :
24 : using namespace Hccl;
25 :
26 6 : CcuRepStoreVar::CcuRepStoreVar(CcuInsGeneratorBase* insGeneratorPtr, const Variable &var, const Variable &dst, uint32_t num, bool hscbFlag) :
27 6 : insGeneratorPtr_(insGeneratorPtr), var(var), dst(dst), num(num), hscbFlag(hscbFlag)
28 : {
29 : // for A6 only
30 6 : type = CcuRepType::STORE_VAR;
31 6 : instrCount = insGeneratorPtr_->GetInstrCount(type);
32 6 : }
33 :
34 3 : bool CcuRepStoreVar::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
35 : {
36 3 : this->instrId = instrId;
37 3 : translated = true;
38 :
39 3 : CHK_RET_THROW(Hccl::CcuApiException,
40 : Hccl::StringFormat("[CcuRepStoreVar][%s] failed to translate repStoreVar for instrId[%u] ", __func__, instrId),
41 : insGeneratorPtr_->CcuRepStoreVarTranslate(ccuKernel, instr, instrId, this, dep));
42 :
43 3 : instrId += instrCount;
44 3 : return translated;
45 : }
46 :
47 3 : std::string CcuRepStoreVar::Describe()
48 : {
49 3 : return Hccl::StringFormat("Store Var([%u], [%u], [%u])", var.Id(), dst.Id(), num);
50 : }
51 :
52 : }; // namespace CcuRep
53 : }; // namespace hcomm
|