blob: 26cb525bcf4199016931a5ebeacb202fdf450bde (
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
|
//
// Copyright © 2020 ARM Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
package arm_compute_library_nn_driver
import (
"android/soong/android"
"android/soong/cc"
"strings"
)
func globalFlags(ctx android.BaseContext) []string {
var cppflags []string
if ctx.AConfig().PlatformVersionName() == "Q" || ctx.AConfig().PlatformVersionName() == "10" {
cppflags = append(cppflags, "-fno-addrsig")
}
if ctx.AConfig().PlatformVersionName() == "R" || ctx.AConfig().PlatformVersionName() == "11" {
cppflags = append(cppflags, "-fno-addrsig")
}
data_types := strings.Split(ctx.AConfig().GetenvWithDefault("COMPUTE_LIB_DATA_TYPE", "ALL"), ",")
for _, x := range data_types {
if strings.ToUpper(x) == "ALL" || strings.ToUpper(x) == "FP16" {
cppflags = append(cppflags, "-DENABLE_FP16_KERNELS")
}
if strings.ToUpper(x) == "ALL" || strings.ToUpper(x) == "FP32" {
cppflags = append(cppflags, "-DENABLE_FP32_KERNELS")
}
}
return cppflags
}
func clframeworkNNDriverDefaults(ctx android.LoadHookContext) {
type props struct {
Cppflags []string
}
p := &props{}
p.Cppflags = globalFlags(ctx)
ctx.AppendProperties(p)
}
func init() {
android.RegisterModuleType("arm_compute_library_defaults", clframeworkNNDriverDefaultsFactory)
}
func clframeworkNNDriverDefaultsFactory() android.Module {
module := cc.DefaultsFactory()
android.AddLoadHook(module, clframeworkNNDriverDefaults)
return module
}
|