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 : #ifndef HCCLV2_CCU_CONTEXT_REDUCE_TAIL_BLOCK_H_
12 : #define HCCLV2_CCU_CONTEXT_REDUCE_TAIL_BLOCK_H_
13 :
14 : #include <vector>
15 : #include <ios>
16 : #include "log.h"
17 : #include "ccu_context_alg_base.h"
18 : #include "ccu_datatype.h"
19 :
20 : namespace Hccl {
21 :
22 : class CcuContextReduceTailBlock : public CcuContextAlgBase {
23 : public:
24 : CcuContextReduceTailBlock(
25 : const CcuCtxArg& arg, const std::vector<CcuTransport*>& transports, const CcuTransportGroup& group);
26 0 : ~CcuContextReduceTailBlock() override {}
27 :
28 : void Algorithm() override;
29 : std::vector<uint64_t> GeneArgs(const CcuTaskArg& arg) override;
30 :
31 : private:
32 : void ExportVariables();
33 : void InitResource();
34 : void DoGroupReduce();
35 : void SyncMainBlock(uint32_t ctxSignalIndex);
36 :
37 : std::string notifySignal_ = "empty_signal";
38 :
39 : DataType dataType_;
40 : DataType outputDataType_;
41 :
42 : std::vector<CcuRep::Variable> token_;
43 : std::vector<CcuRep::Variable> input_;
44 : CcuRep::Variable output_;
45 :
46 : CcuRep::Variable inputOffset_;
47 : CcuRep::Variable outputOffset_;
48 :
49 : GroupOpSize groupOpSize_;
50 :
51 : CcuRep::MaskSignal mainBlockCtxSignal_;
52 : CcuRep::MaskSignal tailBlockCtxSignal_;
53 : };
54 : } // namespace Hccl
55 :
56 : #endif // HCCLV2_CCU_CONTEXT_REDUCE_TAIL_BLOCK_H_
|