Commit 726a141
authored
[Target] Use LLVM target parser for determining Arm(R) A-Profile Architecture features (#16425)
Currently, target features are determined by a set of fixed checks on
the target string. This works well for checking support of a small
number of simple features, but it doesn't scale. Some problems include:
- There are many non-trivial conditions for which a feature may(not) be
available. It is easy to miss these with the current implementation.
- The inclusion of some features in a target string can imply other
features. For example, "+sve" implies "+neon". This currently isn't
taken into account.
- The tests in tests/cpp/target/parsers/aprofile_test.c suggest that
targets such as "llvm -mcpu=cortex-a+neon" and "llvm -mattr=+noneon"
are supported target strings. The features will be correctly parsed in
TVM, however, they are not valid in LLVM. Therefore, it's possible
that TVM and LLVM have different understanding of the features
available.
This commit uses the more robust LLVM target parser to determine support
for the features in TVM. It leverages previous infrastructure added to
TVM for obtaining a list of all supported features given an input
target, and uses this to check the existance of certain features we're
interested in. It should be trivial to grow this list over time. As a
result of this change, the problems mentioned above are solved.
In the current form, this commit drops support for target strings such
as "llvm -mcpu=cortex-a+neon" and "llvm -mattr=+noneon". A scan of the
codebase suggests this functionality is not in use (only in test cases).
Should we feel the need to support them, or have a smoother migration
for downstream users of TVM we can add a translator to the parser to
convert these into LLVM compatible targets.1 parent 1891b4d commit 726a141
File tree
8 files changed
+282
-223
lines changed- python/tvm/target
- src/target
- llvm
- parsers
- tests
- cpp/target/parsers
- python
- relay/strategy
- target
8 files changed
+282
-223
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
| 202 | + | |
| 203 | + | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
208 | | - | |
| 210 | + | |
209 | 211 | | |
210 | | - | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
216 | | - | |
| 218 | + | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
222 | | - | |
223 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
227 | | - | |
| 232 | + | |
228 | 233 | | |
229 | 234 | | |
230 | 235 | | |
| |||
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
248 | | - | |
| 253 | + | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
| |||
257 | 262 | | |
258 | 263 | | |
259 | 264 | | |
260 | | - | |
| 265 | + | |
261 | 266 | | |
262 | 267 | | |
263 | 268 | | |
| |||
283 | 288 | | |
284 | 289 | | |
285 | 290 | | |
286 | | - | |
287 | | - | |
| 291 | + | |
| 292 | + | |
288 | 293 | | |
289 | 294 | | |
290 | | - | |
| 295 | + | |
291 | 296 | | |
292 | 297 | | |
293 | | - | |
| 298 | + | |
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
| |||
327 | 332 | | |
328 | 333 | | |
329 | 334 | | |
330 | | - | |
| 335 | + | |
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
| |||
381 | 386 | | |
382 | 387 | | |
383 | 388 | | |
384 | | - | |
| 389 | + | |
385 | 390 | | |
386 | | - | |
387 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
388 | 394 | | |
389 | | - | |
| 395 | + | |
390 | 396 | | |
391 | | - | |
| 397 | + | |
392 | 398 | | |
393 | 399 | | |
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
| 403 | + | |
419 | 404 | | |
420 | 405 | | |
421 | 406 | | |
422 | 407 | | |
423 | 408 | | |
424 | 409 | | |
425 | 410 | | |
426 | | - | |
| 411 | + | |
427 | 412 | | |
428 | 413 | | |
429 | | - | |
430 | 414 | | |
431 | 415 | | |
432 | 416 | | |
| |||
832 | 816 | | |
833 | 817 | | |
834 | 818 | | |
835 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
836 | 824 | | |
837 | 825 | | |
838 | 826 | | |
| |||
850 | 838 | | |
851 | 839 | | |
852 | 840 | | |
853 | | - | |
| 841 | + | |
854 | 842 | | |
855 | 843 | | |
856 | 844 | | |
857 | 845 | | |
858 | 846 | | |
859 | | - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
860 | 852 | | |
861 | 853 | | |
862 | 854 | | |
863 | 855 | | |
864 | 856 | | |
865 | 857 | | |
866 | 858 | | |
867 | | - | |
| 859 | + | |
| 860 | + | |
868 | 861 | | |
869 | 862 | | |
870 | | - | |
| 863 | + | |
871 | 864 | | |
872 | 865 | | |
873 | 866 | | |
| |||
877 | 870 | | |
878 | 871 | | |
879 | 872 | | |
880 | | - | |
881 | | - | |
882 | | - | |
| 873 | + | |
883 | 874 | | |
884 | 875 | | |
885 | 876 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
159 | 167 | | |
160 | 168 | | |
161 | 169 | | |
| |||
290 | 298 | | |
291 | 299 | | |
292 | 300 | | |
293 | | - | |
| 301 | + | |
| 302 | + | |
294 | 303 | | |
295 | 304 | | |
296 | 305 | | |
297 | | - | |
| 306 | + | |
298 | 307 | | |
299 | 308 | | |
300 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
| 700 | + | |
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
705 | | - | |
| 705 | + | |
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
725 | | - | |
726 | | - | |
| 725 | + | |
727 | 726 | | |
728 | 727 | | |
729 | 728 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
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 | 57 | | |
83 | 58 | | |
84 | 59 | | |
| |||
101 | 76 | | |
102 | 77 | | |
103 | 78 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
108 | 82 | | |
109 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
110 | 87 | | |
111 | | - | |
| 88 | + | |
| 89 | + | |
112 | 90 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
116 | 101 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 102 | + | |
| 103 | + | |
122 | 104 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
129 | 108 | | |
130 | | - | |
131 | | - | |
132 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
133 | 116 | | |
134 | | - | |
135 | | - | |
136 | | - | |
| 117 | + | |
| 118 | + | |
137 | 119 | | |
138 | 120 | | |
139 | 121 | | |
| |||
0 commit comments