Home | History | Annotate | Download | only in AMDGPU
      1 // RUN: llvm-mc -triple amdgcn--amdhsa -mcpu=kaveri -show-encoding %s | FileCheck %s --check-prefix=ASM
      2 // RUN: llvm-mc -filetype=obj -triple amdgcn--amdhsa -mcpu=kaveri -show-encoding %s | llvm-readobj -symbols -s -sd | FileCheck %s --check-prefix=ELF
      3 
      4 // ELF: Section {
      5 // ELF: Name: .text
      6 // ELF: Type: SHT_PROGBITS (0x1)
      7 // ELF: Flags [ (0x6)
      8 // ELF: SHF_ALLOC (0x2)
      9 // ELF: SHF_EXECINSTR (0x4)
     10 
     11 // ELF: SHT_NOTE
     12 // ELF: 0000: 04000000 08000000 01000000 414D4400
     13 // ELF: 0010: 02000000 00000000 04000000 1B000000
     14 // ELF: 0020: 03000000 414D4400 04000700 07000000
     15 // ELF: 0030: 00000000 00000000 414D4400 414D4447
     16 // ELF: 0040: 50550000
     17 
     18 // ELF: Symbol {
     19 // ELF: Name: amd_kernel_code_t_minimal
     20 // ELF: Type: AMDGPU_HSA_KERNEL (0xA)
     21 // ELF: Section: .text
     22 // ELF: }
     23 // ELF: Symbol {
     24 // ELF: Name: amd_kernel_code_t_test_all
     25 // ELF: Type: AMDGPU_HSA_KERNEL (0xA)
     26 // ELF: Section: .text
     27 // ELF: }
     28 
     29 .text
     30 // ASM: .text
     31 
     32 .hsa_code_object_version 2,0
     33 // ASM: .hsa_code_object_version 2,0
     34 
     35 .hsa_code_object_isa 7,0,0,"AMD","AMDGPU"
     36 // ASM: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU"
     37 
     38 .amdgpu_hsa_kernel amd_kernel_code_t_test_all
     39 .amdgpu_hsa_kernel amd_kernel_code_t_minimal
     40 
     41 
     42 amd_kernel_code_t_test_all:
     43 ; Test all amd_kernel_code_t members with non-default values.
     44 .amd_kernel_code_t
     45 	kernel_code_version_major = 100
     46 	kernel_code_version_minor = 100
     47 	machine_kind = 0
     48 	machine_version_major = 5
     49 	machine_version_minor = 5
     50 	machine_version_stepping = 5
     51 	kernel_code_entry_byte_offset = 512
     52 	kernel_code_prefetch_byte_size = 1
     53 	max_scratch_backing_memory_byte_size = 1
     54 	compute_pgm_rsrc1_vgprs = 1
     55 	compute_pgm_rsrc1_sgprs = 1
     56 	compute_pgm_rsrc1_priority = 1
     57 	compute_pgm_rsrc1_float_mode = 1
     58 	compute_pgm_rsrc1_priv = 1
     59 	compute_pgm_rsrc1_dx10_clamp = 1
     60 	compute_pgm_rsrc1_debug_mode = 1
     61 	compute_pgm_rsrc1_ieee_mode = 1
     62 	compute_pgm_rsrc2_scratch_en = 1
     63 	compute_pgm_rsrc2_user_sgpr = 1
     64 	compute_pgm_rsrc2_tgid_x_en = 1
     65 	compute_pgm_rsrc2_tgid_y_en = 1
     66 	compute_pgm_rsrc2_tgid_z_en = 1
     67 	compute_pgm_rsrc2_tg_size_en = 1
     68 	compute_pgm_rsrc2_tidig_comp_cnt = 1
     69 	compute_pgm_rsrc2_excp_en_msb = 1
     70 	compute_pgm_rsrc2_lds_size = 1
     71 	compute_pgm_rsrc2_excp_en = 1
     72 	enable_sgpr_private_segment_buffer = 1
     73 	enable_sgpr_dispatch_ptr = 1
     74 	enable_sgpr_queue_ptr = 1
     75 	enable_sgpr_kernarg_segment_ptr = 1
     76 	enable_sgpr_dispatch_id = 1
     77 	enable_sgpr_flat_scratch_init = 1
     78 	enable_sgpr_private_segment_size = 1
     79 	enable_sgpr_grid_workgroup_count_x = 1
     80 	enable_sgpr_grid_workgroup_count_y = 1
     81 	enable_sgpr_grid_workgroup_count_z = 1
     82 	enable_ordered_append_gds = 1
     83 	private_element_size = 1
     84 	is_ptr64 = 1
     85 	is_dynamic_callstack = 1
     86 	is_debug_enabled = 1
     87 	is_xnack_enabled = 1
     88 	workitem_private_segment_byte_size = 1
     89 	workgroup_group_segment_byte_size = 1
     90 	gds_segment_byte_size = 1
     91 	kernarg_segment_byte_size = 1
     92 	workgroup_fbarrier_count = 1
     93 	wavefront_sgpr_count = 1
     94 	workitem_vgpr_count = 1
     95 	reserved_vgpr_first = 1
     96 	reserved_vgpr_count = 1
     97 	reserved_sgpr_first = 1
     98 	reserved_sgpr_count = 1
     99 	debug_wavefront_private_segment_offset_sgpr = 1
    100 	debug_private_segment_buffer_sgpr = 1
    101 	kernarg_segment_alignment = 5
    102 	group_segment_alignment = 5
    103 	private_segment_alignment = 5
    104 	wavefront_size = 5
    105 	call_convention = 1
    106 	runtime_loader_kernel_symbol = 1
    107 .end_amd_kernel_code_t
    108 
    109 // ASM-LABEL: {{^}}amd_kernel_code_t_test_all:
    110 // ASM: .amd_kernel_code_t
    111 // ASM: kernel_code_version_major = 100
    112 // ASM: kernel_code_version_minor = 100
    113 // ASM: machine_kind = 0
    114 // ASM: machine_version_major = 5
    115 // ASM: machine_version_minor = 5
    116 // ASM: machine_version_stepping = 5
    117 // ASM: kernel_code_entry_byte_offset = 512
    118 // ASM: kernel_code_prefetch_byte_size = 1
    119 // ASM: max_scratch_backing_memory_byte_size = 1
    120 // ASM: compute_pgm_rsrc1_vgprs = 1
    121 // ASM: compute_pgm_rsrc1_sgprs = 1
    122 // ASM: compute_pgm_rsrc1_priority = 1
    123 // ASM: compute_pgm_rsrc1_float_mode = 1
    124 // ASM: compute_pgm_rsrc1_priv = 1
    125 // ASM: compute_pgm_rsrc1_dx10_clamp = 1
    126 // ASM: compute_pgm_rsrc1_debug_mode = 1
    127 // ASM: compute_pgm_rsrc1_ieee_mode = 1
    128 // ASM: compute_pgm_rsrc2_scratch_en = 1
    129 // ASM: compute_pgm_rsrc2_user_sgpr = 1
    130 // ASM: compute_pgm_rsrc2_tgid_x_en = 1
    131 // ASM: compute_pgm_rsrc2_tgid_y_en = 1
    132 // ASM: compute_pgm_rsrc2_tgid_z_en = 1
    133 // ASM: compute_pgm_rsrc2_tg_size_en = 1
    134 // ASM: compute_pgm_rsrc2_tidig_comp_cnt = 1
    135 // ASM: compute_pgm_rsrc2_excp_en_msb = 1
    136 // ASM: compute_pgm_rsrc2_lds_size = 1
    137 // ASM: compute_pgm_rsrc2_excp_en = 1
    138 // ASM: enable_sgpr_private_segment_buffer = 1
    139 // ASM: enable_sgpr_dispatch_ptr = 1
    140 // ASM: enable_sgpr_queue_ptr = 1
    141 // ASM: enable_sgpr_kernarg_segment_ptr = 1
    142 // ASM: enable_sgpr_dispatch_id = 1
    143 // ASM: enable_sgpr_flat_scratch_init = 1
    144 // ASM: enable_sgpr_private_segment_size = 1
    145 // ASM: enable_sgpr_grid_workgroup_count_x = 1
    146 // ASM: enable_sgpr_grid_workgroup_count_y = 1
    147 // ASM: enable_sgpr_grid_workgroup_count_z = 1
    148 // ASM: enable_ordered_append_gds = 1
    149 // ASM: private_element_size = 1
    150 // ASM: is_ptr64 = 1
    151 // ASM: is_dynamic_callstack = 1
    152 // ASM: is_debug_enabled = 1
    153 // ASM: is_xnack_enabled = 1
    154 // ASM: workitem_private_segment_byte_size = 1
    155 // ASM: workgroup_group_segment_byte_size = 1
    156 // ASM: gds_segment_byte_size = 1
    157 // ASM: kernarg_segment_byte_size = 1
    158 // ASM: workgroup_fbarrier_count = 1
    159 // ASM: wavefront_sgpr_count = 1
    160 // ASM: workitem_vgpr_count = 1
    161 // ASM: reserved_vgpr_first = 1
    162 // ASM: reserved_vgpr_count = 1
    163 // ASM: reserved_sgpr_first = 1
    164 // ASM: reserved_sgpr_count = 1
    165 // ASM: debug_wavefront_private_segment_offset_sgpr = 1
    166 // ASM: debug_private_segment_buffer_sgpr = 1
    167 // ASM: kernarg_segment_alignment = 5
    168 // ASM: group_segment_alignment = 5
    169 // ASM: private_segment_alignment = 5
    170 // ASM: wavefront_size = 5
    171 // ASM: call_convention = 1
    172 // ASM: runtime_loader_kernel_symbol = 1
    173 // ASM: .end_amd_kernel_code_t
    174 
    175 amd_kernel_code_t_minimal:
    176 .amd_kernel_code_t
    177 	enable_sgpr_kernarg_segment_ptr = 1
    178 	is_ptr64 = 1
    179 	compute_pgm_rsrc1_vgprs = 1
    180 	compute_pgm_rsrc1_sgprs = 1
    181 	compute_pgm_rsrc2_user_sgpr = 2
    182 	kernarg_segment_byte_size = 16
    183 	wavefront_sgpr_count = 8
    184 //      wavefront_sgpr_count = 7
    185 ;	wavefront_sgpr_count = 7
    186 // Make sure a blank line won't break anything:
    187 
    188 // Make sure a line with whitespace won't break anything:
    189 
    190 	workitem_vgpr_count = 16
    191 .end_amd_kernel_code_t
    192 
    193 // ASM-LABEL: {{^}}amd_kernel_code_t_minimal:
    194 // ASM: .amd_kernel_code_t
    195 // ASM:	kernel_code_version_major = 1
    196 // ASM:	kernel_code_version_minor = 0
    197 // ASM:	machine_kind = 1
    198 // ASM:	machine_version_major = 7
    199 // ASM:	machine_version_minor = 0
    200 // ASM:	machine_version_stepping = 0
    201 // ASM:	kernel_code_entry_byte_offset = 256
    202 // ASM:	kernel_code_prefetch_byte_size = 0
    203 // ASM:	max_scratch_backing_memory_byte_size = 0
    204 // ASM:	compute_pgm_rsrc1_vgprs = 1
    205 // ASM:	compute_pgm_rsrc1_sgprs = 1
    206 // ASM:	compute_pgm_rsrc1_priority = 0
    207 // ASM:	compute_pgm_rsrc1_float_mode = 0
    208 // ASM:	compute_pgm_rsrc1_priv = 0
    209 // ASM:	compute_pgm_rsrc1_dx10_clamp = 0
    210 // ASM:	compute_pgm_rsrc1_debug_mode = 0
    211 // ASM:	compute_pgm_rsrc1_ieee_mode = 0
    212 // ASM:	compute_pgm_rsrc2_scratch_en = 0
    213 // ASM:	compute_pgm_rsrc2_user_sgpr = 2
    214 // ASM:	compute_pgm_rsrc2_tgid_x_en = 0
    215 // ASM:	compute_pgm_rsrc2_tgid_y_en = 0
    216 // ASM:	compute_pgm_rsrc2_tgid_z_en = 0
    217 // ASM:	compute_pgm_rsrc2_tg_size_en = 0
    218 // ASM:	compute_pgm_rsrc2_tidig_comp_cnt = 0
    219 // ASM:	compute_pgm_rsrc2_excp_en_msb = 0
    220 // ASM:	compute_pgm_rsrc2_lds_size = 0
    221 // ASM:	compute_pgm_rsrc2_excp_en = 0
    222 // ASM:	enable_sgpr_private_segment_buffer = 0
    223 // ASM:	enable_sgpr_dispatch_ptr = 0
    224 // ASM:	enable_sgpr_queue_ptr = 0
    225 // ASM:	enable_sgpr_kernarg_segment_ptr = 1
    226 // ASM:	enable_sgpr_dispatch_id = 0
    227 // ASM:	enable_sgpr_flat_scratch_init = 0
    228 // ASM:	enable_sgpr_private_segment_size = 0
    229 // ASM:	enable_sgpr_grid_workgroup_count_x = 0
    230 // ASM:	enable_sgpr_grid_workgroup_count_y = 0
    231 // ASM:	enable_sgpr_grid_workgroup_count_z = 0
    232 // ASM:	enable_ordered_append_gds = 0
    233 // ASM:	private_element_size = 0
    234 // ASM:	is_ptr64 = 1
    235 // ASM:	is_dynamic_callstack = 0
    236 // ASM:	is_debug_enabled = 0
    237 // ASM:	is_xnack_enabled = 0
    238 // ASM:	workitem_private_segment_byte_size = 0
    239 // ASM:	workgroup_group_segment_byte_size = 0
    240 // ASM:	gds_segment_byte_size = 0
    241 // ASM:	kernarg_segment_byte_size = 16
    242 // ASM:	workgroup_fbarrier_count = 0
    243 // ASM:	wavefront_sgpr_count = 8
    244 // ASM:	workitem_vgpr_count = 16
    245 // ASM:	reserved_vgpr_first = 0
    246 // ASM:	reserved_vgpr_count = 0
    247 // ASM:	reserved_sgpr_first = 0
    248 // ASM:	reserved_sgpr_count = 0
    249 // ASM:	debug_wavefront_private_segment_offset_sgpr = 0
    250 // ASM:	debug_private_segment_buffer_sgpr = 0
    251 // ASM:	kernarg_segment_alignment = 4
    252 // ASM:	group_segment_alignment = 4
    253 // ASM:	private_segment_alignment = 4
    254 // ASM:	wavefront_size = 6
    255 // ASM:	call_convention = 0
    256 // ASM:	runtime_loader_kernel_symbol = 0
    257 // ASM: .end_amd_kernel_code_t
    258