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 HCCL_AICPU_RES_PACKAGE_HELPER_H
12 : #define HCCL_AICPU_RES_PACKAGE_HELPER_H
13 :
14 : #include <vector>
15 : #include "hccl/base.h"
16 : #include "enum_factory.h"
17 : #include "binary_stream.h"
18 : namespace Hccl {
19 :
20 : constexpr u32 MODULE_NAME_LEN = 128;
21 305 : MAKE_ENUM(AicpuResMgrType, STREAM, QUEUE_NOTIFY, QUEUE_BCAST_POST_CNT_NOTIFY, QUEUE_WAIT_GROUP_CNT_NOTIFY,
22 : HOST_DEV_SYNC_NOTIFY, TRANSPORT, CONNECTD_MGR, ALG_TOPO, ALG_COMP_INFO)
23 :
24 : struct ModuleData {
25 : char name[MODULE_NAME_LEN]{0};
26 : std::vector<char> data;
27 : };
28 :
29 : BinaryStream &operator<<(BinaryStream &binaryStream, const ModuleData &m);
30 : BinaryStream &operator>>(BinaryStream &binaryStream, ModuleData &m);
31 :
32 : class AicpuResPackageHelper {
33 : public:
34 : std::vector<char> GetPackedData(std::vector<ModuleData> &dataVec) const;
35 :
36 : std::vector<ModuleData> ParsePackedData(std::vector<char> &data) const;
37 : };
38 :
39 : } // namespace Hccl
40 :
41 : #endif // HCCL_AICPU_RES_PACKAGE_HELPER_H
|