blob: 62c8ae62620482bc6b1ca2f53ae52f8603f051ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "armnn/Logging.hpp"
#include "armnn/Utils.hpp"
#if !defined(BARE_METAL) && (defined(__arm__) || defined(__aarch64__))
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
namespace armnn
{
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
{
SetAllLoggingSinks(printToStandardOutput, printToDebugOutput, false);
SetLogFilter(severity);
}
// Defaults to logging completely disabled.
// The user of the library must enable it if they want by calling armnn::ConfigureLogging().
struct DefaultLoggingConfiguration
{
DefaultLoggingConfiguration()
{
ConfigureLogging(false, false, LogSeverity::Trace);
}
};
static DefaultLoggingConfiguration g_DefaultLoggingConfiguration;
// Detect the presence of Neon on Linux
bool NeonDetected()
{
#if !defined(BARE_METAL) && (defined(__arm__) || defined(__aarch64__))
auto hwcaps= getauxval(AT_HWCAP);
#endif
#if !defined(BARE_METAL) && defined(__aarch64__)
if (hwcaps & HWCAP_ASIMD)
{
// On an arm64 device with Neon.
return true;
}
else
{
// On an arm64 device without Neon.
return false;
}
#endif
#if !defined(BARE_METAL) && defined(__arm__)
if (hwcaps & HWCAP_NEON)
{
// On an armhf device with Neon.
return true;
}
else
{
// On an armhf device without Neon.
return false;
}
#endif
// This method of Neon detection is only supported on Linux so in order to prevent a false negative
// we will return true in cases where detection did not run.
return true;
}
} // namespace armnn
|