LLVM 20.0.0git
TargetParser.cpp
Go to the documentation of this file.
1//===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements a target parser to recognise hardware features such as
10// FPU/CPU/ARCH names as well as specific support such as HDIV, etc.
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/ADT/ArrayRef.h"
17
18using namespace llvm;
19using namespace AMDGPU;
20
21namespace {
22
23struct GPUInfo {
25 StringLiteral CanonicalName;
27 unsigned Features;
28};
29
30constexpr GPUInfo R600GPUs[] = {
31 // Name Canonical Kind Features
32 // Name
33 {{"r600"}, {"r600"}, GK_R600, FEATURE_NONE },
34 {{"rv630"}, {"r600"}, GK_R600, FEATURE_NONE },
35 {{"rv635"}, {"r600"}, GK_R600, FEATURE_NONE },
36 {{"r630"}, {"r630"}, GK_R630, FEATURE_NONE },
37 {{"rs780"}, {"rs880"}, GK_RS880, FEATURE_NONE },
38 {{"rs880"}, {"rs880"}, GK_RS880, FEATURE_NONE },
39 {{"rv610"}, {"rs880"}, GK_RS880, FEATURE_NONE },
40 {{"rv620"}, {"rs880"}, GK_RS880, FEATURE_NONE },
41 {{"rv670"}, {"rv670"}, GK_RV670, FEATURE_NONE },
42 {{"rv710"}, {"rv710"}, GK_RV710, FEATURE_NONE },
43 {{"rv730"}, {"rv730"}, GK_RV730, FEATURE_NONE },
44 {{"rv740"}, {"rv770"}, GK_RV770, FEATURE_NONE },
45 {{"rv770"}, {"rv770"}, GK_RV770, FEATURE_NONE },
46 {{"cedar"}, {"cedar"}, GK_CEDAR, FEATURE_NONE },
47 {{"palm"}, {"cedar"}, GK_CEDAR, FEATURE_NONE },
48 {{"cypress"}, {"cypress"}, GK_CYPRESS, FEATURE_FMA },
49 {{"hemlock"}, {"cypress"}, GK_CYPRESS, FEATURE_FMA },
50 {{"juniper"}, {"juniper"}, GK_JUNIPER, FEATURE_NONE },
51 {{"redwood"}, {"redwood"}, GK_REDWOOD, FEATURE_NONE },
52 {{"sumo"}, {"sumo"}, GK_SUMO, FEATURE_NONE },
53 {{"sumo2"}, {"sumo"}, GK_SUMO, FEATURE_NONE },
54 {{"barts"}, {"barts"}, GK_BARTS, FEATURE_NONE },
55 {{"caicos"}, {"caicos"}, GK_CAICOS, FEATURE_NONE },
56 {{"aruba"}, {"cayman"}, GK_CAYMAN, FEATURE_FMA },
57 {{"cayman"}, {"cayman"}, GK_CAYMAN, FEATURE_FMA },
58 {{"turks"}, {"turks"}, GK_TURKS, FEATURE_NONE }
59};
60
61// This table should be sorted by the value of GPUKind
62// Don't bother listing the implicitly true features
63constexpr GPUInfo AMDGCNGPUs[] = {
64 // clang-format off
65 // Name Canonical Kind Features
66 // Name
67 {{"gfx600"}, {"gfx600"}, GK_GFX600, FEATURE_FAST_FMA_F32},
68 {{"tahiti"}, {"gfx600"}, GK_GFX600, FEATURE_FAST_FMA_F32},
69 {{"gfx601"}, {"gfx601"}, GK_GFX601, FEATURE_NONE},
70 {{"pitcairn"}, {"gfx601"}, GK_GFX601, FEATURE_NONE},
71 {{"verde"}, {"gfx601"}, GK_GFX601, FEATURE_NONE},
72 {{"gfx602"}, {"gfx602"}, GK_GFX602, FEATURE_NONE},
73 {{"hainan"}, {"gfx602"}, GK_GFX602, FEATURE_NONE},
74 {{"oland"}, {"gfx602"}, GK_GFX602, FEATURE_NONE},
75 {{"gfx700"}, {"gfx700"}, GK_GFX700, FEATURE_NONE},
76 {{"kaveri"}, {"gfx700"}, GK_GFX700, FEATURE_NONE},
77 {{"gfx701"}, {"gfx701"}, GK_GFX701, FEATURE_FAST_FMA_F32},
78 {{"hawaii"}, {"gfx701"}, GK_GFX701, FEATURE_FAST_FMA_F32},
79 {{"gfx702"}, {"gfx702"}, GK_GFX702, FEATURE_FAST_FMA_F32},
80 {{"gfx703"}, {"gfx703"}, GK_GFX703, FEATURE_NONE},
81 {{"kabini"}, {"gfx703"}, GK_GFX703, FEATURE_NONE},
82 {{"mullins"}, {"gfx703"}, GK_GFX703, FEATURE_NONE},
83 {{"gfx704"}, {"gfx704"}, GK_GFX704, FEATURE_NONE},
84 {{"bonaire"}, {"gfx704"}, GK_GFX704, FEATURE_NONE},
85 {{"gfx705"}, {"gfx705"}, GK_GFX705, FEATURE_NONE},
88 {{"gfx802"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32},
89 {{"iceland"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32},
90 {{"tonga"}, {"gfx802"}, GK_GFX802, FEATURE_FAST_DENORMAL_F32},
91 {{"gfx803"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32},
92 {{"fiji"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32},
93 {{"polaris10"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32},
94 {{"polaris11"}, {"gfx803"}, GK_GFX803, FEATURE_FAST_DENORMAL_F32},
95 {{"gfx805"}, {"gfx805"}, GK_GFX805, FEATURE_FAST_DENORMAL_F32},
96 {{"tongapro"}, {"gfx805"}, GK_GFX805, FEATURE_FAST_DENORMAL_F32},
97 {{"gfx810"}, {"gfx810"}, GK_GFX810, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK},
98 {{"stoney"}, {"gfx810"}, GK_GFX810, FEATURE_FAST_DENORMAL_F32|FEATURE_XNACK},
132
139 // clang-format on
140};
141
142const GPUInfo *getArchEntry(AMDGPU::GPUKind AK, ArrayRef<GPUInfo> Table) {
143 GPUInfo Search = { {""}, {""}, AK, AMDGPU::FEATURE_NONE };
144
145 auto I =
146 llvm::lower_bound(Table, Search, [](const GPUInfo &A, const GPUInfo &B) {
147 return A.Kind < B.Kind;
148 });
149
150 if (I == Table.end() || I->Kind != Search.Kind)
151 return nullptr;
152 return I;
153}
154
155} // namespace
156
158 switch (AK) {
161 return "gfx9";
164 return "gfx10";
166 return "gfx11";
168 return "gfx12";
169 default: {
170 StringRef ArchName = getArchNameAMDGCN(AK);
171 return ArchName.empty() ? "" : ArchName.drop_back(2);
172 }
173 }
174}
175
177 if (const auto *Entry = getArchEntry(AK, AMDGCNGPUs))
178 return Entry->CanonicalName;
179 return "";
180}
181
183 if (const auto *Entry = getArchEntry(AK, R600GPUs))
184 return Entry->CanonicalName;
185 return "";
186}
187
189 for (const auto &C : AMDGCNGPUs) {
190 if (CPU == C.Name)
191 return C.Kind;
192 }
193
194 return AMDGPU::GPUKind::GK_NONE;
195}
196
198 for (const auto &C : R600GPUs) {
199 if (CPU == C.Name)
200 return C.Kind;
201 }
202
203 return AMDGPU::GPUKind::GK_NONE;
204}
205
207 if (const auto *Entry = getArchEntry(AK, AMDGCNGPUs))
208 return Entry->Features;
209 return FEATURE_NONE;
210}
211
213 if (const auto *Entry = getArchEntry(AK, R600GPUs))
214 return Entry->Features;
215 return FEATURE_NONE;
216}
217
219 // XXX: Should this only report unique canonical names?
220 for (const auto &C : AMDGCNGPUs)
221 Values.push_back(C.Name);
222}
223
225 for (const auto &C : R600GPUs)
226 Values.push_back(C.Name);
227}
228
231 if (AK == AMDGPU::GPUKind::GK_NONE) {
232 if (GPU == "generic-hsa")
233 return {7, 0, 0};
234 if (GPU == "generic")
235 return {6, 0, 0};
236 return {0, 0, 0};
237 }
238
239 // clang-format off
240 switch (AK) {
241 case GK_GFX600: return {6, 0, 0};
242 case GK_GFX601: return {6, 0, 1};
243 case GK_GFX602: return {6, 0, 2};
244 case GK_GFX700: return {7, 0, 0};
245 case GK_GFX701: return {7, 0, 1};
246 case GK_GFX702: return {7, 0, 2};
247 case GK_GFX703: return {7, 0, 3};
248 case GK_GFX704: return {7, 0, 4};
249 case GK_GFX705: return {7, 0, 5};
250 case GK_GFX801: return {8, 0, 1};
251 case GK_GFX802: return {8, 0, 2};
252 case GK_GFX803: return {8, 0, 3};
253 case GK_GFX805: return {8, 0, 5};
254 case GK_GFX810: return {8, 1, 0};
255 case GK_GFX900: return {9, 0, 0};
256 case GK_GFX902: return {9, 0, 2};
257 case GK_GFX904: return {9, 0, 4};
258 case GK_GFX906: return {9, 0, 6};
259 case GK_GFX908: return {9, 0, 8};
260 case GK_GFX909: return {9, 0, 9};
261 case GK_GFX90A: return {9, 0, 10};
262 case GK_GFX90C: return {9, 0, 12};
263 case GK_GFX940: return {9, 4, 0};
264 case GK_GFX941: return {9, 4, 1};
265 case GK_GFX942: return {9, 4, 2};
266 case GK_GFX950: return {9, 5, 0};
267 case GK_GFX1010: return {10, 1, 0};
268 case GK_GFX1011: return {10, 1, 1};
269 case GK_GFX1012: return {10, 1, 2};
270 case GK_GFX1013: return {10, 1, 3};
271 case GK_GFX1030: return {10, 3, 0};
272 case GK_GFX1031: return {10, 3, 1};
273 case GK_GFX1032: return {10, 3, 2};
274 case GK_GFX1033: return {10, 3, 3};
275 case GK_GFX1034: return {10, 3, 4};
276 case GK_GFX1035: return {10, 3, 5};
277 case GK_GFX1036: return {10, 3, 6};
278 case GK_GFX1100: return {11, 0, 0};
279 case GK_GFX1101: return {11, 0, 1};
280 case GK_GFX1102: return {11, 0, 2};
281 case GK_GFX1103: return {11, 0, 3};
282 case GK_GFX1150: return {11, 5, 0};
283 case GK_GFX1151: return {11, 5, 1};
284 case GK_GFX1152: return {11, 5, 2};
285 case GK_GFX1153: return {11, 5, 3};
286 case GK_GFX1200: return {12, 0, 0};
287 case GK_GFX1201: return {12, 0, 1};
288
289 // Generic targets return the lowest common denominator
290 // within their family. That is, the ISA that is the most
291 // restricted in terms of features.
292 //
293 // gfx9-generic is tricky because there is no lowest
294 // common denominator, so we return gfx900 which has mad-mix
295 // but this family doesn't have it.
296 //
297 // This API should never be used to check for a particular
298 // feature anyway.
299 //
300 // TODO: Split up this API depending on its caller so
301 // generic target handling is more obvious and less risky.
302 case GK_GFX9_GENERIC: return {9, 0, 0};
303 case GK_GFX9_4_GENERIC: return {9, 4, 0};
304 case GK_GFX10_1_GENERIC: return {10, 1, 0};
305 case GK_GFX10_3_GENERIC: return {10, 3, 0};
306 case GK_GFX11_GENERIC: return {11, 0, 3};
307 case GK_GFX12_GENERIC: return {12, 0, 0};
308 default: return {0, 0, 0};
309 }
310 // clang-format on
311}
312
314 assert(T.isAMDGPU());
315 auto ProcKind = T.isAMDGCN() ? parseArchAMDGCN(Arch) : parseArchR600(Arch);
316 if (ProcKind == GK_NONE)
317 return StringRef();
318
319 return T.isAMDGCN() ? getArchNameAMDGCN(ProcKind) : getArchNameR600(ProcKind);
320}
321
323 StringMap<bool> &Features) {
324 // XXX - What does the member GPU mean if device name string passed here?
325 if (T.isSPIRV() && T.getOS() == Triple::OSType::AMDHSA) {
326 // AMDGCN SPIRV must support the union of all AMDGCN features.
327 Features["atomic-ds-pk-add-16-insts"] = true;
328 Features["atomic-flat-pk-add-16-insts"] = true;
329 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
330 Features["atomic-global-pk-add-bf16-inst"] = true;
331 Features["atomic-fadd-rtn-insts"] = true;
332 Features["ci-insts"] = true;
333 Features["dot1-insts"] = true;
334 Features["dot2-insts"] = true;
335 Features["dot3-insts"] = true;
336 Features["dot4-insts"] = true;
337 Features["dot5-insts"] = true;
338 Features["dot7-insts"] = true;
339 Features["dot8-insts"] = true;
340 Features["dot9-insts"] = true;
341 Features["dot10-insts"] = true;
342 Features["dot11-insts"] = true;
343 Features["dl-insts"] = true;
344 Features["16-bit-insts"] = true;
345 Features["dpp"] = true;
346 Features["gfx8-insts"] = true;
347 Features["gfx9-insts"] = true;
348 Features["gfx90a-insts"] = true;
349 Features["gfx940-insts"] = true;
350 Features["gfx10-insts"] = true;
351 Features["gfx10-3-insts"] = true;
352 Features["gfx11-insts"] = true;
353 Features["gfx12-insts"] = true;
354 Features["image-insts"] = true;
355 Features["fp8-conversion-insts"] = true;
356 Features["s-memrealtime"] = true;
357 Features["s-memtime-inst"] = true;
358 Features["gws"] = true;
359 Features["fp8-insts"] = true;
360 Features["fp8-conversion-insts"] = true;
361 Features["atomic-ds-pk-add-16-insts"] = true;
362 Features["mai-insts"] = true;
363 Features["wavefrontsize32"] = true;
364 Features["wavefrontsize64"] = true;
365 } else if (T.isAMDGCN()) {
367 switch (Kind) {
368 case GK_GFX1201:
369 case GK_GFX1200:
370 case GK_GFX12_GENERIC:
371 Features["ci-insts"] = true;
372 Features["dot7-insts"] = true;
373 Features["dot8-insts"] = true;
374 Features["dot9-insts"] = true;
375 Features["dot10-insts"] = true;
376 Features["dot11-insts"] = true;
377 Features["dot12-insts"] = true;
378 Features["dl-insts"] = true;
379 Features["atomic-ds-pk-add-16-insts"] = true;
380 Features["atomic-flat-pk-add-16-insts"] = true;
381 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
382 Features["atomic-buffer-pk-add-bf16-inst"] = true;
383 Features["atomic-global-pk-add-bf16-inst"] = true;
384 Features["16-bit-insts"] = true;
385 Features["dpp"] = true;
386 Features["gfx8-insts"] = true;
387 Features["gfx9-insts"] = true;
388 Features["gfx10-insts"] = true;
389 Features["gfx10-3-insts"] = true;
390 Features["gfx11-insts"] = true;
391 Features["gfx12-insts"] = true;
392 Features["atomic-fadd-rtn-insts"] = true;
393 Features["image-insts"] = true;
394 Features["fp8-conversion-insts"] = true;
395 break;
396 case GK_GFX1153:
397 case GK_GFX1152:
398 case GK_GFX1151:
399 case GK_GFX1150:
400 case GK_GFX1103:
401 case GK_GFX1102:
402 case GK_GFX1101:
403 case GK_GFX1100:
404 case GK_GFX11_GENERIC:
405 Features["ci-insts"] = true;
406 Features["dot5-insts"] = true;
407 Features["dot7-insts"] = true;
408 Features["dot8-insts"] = true;
409 Features["dot9-insts"] = true;
410 Features["dot10-insts"] = true;
411 Features["dot12-insts"] = true;
412 Features["dl-insts"] = true;
413 Features["16-bit-insts"] = true;
414 Features["dpp"] = true;
415 Features["gfx8-insts"] = true;
416 Features["gfx9-insts"] = true;
417 Features["gfx10-insts"] = true;
418 Features["gfx10-3-insts"] = true;
419 Features["gfx11-insts"] = true;
420 Features["atomic-fadd-rtn-insts"] = true;
421 Features["image-insts"] = true;
422 Features["gws"] = true;
423 break;
424 case GK_GFX1036:
425 case GK_GFX1035:
426 case GK_GFX1034:
427 case GK_GFX1033:
428 case GK_GFX1032:
429 case GK_GFX1031:
430 case GK_GFX1030:
432 Features["ci-insts"] = true;
433 Features["dot1-insts"] = true;
434 Features["dot2-insts"] = true;
435 Features["dot5-insts"] = true;
436 Features["dot6-insts"] = true;
437 Features["dot7-insts"] = true;
438 Features["dot10-insts"] = true;
439 Features["dl-insts"] = true;
440 Features["16-bit-insts"] = true;
441 Features["dpp"] = true;
442 Features["gfx8-insts"] = true;
443 Features["gfx9-insts"] = true;
444 Features["gfx10-insts"] = true;
445 Features["gfx10-3-insts"] = true;
446 Features["image-insts"] = true;
447 Features["s-memrealtime"] = true;
448 Features["s-memtime-inst"] = true;
449 Features["gws"] = true;
450 break;
451 case GK_GFX1012:
452 case GK_GFX1011:
453 Features["dot1-insts"] = true;
454 Features["dot2-insts"] = true;
455 Features["dot5-insts"] = true;
456 Features["dot6-insts"] = true;
457 Features["dot7-insts"] = true;
458 Features["dot10-insts"] = true;
459 [[fallthrough]];
460 case GK_GFX1013:
461 case GK_GFX1010:
463 Features["dl-insts"] = true;
464 Features["ci-insts"] = true;
465 Features["16-bit-insts"] = true;
466 Features["dpp"] = true;
467 Features["gfx8-insts"] = true;
468 Features["gfx9-insts"] = true;
469 Features["gfx10-insts"] = true;
470 Features["image-insts"] = true;
471 Features["s-memrealtime"] = true;
472 Features["s-memtime-inst"] = true;
473 Features["gws"] = true;
474 break;
475 case GK_GFX950:
476 Features["bitop3-insts"] = true;
477 Features["fp6bf6-cvt-scale-insts"] = true;
478 Features["fp4-cvt-scale-insts"] = true;
479 Features["bf8-cvt-scale-insts"] = true;
480 Features["fp8-cvt-scale-insts"] = true;
481 Features["f16bf16-to-fp6bf6-cvt-scale-insts"] = true;
482 Features["f32-to-f16bf16-cvt-sr-insts"] = true;
483 Features["prng-inst"] = true;
484 Features["permlane16-swap"] = true;
485 Features["permlane32-swap"] = true;
486 Features["ashr-pk-insts"] = true;
487 Features["dot12-insts"] = true;
488 Features["dot13-insts"] = true;
489 Features["atomic-buffer-pk-add-bf16-inst"] = true;
490 Features["gfx950-insts"] = true;
491 [[fallthrough]];
492 case GK_GFX942:
493 case GK_GFX941:
494 case GK_GFX940:
495 Features["fp8-insts"] = true;
496 Features["fp8-conversion-insts"] = true;
497 if (Kind != GK_GFX950)
498 Features["xf32-insts"] = true;
499 [[fallthrough]];
501 Features["gfx940-insts"] = true;
502 Features["atomic-ds-pk-add-16-insts"] = true;
503 Features["atomic-flat-pk-add-16-insts"] = true;
504 Features["atomic-global-pk-add-bf16-inst"] = true;
505 Features["gfx90a-insts"] = true;
506 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
507 Features["atomic-fadd-rtn-insts"] = true;
508 Features["dot3-insts"] = true;
509 Features["dot4-insts"] = true;
510 Features["dot5-insts"] = true;
511 Features["dot6-insts"] = true;
512 Features["mai-insts"] = true;
513 Features["dl-insts"] = true;
514 Features["dot1-insts"] = true;
515 Features["dot2-insts"] = true;
516 Features["dot7-insts"] = true;
517 Features["dot10-insts"] = true;
518 Features["gfx9-insts"] = true;
519 Features["gfx8-insts"] = true;
520 Features["16-bit-insts"] = true;
521 Features["dpp"] = true;
522 Features["s-memrealtime"] = true;
523 Features["ci-insts"] = true;
524 Features["s-memtime-inst"] = true;
525 Features["gws"] = true;
526 break;
527 case GK_GFX90A:
528 Features["gfx90a-insts"] = true;
529 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
530 Features["atomic-fadd-rtn-insts"] = true;
531 [[fallthrough]];
532 case GK_GFX908:
533 Features["dot3-insts"] = true;
534 Features["dot4-insts"] = true;
535 Features["dot5-insts"] = true;
536 Features["dot6-insts"] = true;
537 Features["mai-insts"] = true;
538 [[fallthrough]];
539 case GK_GFX906:
540 Features["dl-insts"] = true;
541 Features["dot1-insts"] = true;
542 Features["dot2-insts"] = true;
543 Features["dot7-insts"] = true;
544 Features["dot10-insts"] = true;
545 [[fallthrough]];
546 case GK_GFX90C:
547 case GK_GFX909:
548 case GK_GFX904:
549 case GK_GFX902:
550 case GK_GFX900:
551 case GK_GFX9_GENERIC:
552 Features["gfx9-insts"] = true;
553 [[fallthrough]];
554 case GK_GFX810:
555 case GK_GFX805:
556 case GK_GFX803:
557 case GK_GFX802:
558 case GK_GFX801:
559 Features["gfx8-insts"] = true;
560 Features["16-bit-insts"] = true;
561 Features["dpp"] = true;
562 Features["s-memrealtime"] = true;
563 [[fallthrough]];
564 case GK_GFX705:
565 case GK_GFX704:
566 case GK_GFX703:
567 case GK_GFX702:
568 case GK_GFX701:
569 case GK_GFX700:
570 Features["ci-insts"] = true;
571 [[fallthrough]];
572 case GK_GFX602:
573 case GK_GFX601:
574 case GK_GFX600:
575 Features["image-insts"] = true;
576 Features["s-memtime-inst"] = true;
577 Features["gws"] = true;
578 break;
579 case GK_NONE:
580 break;
581 default:
582 llvm_unreachable("Unhandled GPU!");
583 }
584 } else {
585 if (GPU.empty())
586 GPU = "r600";
587
588 switch (llvm::AMDGPU::parseArchR600(GPU)) {
589 case GK_CAYMAN:
590 case GK_CYPRESS:
591 case GK_RV770:
592 case GK_RV670:
593 // TODO: Add fp64 when implemented.
594 break;
595 case GK_TURKS:
596 case GK_CAICOS:
597 case GK_BARTS:
598 case GK_SUMO:
599 case GK_REDWOOD:
600 case GK_JUNIPER:
601 case GK_CEDAR:
602 case GK_RV730:
603 case GK_RV710:
604 case GK_RS880:
605 case GK_R630:
606 case GK_R600:
607 break;
608 default:
609 llvm_unreachable("Unhandled GPU!");
610 }
611 }
612}
613
614static bool isWave32Capable(StringRef GPU, const Triple &T) {
615 bool IsWave32Capable = false;
616 // XXX - What does the member GPU mean if device name string passed here?
617 if (T.isAMDGCN()) {
618 switch (parseArchAMDGCN(GPU)) {
619 case GK_GFX1201:
620 case GK_GFX1200:
621 case GK_GFX1153:
622 case GK_GFX1152:
623 case GK_GFX1151:
624 case GK_GFX1150:
625 case GK_GFX1103:
626 case GK_GFX1102:
627 case GK_GFX1101:
628 case GK_GFX1100:
629 case GK_GFX1036:
630 case GK_GFX1035:
631 case GK_GFX1034:
632 case GK_GFX1033:
633 case GK_GFX1032:
634 case GK_GFX1031:
635 case GK_GFX1030:
636 case GK_GFX1012:
637 case GK_GFX1011:
638 case GK_GFX1013:
639 case GK_GFX1010:
640 case GK_GFX12_GENERIC:
641 case GK_GFX11_GENERIC:
644 IsWave32Capable = true;
645 break;
646 default:
647 break;
648 }
649 }
650 return IsWave32Capable;
651}
652
653std::pair<FeatureError, StringRef>
655 StringMap<bool> &Features) {
656 bool IsWave32Capable = isWave32Capable(GPU, T);
657 const bool IsNullGPU = GPU.empty();
658 const bool HaveWave32 = Features.count("wavefrontsize32");
659 const bool HaveWave64 = Features.count("wavefrontsize64");
660 if (HaveWave32 && HaveWave64) {
662 "'wavefrontsize32' and 'wavefrontsize64' are mutually exclusive"};
663 }
664 if (HaveWave32 && !IsNullGPU && !IsWave32Capable) {
665 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "wavefrontsize32"};
666 }
667 // Don't assume any wavesize with an unknown subtarget.
668 if (!IsNullGPU) {
669 // Default to wave32 if available, or wave64 if not
670 if (!HaveWave32 && !HaveWave64) {
671 StringRef DefaultWaveSizeFeature =
672 IsWave32Capable ? "wavefrontsize32" : "wavefrontsize64";
673 Features.insert(std::make_pair(DefaultWaveSizeFeature, true));
674 }
675 }
676 return {NO_ERROR, StringRef()};
677}
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define I(x, y, z)
Definition: MD5.cpp:58
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isWave32Capable(StringRef GPU, const Triple &T)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
iterator end() const
Definition: ArrayRef.h:157
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
void push_back(const T &Elt)
Definition: SmallVector.h:413
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition: StringRef.h:853
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition: StringMap.h:276
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:308
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:147
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Definition: StringRef.h:616
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
Definition: TargetParser.h:35
StringRef getCanonicalArchName(const Triple &T, StringRef Arch)
void fillValidArchListR600(SmallVectorImpl< StringRef > &Values)
StringRef getArchFamilyNameAMDGCN(GPUKind AK)
IsaVersion getIsaVersion(StringRef GPU)
void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
std::pair< FeatureError, StringRef > insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Inserts wave size feature for given GPU into features map.
void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
GPUKind parseArchAMDGCN(StringRef CPU)
@ UNSUPPORTED_TARGET_FEATURE
Definition: TargetParser.h:166
@ INVALID_FEATURE_COMBINATION
Definition: TargetParser.h:165
@ FEATURE_FAST_DENORMAL_F32
Definition: TargetParser.h:148
StringRef getArchNameAMDGCN(GPUKind AK)
unsigned getArchAttrAMDGCN(GPUKind AK)
unsigned getArchAttrR600(GPUKind AK)
GPUKind parseArchR600(StringRef CPU)
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1978
Instruction set architecture version.
Definition: TargetParser.h:130