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