Line data Source code
1 : /**
2 : * Copyright (c) 2025 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 "ccu_ins_generator_v1.h"
14 : #include "ccu_kernel.h"
15 : namespace hcomm {
16 : namespace CcuRep {
17 :
18 4 : CcuRepRecordSharedNotify::CcuRepRecordSharedNotify(CcuInsGeneratorBase* insGenPtr, const LocalNotify ¬ify, uint16_t mask)
19 4 : : insGenPtr(insGenPtr), notify_(notify), mask_(mask)
20 : {
21 4 : type = CcuRepType::RECORD_SHARED_NOTIFY;
22 4 : instrCount = insGenPtr->GetInstrCount(type);
23 4 : }
24 :
25 2 : bool CcuRepRecordSharedNotify::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
26 : {
27 2 : this->instrId = instrId;
28 2 : translated = true;
29 :
30 2 : insGenPtr->CcuRepRecordSharedNotifyTranslate(ccuKernel, instr, this, dep);
31 2 : CHK_PRT_THROW((instrId > UINT16_MAX - instrCount),
32 : HCCL_ERROR("[CcuRepRecordSharedNotify::Translate]uint16 integer overflow occurs, "
33 : "instrId = [%hu], instrCount = [%hu]", instrId, instrCount),
34 : Hccl::InternalException, "integer overflow");
35 2 : instrId += instrCount;
36 :
37 2 : return translated;
38 : }
39 :
40 1 : std::string CcuRepRecordSharedNotify::Describe()
41 : {
42 1 : return Hccl::StringFormat("Post, Use semIndex[%u] and mask[%04x]", notify_.Id(), mask_);
43 : }
44 :
45 : }; // namespace CcuRep
46 : }; // namespace hcomm
|