LLVM  3.7.0
AMDGPUBaseInfo.cpp
Go to the documentation of this file.
1 //===-- AMDGPUBaseInfo.cpp - AMDGPU Base encoding information--------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #include "AMDGPUBaseInfo.h"
11 
12 #define GET_SUBTARGETINFO_ENUM
13 #include "AMDGPUGenSubtargetInfo.inc"
14 #undef GET_SUBTARGETINFO_ENUM
15 
16 namespace llvm {
17 namespace AMDGPU {
18 
20 
21  if (Features.test(FeatureISAVersion7_0_0))
22  return {7, 0, 0};
23 
24  if (Features.test(FeatureISAVersion7_0_1))
25  return {7, 0, 1};
26 
27  if (Features.test(FeatureISAVersion8_0_0))
28  return {8, 0, 0};
29 
30  if (Features.test(FeatureISAVersion8_0_1))
31  return {8, 0, 1};
32 
33  return {0, 0, 0};
34 }
35 
37  const FeatureBitset &Features) {
38 
39  IsaVersion ISA = getIsaVersion(Features);
40 
41  memset(&Header, 0, sizeof(Header));
42 
45  Header.amd_machine_kind = 1; // AMD_MACHINE_KIND_AMDGPU
46  Header.amd_machine_version_major = ISA.Major;
47  Header.amd_machine_version_minor = ISA.Minor;
49  Header.kernel_code_entry_byte_offset = sizeof(Header);
50  // wavefront_size is specified as a power of 2: 2^6 = 64 threads.
51  Header.wavefront_size = 6;
52  // These alignment values are specified in powers of two, so alignment =
53  // 2^n. The minimum alignment is 2^4 = 16.
54  Header.kernarg_segment_alignment = 4;
55  Header.group_segment_alignment = 4;
56  Header.private_segment_alignment = 4;
57 }
58 
59 } // End namespace AMDGPU
60 } // End namespace llvm
const FeatureBitset Features
uint32_t amd_kernel_code_version_major
AMD Kernel Code Object (amd_kernel_code_t).
uint16_t amd_machine_version_major
uint8_t kernarg_segment_alignment
The maximum byte alignment of variables used by the kernel in the specified memory segment...
uint8_t group_segment_alignment
uint16_t amd_machine_version_minor
uint32_t amd_kernel_code_version_minor
IsaVersion getIsaVersion(const FeatureBitset &Features)
uint8_t private_segment_alignment
void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header, const FeatureBitset &Features)
uint16_t amd_machine_version_stepping
uint8_t wavefront_size
Wavefront size expressed as a power of two.
int64_t kernel_code_entry_byte_offset
Byte offset (possibly negative) from start of amd_kernel_code_t object to kernel's entry point instru...
uint16_t amd_machine_kind