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 : */
10 :
11 : #include "ccu_rep_v1.h"
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 : #include "ccu_kernel.h"
18 :
19 : namespace hcomm {
20 : namespace CcuRep {
21 :
22 : using namespace Hccl;
23 :
24 6 : CcuRepStore::CcuRepStore(CcuInsGeneratorBase* insGenPtr, const Variable& var, uint64_t addr, uint32_t num)
25 6 : : insGeneratorPtr_(insGenPtr),
26 6 : var(var),
27 6 : addr(addr),
28 6 : num(num)
29 : {
30 6 : type = CcuRepType::STORE;
31 6 : instrCount = insGeneratorPtr_->GetInstrCount(type);
32 6 : }
33 :
34 3 : bool CcuRepStore::Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
35 : {
36 3 : this->instrId = instrId;
37 3 : translated = true;
38 3 : CHK_PRT_THROW(
39 : insGeneratorPtr_->CcuRepStoreTranslate(ccuKernel, instr, instrId, this, dep) != HcclResult::HCCL_SUCCESS,
40 : HCCL_ERROR("[CcuRepStore][Translate] failed to translate for instrId[%u]", instrId), Hccl::CcuApiException,
41 : "CcuRepStore translate failed");
42 3 : instrId += instrCount;
43 :
44 3 : return translated;
45 : }
46 :
47 3 : std::string CcuRepStore::Describe() { return Hccl::StringFormat("Store([%u], [%llu], [%u])", var.Id(), addr, num); }
48 :
49 : }; // namespace CcuRep
50 : }; // namespace hcomm
|