LLVM 22.0.0git
AMDGPUTargetStreamer.cpp
Go to the documentation of this file.
1//===-- AMDGPUTargetStreamer.cpp - Mips Target Streamer Methods -----------===//
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 provides AMDGPU specific target streamer methods.
10//
11//===----------------------------------------------------------------------===//
12
14#include "AMDGPUMCExpr.h"
16#include "AMDGPUPTNote.h"
21#include "llvm/MC/MCAsmInfo.h"
22#include "llvm/MC/MCAssembler.h"
23#include "llvm/MC/MCContext.h"
32
33using namespace llvm;
34using namespace llvm::AMDGPU;
35
36//===----------------------------------------------------------------------===//
37// AMDGPUTargetStreamer
38//===----------------------------------------------------------------------===//
39
41 ForceGenericVersion("amdgpu-force-generic-version",
42 cl::desc("Force a specific generic_v<N> flag to be "
43 "added. For testing purposes only."),
45
47 msgpack::Document HSAMetadataDoc;
48 if (!HSAMetadataDoc.fromYAML(HSAMetadataString))
49 return false;
50 return EmitHSAMetadata(HSAMetadataDoc, false);
51}
52
55
56 // clang-format off
57 switch (ElfMach) {
58 case ELF::EF_AMDGPU_MACH_R600_R600: AK = GK_R600; break;
59 case ELF::EF_AMDGPU_MACH_R600_R630: AK = GK_R630; break;
69 case ELF::EF_AMDGPU_MACH_R600_SUMO: AK = GK_SUMO; break;
126 case ELF::EF_AMDGPU_MACH_NONE: AK = GK_NONE; break;
127 default: AK = GK_NONE; break;
128 }
129 // clang-format on
130
131 StringRef GPUName = getArchNameAMDGCN(AK);
132 if (GPUName != "")
133 return GPUName;
134 return getArchNameR600(AK);
135}
136
139 if (AK == AMDGPU::GPUKind::GK_NONE)
140 AK = parseArchR600(GPU);
141
142 // clang-format off
143 switch (AK) {
213 }
214 // clang-format on
215
216 llvm_unreachable("unknown GPU");
217}
218
219//===----------------------------------------------------------------------===//
220// AMDGPUTargetAsmStreamer
221//===----------------------------------------------------------------------===//
222
225 : AMDGPUTargetStreamer(S), OS(OS) { }
226
227// A hook for emitting stuff at the end.
228// We use it for emitting the accumulated PAL metadata as directives.
229// The PAL metadata is reset after it is emitted.
231 std::string S;
233 OS << S;
234
235 // Reset the pal metadata so its data will not affect a compilation that
236 // reuses this object.
238}
239
241 OS << "\t.amdgcn_target \"" << getTargetID()->toString() << "\"\n";
242}
243
245 unsigned COV) {
247 OS << "\t.amdhsa_code_object_version " << COV << '\n';
248}
249
251 auto FoldAndPrint = [&](const MCExpr *Expr, raw_ostream &OS,
252 const MCAsmInfo *MAI) {
254 };
255
256 OS << "\t.amd_kernel_code_t\n";
257 Header.EmitKernelCodeT(OS, getContext(), FoldAndPrint);
258 OS << "\t.end_amd_kernel_code_t\n";
259}
260
262 unsigned Type) {
263 switch (Type) {
264 default: llvm_unreachable("Invalid AMDGPU symbol type");
266 OS << "\t.amdgpu_hsa_kernel " << SymbolName << '\n' ;
267 break;
268 }
269}
270
272 Align Alignment) {
273 OS << "\t.amdgpu_lds " << Symbol->getName() << ", " << Size << ", "
274 << Alignment.value() << '\n';
275}
276
278 const MCSymbol *NumVGPR, const MCSymbol *NumAGPR,
279 const MCSymbol *NumExplicitSGPR, const MCSymbol *NumNamedBarrier,
280 const MCSymbol *PrivateSegmentSize, const MCSymbol *UsesVCC,
281 const MCSymbol *UsesFlatScratch, const MCSymbol *HasDynamicallySizedStack,
282 const MCSymbol *HasRecursion, const MCSymbol *HasIndirectCall) {
283#define PRINT_RES_INFO(ARG) \
284 OS << "\t.set "; \
285 ARG->print(OS, getContext().getAsmInfo()); \
286 OS << ", "; \
287 getContext().getAsmInfo()->printExpr(OS, *ARG->getVariableValue()); \
288 Streamer.addBlankLine();
289
290 PRINT_RES_INFO(NumVGPR);
291 PRINT_RES_INFO(NumAGPR);
292 PRINT_RES_INFO(NumExplicitSGPR);
293 PRINT_RES_INFO(NumNamedBarrier);
294 PRINT_RES_INFO(PrivateSegmentSize);
295 PRINT_RES_INFO(UsesVCC);
296 PRINT_RES_INFO(UsesFlatScratch);
297 PRINT_RES_INFO(HasDynamicallySizedStack);
298 PRINT_RES_INFO(HasRecursion);
299 PRINT_RES_INFO(HasIndirectCall);
300#undef PRINT_RES_INFO
301}
302
304 const MCSymbol *MaxAGPR,
305 const MCSymbol *MaxSGPR) {
306#define PRINT_RES_INFO(ARG) \
307 OS << "\t.set "; \
308 ARG->print(OS, getContext().getAsmInfo()); \
309 OS << ", "; \
310 getContext().getAsmInfo()->printExpr(OS, *ARG->getVariableValue()); \
311 Streamer.addBlankLine();
312
313 PRINT_RES_INFO(MaxVGPR);
314 PRINT_RES_INFO(MaxAGPR);
315 PRINT_RES_INFO(MaxSGPR);
316#undef PRINT_RES_INFO
317}
318
320 OS << "\t.amd_amdgpu_isa \"" << getTargetID()->toString() << "\"\n";
321 return true;
322}
323
325 msgpack::Document &HSAMetadataDoc, bool Strict) {
327 if (!Verifier.verify(HSAMetadataDoc.getRoot()))
328 return false;
329
330 std::string HSAMetadataString;
331 raw_string_ostream StrOS(HSAMetadataString);
332 HSAMetadataDoc.toYAML(StrOS);
333
334 OS << '\t' << HSAMD::V3::AssemblerDirectiveBegin << '\n';
335 OS << StrOS.str() << '\n';
336 OS << '\t' << HSAMD::V3::AssemblerDirectiveEnd << '\n';
337 return true;
338}
339
341 const uint32_t Encoded_s_code_end = 0xbf9f0000;
342 const uint32_t Encoded_s_nop = 0xbf800000;
343 uint32_t Encoded_pad = Encoded_s_code_end;
344
345 // Instruction cache line size in bytes.
346 const unsigned Log2CacheLineSize = AMDGPU::isGFX11Plus(STI) ? 7 : 6;
347 const unsigned CacheLineSize = 1u << Log2CacheLineSize;
348
349 // Extra padding amount in bytes to support prefetch mode 3.
350 unsigned FillSize = 3 * CacheLineSize;
351
352 if (AMDGPU::isGFX90A(STI)) {
353 Encoded_pad = Encoded_s_nop;
354 FillSize = 16 * CacheLineSize;
355 }
356
357 OS << "\t.p2alignl " << Log2CacheLineSize << ", " << Encoded_pad << '\n';
358 OS << "\t.fill " << (FillSize / 4) << ", 4, " << Encoded_pad << '\n';
359 return true;
360}
361
363 const MCSubtargetInfo &STI, StringRef KernelName,
364 const MCKernelDescriptor &KD, const MCExpr *NextVGPR,
365 const MCExpr *NextSGPR, const MCExpr *ReserveVCC,
366 const MCExpr *ReserveFlatScr) {
367 IsaVersion IVersion = getIsaVersion(STI.getCPU());
368 const MCAsmInfo *MAI = getContext().getAsmInfo();
369
370 OS << "\t.amdhsa_kernel " << KernelName << '\n';
371
372 auto PrintField = [&](const MCExpr *Expr, uint32_t Shift, uint32_t Mask,
374 OS << "\t\t" << Directive << ' ';
375 const MCExpr *ShiftedAndMaskedExpr =
376 MCKernelDescriptor::bits_get(Expr, Shift, Mask, getContext());
377 const MCExpr *New = foldAMDGPUMCExpr(ShiftedAndMaskedExpr, getContext());
378 printAMDGPUMCExpr(New, OS, MAI);
379 OS << '\n';
380 };
381
382 auto EmitMCExpr = [&](const MCExpr *Value) {
384 printAMDGPUMCExpr(NewExpr, OS, MAI);
385 };
386
387 OS << "\t\t.amdhsa_group_segment_fixed_size ";
388 EmitMCExpr(KD.group_segment_fixed_size);
389 OS << '\n';
390
391 OS << "\t\t.amdhsa_private_segment_fixed_size ";
392 EmitMCExpr(KD.private_segment_fixed_size);
393 OS << '\n';
394
395 OS << "\t\t.amdhsa_kernarg_size ";
396 EmitMCExpr(KD.kernarg_size);
397 OS << '\n';
398
399 if (isGFX1250(STI)) {
401 amdhsa::COMPUTE_PGM_RSRC2_GFX125_USER_SGPR_COUNT_SHIFT,
402 amdhsa::COMPUTE_PGM_RSRC2_GFX125_USER_SGPR_COUNT,
403 ".amdhsa_user_sgpr_count");
404 } else {
406 amdhsa::COMPUTE_PGM_RSRC2_GFX6_GFX120_USER_SGPR_COUNT_SHIFT,
407 amdhsa::COMPUTE_PGM_RSRC2_GFX6_GFX120_USER_SGPR_COUNT,
408 ".amdhsa_user_sgpr_count");
409 }
410
414 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER_SHIFT,
415 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER,
416 ".amdhsa_user_sgpr_private_segment_buffer");
418 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_PTR_SHIFT,
419 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_PTR,
420 ".amdhsa_user_sgpr_dispatch_ptr");
422 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_QUEUE_PTR_SHIFT,
423 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_QUEUE_PTR,
424 ".amdhsa_user_sgpr_queue_ptr");
426 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_KERNARG_SEGMENT_PTR_SHIFT,
427 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_KERNARG_SEGMENT_PTR,
428 ".amdhsa_user_sgpr_kernarg_segment_ptr");
430 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_ID_SHIFT,
431 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_DISPATCH_ID,
432 ".amdhsa_user_sgpr_dispatch_id");
435 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_FLAT_SCRATCH_INIT_SHIFT,
436 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_FLAT_SCRATCH_INIT,
437 ".amdhsa_user_sgpr_flat_scratch_init");
438 if (hasKernargPreload(STI)) {
439 PrintField(KD.kernarg_preload, amdhsa::KERNARG_PRELOAD_SPEC_LENGTH_SHIFT,
440 amdhsa::KERNARG_PRELOAD_SPEC_LENGTH,
441 ".amdhsa_user_sgpr_kernarg_preload_length");
442 PrintField(KD.kernarg_preload, amdhsa::KERNARG_PRELOAD_SPEC_OFFSET_SHIFT,
443 amdhsa::KERNARG_PRELOAD_SPEC_OFFSET,
444 ".amdhsa_user_sgpr_kernarg_preload_offset");
445 }
448 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_SIZE_SHIFT,
449 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_SGPR_PRIVATE_SEGMENT_SIZE,
450 ".amdhsa_user_sgpr_private_segment_size");
451 if (isGFX1250(STI))
453 amdhsa::KERNEL_CODE_PROPERTY_USES_CU_STORES_SHIFT,
454 amdhsa::KERNEL_CODE_PROPERTY_USES_CU_STORES,
455 ".amdhsa_uses_cu_stores");
456 if (IVersion.Major >= 10)
458 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32_SHIFT,
459 amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32,
460 ".amdhsa_wavefront_size32");
463 amdhsa::KERNEL_CODE_PROPERTY_USES_DYNAMIC_STACK_SHIFT,
464 amdhsa::KERNEL_CODE_PROPERTY_USES_DYNAMIC_STACK,
465 ".amdhsa_uses_dynamic_stack");
467 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_PRIVATE_SEGMENT_SHIFT,
468 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_PRIVATE_SEGMENT,
470 ? ".amdhsa_enable_private_segment"
471 : ".amdhsa_system_sgpr_private_segment_wavefront_offset"));
473 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_X_SHIFT,
474 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_X,
475 ".amdhsa_system_sgpr_workgroup_id_x");
477 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Y_SHIFT,
478 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Y,
479 ".amdhsa_system_sgpr_workgroup_id_y");
481 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Z_SHIFT,
482 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_ID_Z,
483 ".amdhsa_system_sgpr_workgroup_id_z");
485 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_INFO_SHIFT,
486 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_SGPR_WORKGROUP_INFO,
487 ".amdhsa_system_sgpr_workgroup_info");
489 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_VGPR_WORKITEM_ID_SHIFT,
490 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_VGPR_WORKITEM_ID,
491 ".amdhsa_system_vgpr_workitem_id");
492
493 // These directives are required.
494 OS << "\t\t.amdhsa_next_free_vgpr ";
495 EmitMCExpr(NextVGPR);
496 OS << '\n';
497
498 OS << "\t\t.amdhsa_next_free_sgpr ";
499 EmitMCExpr(NextSGPR);
500 OS << '\n';
501
502 if (AMDGPU::isGFX90A(STI)) {
503 // MCExpr equivalent of taking the (accum_offset + 1) * 4.
504 const MCExpr *accum_bits = MCKernelDescriptor::bits_get(
506 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_ACCUM_OFFSET_SHIFT,
507 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_ACCUM_OFFSET, getContext());
508 accum_bits = MCBinaryExpr::createAdd(
509 accum_bits, MCConstantExpr::create(1, getContext()), getContext());
510 accum_bits = MCBinaryExpr::createMul(
511 accum_bits, MCConstantExpr::create(4, getContext()), getContext());
512 OS << "\t\t.amdhsa_accum_offset ";
513 const MCExpr *New = foldAMDGPUMCExpr(accum_bits, getContext());
514 printAMDGPUMCExpr(New, OS, MAI);
515 OS << '\n';
516 }
517
518 if (AMDGPU::isGFX1250(STI))
520 amdhsa::COMPUTE_PGM_RSRC3_GFX125_NAMED_BAR_CNT_SHIFT,
521 amdhsa::COMPUTE_PGM_RSRC3_GFX125_NAMED_BAR_CNT,
522 ".amdhsa_named_barrier_count");
523
524 OS << "\t\t.amdhsa_reserve_vcc ";
525 EmitMCExpr(ReserveVCC);
526 OS << '\n';
527
528 if (IVersion.Major >= 7 && !hasArchitectedFlatScratch(STI)) {
529 OS << "\t\t.amdhsa_reserve_flat_scratch ";
530 EmitMCExpr(ReserveFlatScr);
531 OS << '\n';
532 }
533
534 switch (CodeObjectVersion) {
535 default:
536 break;
539 if (getTargetID()->isXnackSupported())
540 OS << "\t\t.amdhsa_reserve_xnack_mask " << getTargetID()->isXnackOnOrAny() << '\n';
541 break;
542 }
543
545 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_32_SHIFT,
546 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_32,
547 ".amdhsa_float_round_mode_32");
549 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_16_64_SHIFT,
550 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_ROUND_MODE_16_64,
551 ".amdhsa_float_round_mode_16_64");
553 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_32_SHIFT,
554 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_32,
555 ".amdhsa_float_denorm_mode_32");
557 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_16_64_SHIFT,
558 amdhsa::COMPUTE_PGM_RSRC1_FLOAT_DENORM_MODE_16_64,
559 ".amdhsa_float_denorm_mode_16_64");
560 if (IVersion.Major < 12) {
562 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_DX10_CLAMP_SHIFT,
563 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_DX10_CLAMP,
564 ".amdhsa_dx10_clamp");
566 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_IEEE_MODE_SHIFT,
567 amdhsa::COMPUTE_PGM_RSRC1_GFX6_GFX11_ENABLE_IEEE_MODE,
568 ".amdhsa_ieee_mode");
569 }
570 if (IVersion.Major >= 9) {
572 amdhsa::COMPUTE_PGM_RSRC1_GFX9_PLUS_FP16_OVFL_SHIFT,
573 amdhsa::COMPUTE_PGM_RSRC1_GFX9_PLUS_FP16_OVFL,
574 ".amdhsa_fp16_overflow");
575 }
576 if (AMDGPU::isGFX90A(STI))
578 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_TG_SPLIT_SHIFT,
579 amdhsa::COMPUTE_PGM_RSRC3_GFX90A_TG_SPLIT, ".amdhsa_tg_split");
580 if (AMDGPU::supportsWGP(STI))
582 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_WGP_MODE_SHIFT,
583 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_WGP_MODE,
584 ".amdhsa_workgroup_processor_mode");
585 if (IVersion.Major >= 10) {
587 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_MEM_ORDERED_SHIFT,
588 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_MEM_ORDERED,
589 ".amdhsa_memory_ordered");
591 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_FWD_PROGRESS_SHIFT,
592 amdhsa::COMPUTE_PGM_RSRC1_GFX10_PLUS_FWD_PROGRESS,
593 ".amdhsa_forward_progress");
594 }
595 if (IVersion.Major >= 10 && IVersion.Major < 12) {
597 amdhsa::COMPUTE_PGM_RSRC3_GFX10_GFX11_SHARED_VGPR_COUNT_SHIFT,
598 amdhsa::COMPUTE_PGM_RSRC3_GFX10_GFX11_SHARED_VGPR_COUNT,
599 ".amdhsa_shared_vgpr_count");
600 }
601 if (IVersion.Major == 11) {
603 amdhsa::COMPUTE_PGM_RSRC3_GFX11_INST_PREF_SIZE_SHIFT,
604 amdhsa::COMPUTE_PGM_RSRC3_GFX11_INST_PREF_SIZE,
605 ".amdhsa_inst_pref_size");
606 }
607 if (IVersion.Major >= 12) {
609 amdhsa::COMPUTE_PGM_RSRC3_GFX12_PLUS_INST_PREF_SIZE_SHIFT,
610 amdhsa::COMPUTE_PGM_RSRC3_GFX12_PLUS_INST_PREF_SIZE,
611 ".amdhsa_inst_pref_size");
613 amdhsa::COMPUTE_PGM_RSRC1_GFX12_PLUS_ENABLE_WG_RR_EN_SHIFT,
614 amdhsa::COMPUTE_PGM_RSRC1_GFX12_PLUS_ENABLE_WG_RR_EN,
615 ".amdhsa_round_robin_scheduling");
616 }
619 amdhsa::
620 COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INVALID_OPERATION_SHIFT,
621 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INVALID_OPERATION,
622 ".amdhsa_exception_fp_ieee_invalid_op");
625 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_FP_DENORMAL_SOURCE_SHIFT,
626 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_FP_DENORMAL_SOURCE,
627 ".amdhsa_exception_fp_denorm_src");
630 amdhsa::
631 COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_DIVISION_BY_ZERO_SHIFT,
632 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_DIVISION_BY_ZERO,
633 ".amdhsa_exception_fp_ieee_div_zero");
636 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_OVERFLOW_SHIFT,
637 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_OVERFLOW,
638 ".amdhsa_exception_fp_ieee_overflow");
641 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_UNDERFLOW_SHIFT,
642 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_UNDERFLOW,
643 ".amdhsa_exception_fp_ieee_underflow");
646 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INEXACT_SHIFT,
647 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_IEEE_754_FP_INEXACT,
648 ".amdhsa_exception_fp_ieee_inexact");
651 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_INT_DIVIDE_BY_ZERO_SHIFT,
652 amdhsa::COMPUTE_PGM_RSRC2_ENABLE_EXCEPTION_INT_DIVIDE_BY_ZERO,
653 ".amdhsa_exception_int_div_zero");
654
655 OS << "\t.end_amdhsa_kernel\n";
656}
657
658//===----------------------------------------------------------------------===//
659// AMDGPUTargetELFStreamer
660//===----------------------------------------------------------------------===//
661
663 const MCSubtargetInfo &STI)
664 : AMDGPUTargetStreamer(S), STI(STI), Streamer(S) {}
665
667 return static_cast<MCELFStreamer &>(Streamer);
668}
669
670// A hook for emitting stuff at the end.
671// We use it for emitting the accumulated PAL metadata as a .note record.
672// The PAL metadata is reset after it is emitted.
675 W.setELFHeaderEFlags(getEFlags());
676 W.setOverrideABIVersion(
678
679 std::string Blob;
680 const char *Vendor = getPALMetadata()->getVendor();
681 unsigned Type = getPALMetadata()->getType();
682 getPALMetadata()->toBlob(Type, Blob);
683 if (Blob.empty())
684 return;
685 EmitNote(Vendor, MCConstantExpr::create(Blob.size(), getContext()), Type,
686 [&](MCELFStreamer &OS) { OS.emitBytes(Blob); });
687
688 // Reset the pal metadata so its data will not affect a compilation that
689 // reuses this object.
691}
692
693void AMDGPUTargetELFStreamer::EmitNote(
694 StringRef Name, const MCExpr *DescSZ, unsigned NoteType,
695 function_ref<void(MCELFStreamer &)> EmitDesc) {
696 auto &S = getStreamer();
697 auto &Context = S.getContext();
698
699 auto NameSZ = Name.size() + 1;
700
701 unsigned NoteFlags = 0;
702 // TODO Apparently, this is currently needed for OpenCL as mentioned in
703 // https://reviews.llvm.org/D74995
704 if (isHsaAbi(STI))
705 NoteFlags = ELF::SHF_ALLOC;
706
707 S.pushSection();
708 S.switchSection(
709 Context.getELFSection(ElfNote::SectionName, ELF::SHT_NOTE, NoteFlags));
710 S.emitInt32(NameSZ); // namesz
711 S.emitValue(DescSZ, 4); // descz
712 S.emitInt32(NoteType); // type
713 S.emitBytes(Name); // name
714 S.emitValueToAlignment(Align(4), 0, 1, 0); // padding 0
715 EmitDesc(S); // desc
716 S.emitValueToAlignment(Align(4), 0, 1, 0); // padding 0
717 S.popSection();
718}
719
720unsigned AMDGPUTargetELFStreamer::getEFlags() {
721 switch (STI.getTargetTriple().getArch()) {
722 default:
723 llvm_unreachable("Unsupported Arch");
724 case Triple::r600:
725 return getEFlagsR600();
726 case Triple::amdgcn:
727 return getEFlagsAMDGCN();
728 }
729}
730
731unsigned AMDGPUTargetELFStreamer::getEFlagsR600() {
733
734 return getElfMach(STI.getCPU());
735}
736
737unsigned AMDGPUTargetELFStreamer::getEFlagsAMDGCN() {
739
740 switch (STI.getTargetTriple().getOS()) {
741 default:
742 // TODO: Why are some tests have "mingw" listed as OS?
743 // llvm_unreachable("Unsupported OS");
745 return getEFlagsUnknownOS();
746 case Triple::AMDHSA:
747 return getEFlagsAMDHSA();
748 case Triple::AMDPAL:
749 return getEFlagsAMDPAL();
750 case Triple::Mesa3D:
751 return getEFlagsMesa3D();
752 }
753}
754
755unsigned AMDGPUTargetELFStreamer::getEFlagsUnknownOS() {
756 // TODO: Why are some tests have "mingw" listed as OS?
757 // assert(STI.getTargetTriple().getOS() == Triple::UnknownOS);
758
759 return getEFlagsV3();
760}
761
762unsigned AMDGPUTargetELFStreamer::getEFlagsAMDHSA() {
763 assert(isHsaAbi(STI));
764
765 if (CodeObjectVersion >= 6)
766 return getEFlagsV6();
767 return getEFlagsV4();
768}
769
770unsigned AMDGPUTargetELFStreamer::getEFlagsAMDPAL() {
772
773 return getEFlagsV3();
774}
775
776unsigned AMDGPUTargetELFStreamer::getEFlagsMesa3D() {
778
779 return getEFlagsV3();
780}
781
782unsigned AMDGPUTargetELFStreamer::getEFlagsV3() {
783 unsigned EFlagsV3 = 0;
784
785 // mach.
786 EFlagsV3 |= getElfMach(STI.getCPU());
787
788 // xnack.
789 if (getTargetID()->isXnackOnOrAny())
791 // sramecc.
792 if (getTargetID()->isSramEccOnOrAny())
794
795 return EFlagsV3;
796}
797
798unsigned AMDGPUTargetELFStreamer::getEFlagsV4() {
799 unsigned EFlagsV4 = 0;
800
801 // mach.
802 EFlagsV4 |= getElfMach(STI.getCPU());
803
804 // xnack.
805 switch (getTargetID()->getXnackSetting()) {
808 break;
811 break;
814 break;
817 break;
818 }
819 // sramecc.
820 switch (getTargetID()->getSramEccSetting()) {
823 break;
826 break;
829 break;
832 break;
833 }
834
835 return EFlagsV4;
836}
837
838unsigned AMDGPUTargetELFStreamer::getEFlagsV6() {
839 unsigned Flags = getEFlagsV4();
840
841 unsigned Version = ForceGenericVersion;
842 if (!Version) {
843 switch (parseArchAMDGCN(STI.getCPU())) {
846 break;
849 break;
852 break;
855 break;
858 break;
861 break;
862 default:
863 break;
864 }
865 }
866
867 // Versions start at 1.
868 if (Version) {
870 report_fatal_error("Cannot encode generic code object version " +
871 Twine(Version) +
872 " - no ELF flag can represent this version!");
874 }
875
876 return Flags;
877}
878
880
883 OS.pushSection();
884 Header.EmitKernelCodeT(OS, getContext());
885 OS.popSection();
886}
887
889 unsigned Type) {
890 auto *Symbol = static_cast<MCSymbolELF *>(
892 Symbol->setType(Type);
893}
894
896 Align Alignment) {
897 auto *SymbolELF = static_cast<MCSymbolELF *>(Symbol);
898 SymbolELF->setType(ELF::STT_OBJECT);
899
900 if (!SymbolELF->isBindingSet())
901 SymbolELF->setBinding(ELF::STB_GLOBAL);
902
903 if (SymbolELF->declareCommon(Size, Alignment)) {
904 report_fatal_error("Symbol: " + Symbol->getName() +
905 " redeclared as different type");
906 }
907
908 SymbolELF->setIndex(ELF::SHN_AMDGPU_LDS);
909 SymbolELF->setSize(MCConstantExpr::create(Size, getContext()));
910}
911
913 // Create two labels to mark the beginning and end of the desc field
914 // and a MCExpr to calculate the size of the desc field.
915 auto &Context = getContext();
916 auto *DescBegin = Context.createTempSymbol();
917 auto *DescEnd = Context.createTempSymbol();
918 auto *DescSZ = MCBinaryExpr::createSub(
921
923 [&](MCELFStreamer &OS) {
924 OS.emitLabel(DescBegin);
925 OS.emitBytes(getTargetID()->toString());
926 OS.emitLabel(DescEnd);
927 });
928 return true;
929}
930
932 bool Strict) {
934 if (!Verifier.verify(HSAMetadataDoc.getRoot()))
935 return false;
936
937 std::string HSAMetadataString;
938 HSAMetadataDoc.writeToBlob(HSAMetadataString);
939
940 // Create two labels to mark the beginning and end of the desc field
941 // and a MCExpr to calculate the size of the desc field.
942 auto &Context = getContext();
943 auto *DescBegin = Context.createTempSymbol();
944 auto *DescEnd = Context.createTempSymbol();
945 auto *DescSZ = MCBinaryExpr::createSub(
948
950 [&](MCELFStreamer &OS) {
951 OS.emitLabel(DescBegin);
952 OS.emitBytes(HSAMetadataString);
953 OS.emitLabel(DescEnd);
954 });
955 return true;
956}
957
959 const uint32_t Encoded_s_code_end = 0xbf9f0000;
960 const uint32_t Encoded_s_nop = 0xbf800000;
961 uint32_t Encoded_pad = Encoded_s_code_end;
962
963 // Instruction cache line size in bytes.
964 const unsigned Log2CacheLineSize = AMDGPU::isGFX11Plus(STI) ? 7 : 6;
965 const unsigned CacheLineSize = 1u << Log2CacheLineSize;
966
967 // Extra padding amount in bytes to support prefetch mode 3.
968 unsigned FillSize = 3 * CacheLineSize;
969
970 if (AMDGPU::isGFX90A(STI)) {
971 Encoded_pad = Encoded_s_nop;
972 FillSize = 16 * CacheLineSize;
973 }
974
976 OS.pushSection();
977 OS.emitValueToAlignment(Align(CacheLineSize), Encoded_pad, 4);
978 for (unsigned I = 0; I < FillSize; I += 4)
979 OS.emitInt32(Encoded_pad);
980 OS.popSection();
981 return true;
982}
983
985 const MCSubtargetInfo &STI, StringRef KernelName,
986 const MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR,
987 const MCExpr *NextSGPR, const MCExpr *ReserveVCC,
988 const MCExpr *ReserveFlatScr) {
989 auto &Streamer = getStreamer();
990 auto &Context = Streamer.getContext();
991
992 auto *KernelCodeSymbol =
993 static_cast<MCSymbolELF *>(Context.getOrCreateSymbol(Twine(KernelName)));
994 auto *KernelDescriptorSymbol = static_cast<MCSymbolELF *>(
995 Context.getOrCreateSymbol(Twine(KernelName) + Twine(".kd")));
996
997 // Copy kernel descriptor symbol's binding, other and visibility from the
998 // kernel code symbol.
999 KernelDescriptorSymbol->setBinding(KernelCodeSymbol->getBinding());
1000 KernelDescriptorSymbol->setOther(KernelCodeSymbol->getOther());
1001 KernelDescriptorSymbol->setVisibility(KernelCodeSymbol->getVisibility());
1002 // Kernel descriptor symbol's type and size are fixed.
1003 KernelDescriptorSymbol->setType(ELF::STT_OBJECT);
1004 KernelDescriptorSymbol->setSize(
1006
1007 // The visibility of the kernel code symbol must be protected or less to allow
1008 // static relocations from the kernel descriptor to be used.
1009 if (KernelCodeSymbol->getVisibility() == ELF::STV_DEFAULT)
1010 KernelCodeSymbol->setVisibility(ELF::STV_PROTECTED);
1011
1012 Streamer.emitLabel(KernelDescriptorSymbol);
1013 Streamer.emitValue(
1014 KernelDescriptor.group_segment_fixed_size,
1016 Streamer.emitValue(
1017 KernelDescriptor.private_segment_fixed_size,
1019 Streamer.emitValue(KernelDescriptor.kernarg_size,
1021
1022 for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved0); ++i)
1023 Streamer.emitInt8(0u);
1024
1025 // FIXME: Remove the use of VK_AMDGPU_REL64 in the expression below. The
1026 // expression being created is:
1027 // (start of kernel code) - (start of kernel descriptor)
1028 // It implies R_AMDGPU_REL64, but ends up being R_AMDGPU_ABS64.
1029 Streamer.emitValue(
1032 Context),
1033 MCSymbolRefExpr::create(KernelDescriptorSymbol, Context), Context),
1035 for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved1); ++i)
1036 Streamer.emitInt8(0u);
1037 Streamer.emitValue(KernelDescriptor.compute_pgm_rsrc3,
1039 Streamer.emitValue(KernelDescriptor.compute_pgm_rsrc1,
1041 Streamer.emitValue(KernelDescriptor.compute_pgm_rsrc2,
1043 Streamer.emitValue(
1044 KernelDescriptor.kernel_code_properties,
1046 Streamer.emitValue(KernelDescriptor.kernarg_preload,
1048 for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved3); ++i)
1049 Streamer.emitInt8(0u);
1050}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDHSA kernel descriptor MCExpr struct for use in MC layer.
This is a verifier for AMDGPU HSA metadata, which can verify both well-typed metadata and untyped met...
AMDGPU metadata definitions and in-memory representations.
Enums and constants for AMDGPU PT_NOTE sections.
static cl::opt< unsigned > ForceGenericVersion("amdgpu-force-generic-version", cl::desc("Force a specific generic_v<N> flag to be " "added. For testing purposes only."), cl::ReallyHidden, cl::init(0))
#define PRINT_RES_INFO(ARG)
AMDHSA kernel descriptor definitions.
MC layer struct for AMDGPUMCKernelCodeT, provides MCExpr functionality where required.
std::string Name
uint64_t Size
#define I(x, y, z)
Definition: MD5.cpp:58
verify safepoint Safepoint IR Verifier
raw_pwrite_stream & OS
static cl::opt< unsigned > CacheLineSize("cache-line-size", cl::init(0), cl::Hidden, cl::desc("Use this to override the target cache line size when " "specified by the user."))
const char * getVendor() const
void toBlob(unsigned Type, std::string &S)
void toString(std::string &S)
AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
bool EmitHSAMetadata(msgpack::Document &HSAMetadata, bool Strict) override
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
void EmitMCResourceMaximums(const MCSymbol *MaxVGPR, const MCSymbol *MaxAGPR, const MCSymbol *MaxSGPR) override
void EmitDirectiveAMDHSACodeObjectVersion(unsigned COV) override
void EmitAMDKernelCodeT(AMDGPU::AMDGPUMCKernelCodeT &Header) override
void EmitAmdhsaKernelDescriptor(const MCSubtargetInfo &STI, StringRef KernelName, const AMDGPU::MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR, const MCExpr *NextSGPR, const MCExpr *ReserveVCC, const MCExpr *ReserveFlatScr) override
void EmitMCResourceInfo(const MCSymbol *NumVGPR, const MCSymbol *NumAGPR, const MCSymbol *NumExplicitSGPR, const MCSymbol *NumNamedBarrier, const MCSymbol *PrivateSegmentSize, const MCSymbol *UsesVCC, const MCSymbol *UsesFlatScratch, const MCSymbol *HasDynamicallySizedStack, const MCSymbol *HasRecursion, const MCSymbol *HasIndirectCall) override
bool EmitCodeEnd(const MCSubtargetInfo &STI) override
void emitAMDGPULDS(MCSymbol *Sym, unsigned Size, Align Alignment) override
bool EmitCodeEnd(const MCSubtargetInfo &STI) override
void EmitAMDKernelCodeT(AMDGPU::AMDGPUMCKernelCodeT &Header) override
bool EmitHSAMetadata(msgpack::Document &HSAMetadata, bool Strict) override
AMDGPUTargetELFStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
void emitAMDGPULDS(MCSymbol *Sym, unsigned Size, Align Alignment) override
void EmitAmdhsaKernelDescriptor(const MCSubtargetInfo &STI, StringRef KernelName, const AMDGPU::MCKernelDescriptor &KernelDescriptor, const MCExpr *NextVGPR, const MCExpr *NextSGPR, const MCExpr *ReserveVCC, const MCExpr *ReserveFlatScr) override
void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override
virtual bool EmitHSAMetadata(msgpack::Document &HSAMetadata, bool Strict)
Emit HSA Metadata.
AMDGPUPALMetadata * getPALMetadata()
virtual void EmitDirectiveAMDHSACodeObjectVersion(unsigned COV)
virtual bool EmitHSAMetadataV3(StringRef HSAMetadataString)
static unsigned getElfMach(StringRef GPU)
MCContext & getContext() const
static StringRef getArchNameFromElfMach(unsigned ElfMach)
const std::optional< AMDGPU::IsaInfo::AMDGPUTargetID > & getTargetID() const
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:64
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition: MCExpr.h:343
static const MCBinaryExpr * createMul(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:398
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:428
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition: MCExpr.cpp:212
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:412
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:203
ELFObjectWriter & getWriter()
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
Streaming machine code generation interface.
Definition: MCStreamer.h:220
MCContext & getContext() const
Definition: MCStreamer.h:314
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Definition: MCStreamer.cpp:178
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
Definition: MCStreamer.cpp:395
void emitInt8(uint64_t Value)
Definition: MCStreamer.h:748
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
StringRef getCPU() const
void setBinding(unsigned Binding) const
Definition: MCSymbolELF.cpp:43
void setType(unsigned Type) const
Definition: MCSymbolELF.cpp:92
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition: MCExpr.h:214
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
OSType getOS() const
Get the parsed operating system type of this triple.
Definition: Triple.h:417
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:408
bool isAMDGCN() const
Tests whether the target is AMDGCN.
Definition: Triple.h:901
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:75
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
An efficient, type-erasing, non-owning reference to a callable.
Simple in-memory representation of a document of msgpack objects with ability to find and create arra...
DocNode & getRoot()
Get ref to the document's root element.
LLVM_ABI void toYAML(raw_ostream &OS)
Convert MsgPack Document to YAML text.
LLVM_ABI void writeToBlob(std::string &Blob)
Write a MsgPack document to a binary MsgPack blob.
LLVM_ABI bool fromYAML(StringRef S)
Read YAML text into the MsgPack document. Returns false on failure.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:662
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:680
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const char NoteNameV2[]
Definition: AMDGPUPTNote.h:26
const char SectionName[]
Definition: AMDGPUPTNote.h:24
const char NoteNameV3[]
Definition: AMDGPUPTNote.h:27
static constexpr unsigned GFX9_4
static constexpr unsigned GFX10_1
static constexpr unsigned GFX10_3
static constexpr unsigned GFX11
static constexpr unsigned GFX9
static constexpr unsigned GFX12
constexpr char AssemblerDirectiveBegin[]
HSA metadata beginning assembler directive.
constexpr char AssemblerDirectiveEnd[]
HSA metadata ending assembler directive.
LLVM_ABI StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
Definition: TargetParser.h:38
void printAMDGPUMCExpr(const MCExpr *Expr, raw_ostream &OS, const MCAsmInfo *MAI)
bool isHsaAbi(const MCSubtargetInfo &STI)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
bool isGFX90A(const MCSubtargetInfo &STI)
LLVM_ABI GPUKind parseArchAMDGCN(StringRef CPU)
bool hasArchitectedFlatScratch(const MCSubtargetInfo &STI)
bool isGFX11Plus(const MCSubtargetInfo &STI)
const MCExpr * foldAMDGPUMCExpr(const MCExpr *Expr, MCContext &Ctx)
LLVM_ABI StringRef getArchNameAMDGCN(GPUKind AK)
bool isGFX1250(const MCSubtargetInfo &STI)
unsigned hasKernargPreload(const MCSubtargetInfo &STI)
bool supportsWGP(const MCSubtargetInfo &STI)
uint8_t getELFABIVersion(const Triple &T, unsigned CodeObjectVersion)
LLVM_ABI GPUKind parseArchR600(StringRef CPU)
@ STV_PROTECTED
Definition: ELF.h:1429
@ STV_DEFAULT
Definition: ELF.h:1426
@ NT_AMDGPU_METADATA
Definition: ELF.h:1977
@ EF_AMDGPU_GENERIC_VERSION_MAX
Definition: ELF.h:921
@ EF_AMDGPU_FEATURE_XNACK_ANY_V4
Definition: ELF.h:898
@ EF_AMDGPU_MACH_AMDGCN_GFX703
Definition: ELF.h:809
@ EF_AMDGPU_MACH_AMDGCN_GFX1035
Definition: ELF.h:833
@ EF_AMDGPU_FEATURE_SRAMECC_V3
Definition: ELF.h:889
@ EF_AMDGPU_MACH_AMDGCN_GFX1031
Definition: ELF.h:827
@ EF_AMDGPU_GENERIC_VERSION_OFFSET
Definition: ELF.h:919
@ EF_AMDGPU_MACH_R600_CAYMAN
Definition: ELF.h:791
@ EF_AMDGPU_FEATURE_SRAMECC_UNSUPPORTED_V4
Definition: ELF.h:909
@ EF_AMDGPU_MACH_AMDGCN_GFX704
Definition: ELF.h:810
@ EF_AMDGPU_MACH_AMDGCN_GFX902
Definition: ELF.h:817
@ EF_AMDGPU_MACH_AMDGCN_GFX810
Definition: ELF.h:815
@ EF_AMDGPU_MACH_AMDGCN_GFX950
Definition: ELF.h:851
@ EF_AMDGPU_MACH_AMDGCN_GFX1036
Definition: ELF.h:841
@ EF_AMDGPU_MACH_AMDGCN_GFX1102
Definition: ELF.h:843
@ EF_AMDGPU_MACH_R600_RV730
Definition: ELF.h:780
@ EF_AMDGPU_MACH_R600_RV710
Definition: ELF.h:779
@ EF_AMDGPU_MACH_AMDGCN_GFX908
Definition: ELF.h:820
@ EF_AMDGPU_MACH_AMDGCN_GFX1011
Definition: ELF.h:824
@ EF_AMDGPU_MACH_R600_CYPRESS
Definition: ELF.h:784
@ EF_AMDGPU_MACH_AMDGCN_GFX1032
Definition: ELF.h:828
@ EF_AMDGPU_MACH_R600_R600
Definition: ELF.h:774
@ EF_AMDGPU_MACH_AMDGCN_GFX1250
Definition: ELF.h:845
@ EF_AMDGPU_MACH_R600_TURKS
Definition: ELF.h:792
@ EF_AMDGPU_MACH_R600_JUNIPER
Definition: ELF.h:785
@ EF_AMDGPU_FEATURE_SRAMECC_OFF_V4
Definition: ELF.h:913
@ EF_AMDGPU_FEATURE_XNACK_UNSUPPORTED_V4
Definition: ELF.h:896
@ EF_AMDGPU_MACH_AMDGCN_GFX601
Definition: ELF.h:805
@ EF_AMDGPU_MACH_AMDGCN_GFX942
Definition: ELF.h:848
@ EF_AMDGPU_MACH_AMDGCN_GFX1152
Definition: ELF.h:857
@ EF_AMDGPU_MACH_R600_R630
Definition: ELF.h:775
@ EF_AMDGPU_MACH_R600_REDWOOD
Definition: ELF.h:786
@ EF_AMDGPU_MACH_R600_RV770
Definition: ELF.h:781
@ EF_AMDGPU_FEATURE_XNACK_OFF_V4
Definition: ELF.h:900
@ EF_AMDGPU_MACH_AMDGCN_GFX600
Definition: ELF.h:804
@ EF_AMDGPU_FEATURE_XNACK_V3
Definition: ELF.h:884
@ EF_AMDGPU_MACH_AMDGCN_GFX602
Definition: ELF.h:830
@ EF_AMDGPU_MACH_AMDGCN_GFX1101
Definition: ELF.h:842
@ EF_AMDGPU_MACH_AMDGCN_GFX1100
Definition: ELF.h:837
@ EF_AMDGPU_MACH_AMDGCN_GFX1033
Definition: ELF.h:829
@ EF_AMDGPU_MACH_AMDGCN_GFX801
Definition: ELF.h:812
@ EF_AMDGPU_MACH_AMDGCN_GFX705
Definition: ELF.h:831
@ EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC
Definition: ELF.h:862
@ EF_AMDGPU_MACH_AMDGCN_GFX1153
Definition: ELF.h:860
@ EF_AMDGPU_MACH_AMDGCN_GFX1010
Definition: ELF.h:823
@ EF_AMDGPU_MACH_R600_RV670
Definition: ELF.h:777
@ EF_AMDGPU_MACH_AMDGCN_GFX701
Definition: ELF.h:807
@ EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC
Definition: ELF.h:855
@ EF_AMDGPU_MACH_AMDGCN_GFX1012
Definition: ELF.h:825
@ EF_AMDGPU_MACH_AMDGCN_GFX1151
Definition: ELF.h:846
@ EF_AMDGPU_MACH_AMDGCN_GFX1030
Definition: ELF.h:826
@ EF_AMDGPU_MACH_R600_CEDAR
Definition: ELF.h:783
@ EF_AMDGPU_MACH_AMDGCN_GFX1200
Definition: ELF.h:844
@ EF_AMDGPU_MACH_AMDGCN_GFX700
Definition: ELF.h:806
@ EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC
Definition: ELF.h:856
@ EF_AMDGPU_MACH_AMDGCN_GFX803
Definition: ELF.h:814
@ EF_AMDGPU_MACH_AMDGCN_GFX802
Definition: ELF.h:813
@ EF_AMDGPU_MACH_AMDGCN_GFX90C
Definition: ELF.h:822
@ EF_AMDGPU_FEATURE_XNACK_ON_V4
Definition: ELF.h:902
@ EF_AMDGPU_MACH_AMDGCN_GFX900
Definition: ELF.h:816
@ EF_AMDGPU_MACH_AMDGCN_GFX909
Definition: ELF.h:821
@ EF_AMDGPU_MACH_AMDGCN_GFX906
Definition: ELF.h:819
@ EF_AMDGPU_MACH_NONE
Definition: ELF.h:769
@ EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC
Definition: ELF.h:853
@ EF_AMDGPU_MACH_AMDGCN_GFX1103
Definition: ELF.h:840
@ EF_AMDGPU_MACH_R600_CAICOS
Definition: ELF.h:790
@ EF_AMDGPU_MACH_AMDGCN_GFX90A
Definition: ELF.h:835
@ EF_AMDGPU_MACH_AMDGCN_GFX1034
Definition: ELF.h:834
@ EF_AMDGPU_MACH_AMDGCN_GFX1013
Definition: ELF.h:838
@ EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC
Definition: ELF.h:861
@ EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC
Definition: ELF.h:854
@ EF_AMDGPU_MACH_AMDGCN_GFX904
Definition: ELF.h:818
@ EF_AMDGPU_MACH_R600_RS880
Definition: ELF.h:776
@ EF_AMDGPU_MACH_AMDGCN_GFX805
Definition: ELF.h:832
@ EF_AMDGPU_MACH_AMDGCN_GFX1201
Definition: ELF.h:850
@ EF_AMDGPU_MACH_AMDGCN_GFX1150
Definition: ELF.h:839
@ EF_AMDGPU_MACH_R600_SUMO
Definition: ELF.h:787
@ EF_AMDGPU_MACH_R600_BARTS
Definition: ELF.h:789
@ EF_AMDGPU_FEATURE_SRAMECC_ANY_V4
Definition: ELF.h:911
@ EF_AMDGPU_FEATURE_SRAMECC_ON_V4
Definition: ELF.h:915
@ EF_AMDGPU_MACH_AMDGCN_GFX702
Definition: ELF.h:808
@ SHT_NOTE
Definition: ELF.h:1146
@ SHN_AMDGPU_LDS
Definition: ELF.h:1960
@ STB_GLOBAL
Definition: ELF.h:1397
@ SHF_ALLOC
Definition: ELF.h:1240
@ STT_AMDGPU_HSA_KERNEL
Definition: ELF.h:1422
@ STT_OBJECT
Definition: ELF.h:1409
@ NT_AMD_HSA_ISA_NAME
Definition: ELF.h:1970
@ ReallyHidden
Definition: CommandLine.h:139
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:444
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition: Error.cpp:167
const char * toString(DWARFSectionKind Kind)
Instruction set architecture version.
Definition: TargetParser.h:132
static const MCExpr * bits_get(const MCExpr *Src, uint32_t Shift, uint32_t Mask, MCContext &Ctx)
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85