Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
3 : * Description: ccu representation store implementation file
4 : * Create: 2025-03-21
5 : */
6 :
7 : #include "ccu_rep_v1.h"
8 : #include "string_util.h"
9 : #include "exception_util.h"
10 : #include "ccu_api_exception.h"
11 :
12 : #include "ccu_ins_generater_base.h"
13 : #include "ccu_kernel.h"
14 :
15 : namespace hcomm {
16 : namespace CcuRep {
17 :
18 : using namespace Hccl;
19 :
20 5 : CcuRepStore::CcuRepStore(CcuInsGeneraterBase* insGenPtr, const Variable &var, uint64_t addr, uint32_t num) :
21 5 : insGeneratorPtr_(insGenPtr), var(var), addr(addr), num(num)
22 : {
23 5 : type = CcuRepType::STORE;
24 5 : instrCount = insGeneratorPtr_->GetInstrCount(type);
25 5 : }
26 :
27 3 : bool CcuRepStore::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
28 : {
29 3 : this->instrId = instrId;
30 3 : translated = true;
31 3 : CHK_RET_THROW(Hccl::CcuApiException,
32 : Hccl::StringFormat("[CcuRepStore][%s] failed to translate repStore for instrId[%u] ", __func__, instrId),
33 : insGeneratorPtr_->CcuRepStoreTranslate(ccuKernel, instr, instrId, this, dep));
34 3 : instrId += instrCount;
35 :
36 3 : return translated;
37 : }
38 :
39 3 : std::string CcuRepStore::Describe()
40 : {
41 3 : return Hccl::StringFormat("Store([%u], [%llu], [%u])", var.Id(), addr, num);
42 : }
43 :
44 : }; // namespace CcuRep
45 : }; // namespace hcomm
|