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 :
13 : #include "string_util.h"
14 : #include "exception_util.h"
15 : #include "ccu_api_exception.h"
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 261 : CcuRepNop::CcuRepNop(CcuInsGeneratorBase* insGeneratorPtr) : insGeneratorPtr_(insGeneratorPtr)
25 : {
26 261 : type = CcuRepType::NOP;
27 261 : instrCount = insGeneratorPtr_->GetInstrCount(type);
28 261 : }
29 :
30 146 : bool CcuRepNop::Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
31 : {
32 146 : this->instrId = instrId;
33 146 : translated = true;
34 :
35 146 : CHK_PRT_THROW(
36 : insGeneratorPtr_->CcuRepNopTranslate(ccuKernel, instr, instrId, this, dep) != HcclResult::HCCL_SUCCESS,
37 : HCCL_ERROR("[CcuRepNop][Translate] failed to translate for instrId[%u]", instrId), Hccl::CcuApiException,
38 : "CcuRepNop translate failed");
39 :
40 146 : instrId += instrCount;
41 :
42 146 : return translated;
43 : }
44 :
45 1 : std::string CcuRepNop::Describe() { return Hccl::StringFormat("Nop"); }
46 :
47 : }; // namespace CcuRep
48 : }; // namespace hcomm
|