|
14 | 14 | #include "ie_parallel.hpp"
|
15 | 15 | #include "ie_system_conf.h"
|
16 | 16 |
|
17 |
| -#include <cpp_interfaces/interface/ie_internal_plugin_config.hpp> |
| 17 | +#include "cpp_interfaces/interface/ie_internal_plugin_config.hpp" |
18 | 18 | #include "openvino/core/type/element_type_traits.hpp"
|
19 | 19 | #include "openvino/runtime/properties.hpp"
|
20 |
| -#include <cpu/x64/cpu_isa_traits.hpp> |
| 20 | +#include "utils/debug_capabilities.h" |
| 21 | +#include "cpu/x64/cpu_isa_traits.hpp" |
21 | 22 |
|
22 | 23 | namespace ov {
|
23 | 24 | namespace intel_cpu {
|
@@ -48,10 +49,24 @@ Config::Config() {
|
48 | 49 | if (!dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core_bf16))
|
49 | 50 | enforceBF16 = false;
|
50 | 51 |
|
51 |
| - CPU_DEBUG_CAP_ENABLE(readDebugCapsProperties()); |
| 52 | + CPU_DEBUG_CAP_ENABLE(applyDebugCapsProperties()); |
| 53 | + |
52 | 54 | updateProperties();
|
53 | 55 | }
|
54 | 56 |
|
| 57 | +#ifdef CPU_DEBUG_CAPS |
| 58 | +/** |
| 59 | + * Debug capabilities configuration has more priority than common one |
| 60 | + * Some of the debug capabilities also require to enable some of common |
| 61 | + * configuration properties |
| 62 | + */ |
| 63 | +void Config::applyDebugCapsProperties() { |
| 64 | + // always enable perf counters for verbose mode and performance summary |
| 65 | + if (!debugCaps.verbose.empty() || !debugCaps.summaryPerf.empty()) |
| 66 | + collectPerfCounters = true; |
| 67 | +} |
| 68 | +#endif |
| 69 | + |
55 | 70 | void Config::readProperties(const std::map<std::string, std::string> &prop) {
|
56 | 71 | const auto streamExecutorConfigKeys = streamExecutorConfig.SupportedKeys();
|
57 | 72 | const auto hintsConfigKeys = perfHintsConfig.SupportedKeys();
|
@@ -184,7 +199,7 @@ void Config::readProperties(const std::map<std::string, std::string> &prop) {
|
184 | 199 | if (exclusiveAsyncRequests) // Exclusive request feature disables the streams
|
185 | 200 | streamExecutorConfig._streams = 1;
|
186 | 201 |
|
187 |
| - CPU_DEBUG_CAP_ENABLE(readDebugCapsProperties()); |
| 202 | + CPU_DEBUG_CAP_ENABLE(applyDebugCapsProperties()); |
188 | 203 | updateProperties();
|
189 | 204 | }
|
190 | 205 |
|
@@ -239,58 +254,6 @@ void Config::updateProperties() {
|
239 | 254 | _config.insert({PluginConfigParams::KEY_CACHE_DIR, cache_dir});
|
240 | 255 | }
|
241 | 256 |
|
242 |
| -#ifdef CPU_DEBUG_CAPS |
243 |
| -void Config::readDebugCapsProperties() { |
244 |
| - auto readEnv = [](const char* envVar) { |
245 |
| - return std::getenv(envVar); |
246 |
| - }; |
247 |
| - |
248 |
| - auto parseDumpFormat = [](const std::string& format) { |
249 |
| - if (format == "BIN") |
250 |
| - return FORMAT::BIN; |
251 |
| - else if (format == "TEXT") |
252 |
| - return FORMAT::TEXT; |
253 |
| - else |
254 |
| - IE_THROW() << "readDebugCapsProperties: Unknown dump format"; |
255 |
| - }; |
256 |
| - |
257 |
| - const char* envVarValue = nullptr; |
258 |
| - |
259 |
| - if (envVarValue = readEnv("OV_CPU_EXEC_GRAPH_PATH")) |
260 |
| - execGraphPath = envVarValue; |
261 |
| - |
262 |
| - if (envVarValue = readEnv("OV_CPU_VERBOSE")) |
263 |
| - verbose = envVarValue; |
264 |
| - |
265 |
| - if (envVarValue = readEnv("OV_CPU_BLOB_DUMP_DIR")) |
266 |
| - blobDumpDir = envVarValue; |
267 |
| - |
268 |
| - if (envVarValue = readEnv("OV_CPU_BLOB_DUMP_FORMAT")) |
269 |
| - blobDumpFormat = parseDumpFormat(envVarValue); |
270 |
| - |
271 |
| - if (envVarValue = readEnv("OV_CPU_BLOB_DUMP_NODE_EXEC_ID")) |
272 |
| - blobDumpFilters[BY_EXEC_ID] = envVarValue; |
273 |
| - |
274 |
| - if (envVarValue = readEnv("OV_CPU_BLOB_DUMP_NODE_PORTS")) |
275 |
| - blobDumpFilters[BY_PORTS] = envVarValue; |
276 |
| - |
277 |
| - if (envVarValue = readEnv("OV_CPU_BLOB_DUMP_NODE_TYPE")) |
278 |
| - blobDumpFilters[BY_TYPE] = envVarValue; |
279 |
| - |
280 |
| - if (envVarValue = readEnv("OV_CPU_BLOB_DUMP_NODE_NAME")) |
281 |
| - blobDumpFilters[BY_NAME] = envVarValue; |
282 |
| - |
283 |
| - if (envVarValue = readEnv("OV_CPU_SUMMARY_PERF")) { |
284 |
| - collectPerfCounters = true; |
285 |
| - summaryPerf = envVarValue; |
286 |
| - } |
287 |
| - |
288 |
| - // always enable perf counters for verbose mode |
289 |
| - if (!verbose.empty()) |
290 |
| - collectPerfCounters = true; |
291 |
| -} |
292 |
| -#endif // CPU_DEBUG_CAPS |
293 |
| - |
294 | 257 | } // namespace intel_cpu
|
295 | 258 | } // namespace ov
|
296 | 259 |
|
0 commit comments