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 __PLATFORM_INFOS_IMPL_H__
12 : #define __PLATFORM_INFOS_IMPL_H__
13 :
14 : #include <map>
15 : #include <string>
16 : #include <vector>
17 : #include <memory>
18 : #include "platform/platform_infos_def.h"
19 :
20 : namespace fe {
21 : class PlatFormInfosImpl {
22 : public:
23 136 : PlatFormInfosImpl() = default;
24 : PlatFormInfosImpl(const PlatFormInfosImpl& platform_infos_impl);
25 : PlatFormInfosImpl& operator=(const PlatFormInfosImpl& platform_infos_impl);
26 :
27 : std::map<std::string, std::vector<std::string>> GetAICoreIntrinsicDtype();
28 : std::map<std::string, std::vector<std::string>> GetVectorCoreIntrinsicDtype();
29 : bool GetPlatformRes(const std::string& label, const std::string& key, std::string& val);
30 : bool GetPlatformRes(const std::string& label, std::map<std::string, std::string>& res);
31 : bool GetPlatformRes(std::map<std::string, std::map<std::string, std::string>>& res);
32 :
33 : void SetAICoreIntrinsicDtype(std::map<std::string, std::vector<std::string>>& intrinsic_dtypes);
34 : void SetVectorCoreIntrinsicDtype(std::map<std::string, std::vector<std::string>>& intrinsic_dtypes);
35 : void SetPlatformRes(const std::string& label, std::map<std::string, std::string>& res);
36 : std::map<std::string, std::vector<std::string>> GetFixPipeDtypeMap();
37 : void SetFixPipeDtypeMap(const std::map<std::string, std::vector<std::string>>& fixpipe_dtype_map);
38 :
39 : private:
40 : std::map<std::string, std::vector<std::string>> ai_core_intrinsic_dtype_map_;
41 : std::map<std::string, std::vector<std::string>> vector_core_intrinsic_dtype_map_;
42 : std::map<std::string, std::map<std::string, std::string>> platform_res_map_;
43 : std::map<std::string, std::vector<std::string>> fixpipe_dtype_map_;
44 : };
45 :
46 : class OptionalInfosImpl {
47 : public:
48 : std::string GetSocVersion();
49 : std::string GetCoreType();
50 : uint32_t GetAICoreNum();
51 : std::string GetL1FusionFlag();
52 : std::map<std::string, std::vector<std::string>> GetFixPipeDtypeMap();
53 : void SetFixPipeDtypeMap(const std::map<std::string, std::vector<std::string>>& fixpipe_dtype_map);
54 : void SetSocVersion(std::string soc_version);
55 : void SetCoreType(std::string core_type);
56 : void SetAICoreNum(uint32_t ai_core_num);
57 : void SetL1FusionFlag(std::string l1_fusion_flag);
58 :
59 : private:
60 : std::string soc_version_;
61 : std::string core_type_;
62 : uint32_t ai_core_num_{0};
63 : std::string l1_fusion_flag_;
64 : std::map<std::string, std::vector<std::string>> fixpipe_dtype_map_;
65 : };
66 : } // namespace fe
67 : #endif
|