LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/primitive - prim_rules.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-08-04 10:52:23 Functions: 55.0 % 20 11

            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_PRIM_RULES_H
      12              : #define HCCLV2_PRIM_RULES_H
      13              : 
      14              : #include <map>
      15              : #include <vector>
      16              : #include <memory>
      17              : #include <algorithm>
      18              : #include <functional>
      19              : 
      20              : #include "instruction.h"
      21              : #include "primitive.h"
      22              : #include "prim_translator.h"
      23              : 
      24              : namespace Hccl {
      25              : using namespace std;
      26              : 
      27              : MAKE_ENUM(InsArraySize, ZERO, ONE, TWO, THREE, FOUR, FIVE);
      28              : MAKE_ENUM(InsArrayIndex, ZERO, ONE, TWO, THREE, FOUR);
      29              : constexpr u32 REDUCE_SIZE_DOUBLE = 2;
      30              : 
      31              : vector<unique_ptr<Instruction>> Translate(const PrimPostTo &postTo);
      32              : vector<unique_ptr<Instruction>> Translate(const PrimWaitFrom &waitFrom);
      33              : vector<unique_ptr<Instruction>> Translate(const PrimWaitGroup &waitGroup);
      34              : vector<unique_ptr<Instruction>> Translate(const PrimLocalReduce &localReduce);
      35              : vector<unique_ptr<Instruction>> Translate(const PrimLocalCopy &localCopy);
      36              : vector<unique_ptr<Instruction>> Translate(const PrimSend &send);
      37              : vector<unique_ptr<Instruction>> Translate(const PrimRecv &recv);
      38              : vector<unique_ptr<Instruction>> TranslateWithInlineReduce(const PrimSendReduce &sendReduce);
      39              : vector<unique_ptr<Instruction>> TranslateWithoutInlineReduce(const PrimSendReduce &sendReduce);
      40              : vector<unique_ptr<Instruction>> Translate(const PrimSendReduce &sendReduce);
      41              : vector<unique_ptr<Instruction>> TranslateWithInlineReduce(const PrimRecvReduce &recvReduce);
      42              : vector<unique_ptr<Instruction>> TranslateWithoutInlineReduce(const PrimRecvReduce &recvReduce);
      43              : vector<unique_ptr<Instruction>> Translate(const PrimRecvReduce &recvReduce);
      44              : vector<unique_ptr<Instruction>> GenerateTempInstruction(const PrimGroup &group);
      45              : vector<unique_ptr<Instruction>> Translate(const PrimGroup &group);
      46              : 
      47         2800 : template <typename PRIM_TYPE> PrimTranslator::TranslateRule GetRule()
      48              : {
      49         2804 :     return [](const Primitive &prim) -> vector<unique_ptr<Instruction>> {
      50            4 :         return Translate(static_cast<const PRIM_TYPE &>(prim));
      51         2800 :     };
      52              : }
      53              : 
      54              : } // namespace Hccl
      55              : 
      56              : #endif // HCCLV2_PRIM_RULES_H
        

Generated by: LCOV version 2.0-1