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 : #ifndef ADUMP_COMMON_FEATURES_SUPPORT_INTERFACE_H
11 : #define ADUMP_COMMON_FEATURES_SUPPORT_INTERFACE_H
12 :
13 : #include <set>
14 :
15 : namespace Adx {
16 :
17 : // 大颗粒用户特性能力矩阵。每个平台都注册 FeaturesSupportInterface,通过 supported_ 声明
18 : // 它支持哪些大颗粒特性(即使全平台一致也显式声明)。
19 : enum class AdumpPlatformFeature {
20 : FEATURE_INVALID = 0,
21 : FEATURE_DATA_DUMP, // Data Dump(tensor + stats 合并)
22 : FEATURE_OVERFLOW_DUMP, // overflow dump
23 : FEATURE_EXCEPTION_DUMP_L0, // L0 exception dump
24 : FEATURE_EXCEPTION_DUMP_L1, // L1 exception dump
25 : FEATURE_CORE_DUMP, // coredump(仅 V2/V4)
26 : };
27 :
28 : class FeaturesSupportInterface {
29 : public:
30 10 : virtual ~FeaturesSupportInterface() = default;
31 :
32 49 : bool FeatureIsSupport(AdumpPlatformFeature feature) const
33 : {
34 49 : return supported_.count(feature) > 0;
35 : }
36 :
37 : protected:
38 : std::set<AdumpPlatformFeature> supported_;
39 : };
40 :
41 : } // namespace Adx
42 : #endif // ADUMP_COMMON_FEATURES_SUPPORT_INTERFACE_H
|