-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathbinding.gyp
More file actions
203 lines (203 loc) Β· 7.32 KB
/
Copy pathbinding.gyp
File metadata and controls
203 lines (203 loc) Β· 7.32 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
{
"variables": {
"openssl_fips": "",
# `NK_MARCH_NATIVE=1` opts into a host-tuned, non-portable build, as in CMakeLists.txt.
"nk_march_native%": "<!(node -p \"['1','true','TRUE'].includes(process.env.NK_MARCH_NATIVE||'')?1:0\")"
},
"targets": [
{
"target_name": "numkong",
"sources": [
"javascript/numkong.c",
"c/numkong.c",
"c/parallel.c",
"c/dispatch_f64.c",
"c/dispatch_f32.c",
"c/dispatch_f16.c",
"c/dispatch_bf16.c",
"c/dispatch_i8.c",
"c/dispatch_u8.c",
"c/dispatch_u1.c",
"c/dispatch_e4m3.c",
"c/dispatch_e5m2.c",
"c/dispatch_other.c",
"c/dispatch_f64c.c",
"c/dispatch_f32c.c",
"c/dispatch_f16c.c",
"c/dispatch_bf16c.c",
"c/dispatch_i16.c",
"c/dispatch_i32.c",
"c/dispatch_i64.c",
"c/dispatch_u16.c",
"c/dispatch_u32.c",
"c/dispatch_u64.c",
"c/dispatch_i4.c",
"c/dispatch_u4.c",
"c/dispatch_e2m3.c",
"c/dispatch_e3m2.c",
],
"include_dirs": [
"include",
"c"
],
"defines": [
"NK_NATIVE_F16=0",
"NK_NATIVE_BF16=0",
"NK_DYNAMIC_DISPATCH=1"
],
"cflags": [
"-std=c11",
"-O3",
"-Wno-unknown-pragmas",
"-Wno-maybe-uninitialized",
"-Wno-cast-function-type",
"-Wno-switch",
"-Wno-psabi",
"-include",
"<(module_root_dir)/nk_probes.h",
],
"msvs_settings": {
"VCCLCompilerTool": {
"ForcedIncludeFiles": [
"<(module_root_dir)/nk_probes.h"
],
"AdditionalOptions": [
"/Zc:preprocessor"
],
},
},
"conditions": [
# Only this branch gets OpenMP; macOS and Windows use their own pools.
[
"OS!='mac' and OS!='win'",
{
"cflags": [
"-fopenmp"
],
"ldflags": [
"-fopenmp"
]
}
],
# Pin TU baseline to each arch's ABI floor; SIMD kernels use per-function pragmas.
# Keep per-arch table in sync with CMakeLists.txt, build.rs, setup.py.
# macOS is excluded: `-arch` already pins the slice, and a per-arch `-march=`
# conflicts with the other slice of a universal build.
[
"nk_march_native==0 and OS!='win' and OS!='mac' and target_arch=='arm64'",
{
"cflags": [
"-march=armv8-a"
]
}
],
[
"nk_march_native==0 and OS!='win' and OS!='mac' and target_arch=='x64'",
{
"cflags": [
"-march=x86-64"
]
}
],
[
"nk_march_native==0 and OS!='win' and OS!='mac' and target_arch=='riscv64'",
{
"cflags": [
"-march=rv64gc"
]
}
],
[
"nk_march_native==0 and OS!='win' and OS!='mac' and target_arch=='ppc64'",
{
"cflags": [
"-mcpu=power8"
]
}
],
[
"nk_march_native==0 and OS!='win' and OS!='mac' and target_arch=='loong64'",
{
"cflags": [
"-march=loongarch64",
"-mlasx"
]
}
],
[
"nk_march_native==1 and OS!='win' and OS!='mac'",
{
"cflags": [
"-march=native"
]
}
],
# Forbid auto-vectorization so serial fallbacks don't get silently
# promoted to NEON/SSE2/VSX. SIMD kernels use explicit intrinsics
# and per-function `target` pragmas; unaffected. MSVC has no
# command-line vectorizer toggle.
[
"OS!='win'",
{
"cflags": [
"-fno-tree-vectorize",
"-fno-tree-slp-vectorize"
]
}
],
# gyp ignores `cflags` on the mac flavor, so every flag above must be
# repeated here or the addon builds unoptimized and without the probes.
[
"OS=='mac'",
{
"xcode_settings": {
"MACOSX_DEPLOYMENT_TARGET": "11.0",
"OTHER_CFLAGS": [
"-std=c11",
"-O3",
"-fno-tree-vectorize",
"-fno-tree-slp-vectorize",
"-Wno-unknown-pragmas",
"-Wno-cast-function-type",
"-Wno-switch",
"-include",
"<(module_root_dir)/nk_probes.h"
]
}
}
],
# MSVC: no per-function target pragma; these match defaults.
[
"OS=='win' and target_arch=='arm64'",
{
"defines": [
"_ARM64_"
],
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/arch:armv8.0"
]
}
}
}
],
[
"OS=='win' and target_arch=='x64'",
{
"defines": [
"_AMD64_"
],
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/arch:SSE2"
]
}
}
}
],
],
}
],
}