• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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// We can't check binary representation of metadata note: it is different on
18// Windows and Linux because of carriage return on Windows
19
20// ELF: Symbol {
21// ELF: Name: amd_kernel_code_t_minimal
22// ELF: Type: AMDGPU_HSA_KERNEL (0xA)
23// ELF: Section: .text
24// ELF: }
25// ELF: Symbol {
26// ELF: Name: amd_kernel_code_t_test_all
27// ELF: Type: AMDGPU_HSA_KERNEL (0xA)
28// ELF: Section: .text
29// ELF: }
30
31.text
32// ASM: .text
33
34.hsa_code_object_version 2,0
35// ASM: .hsa_code_object_version 2,0
36
37.hsa_code_object_isa 7,0,0,"AMD","AMDGPU"
38// ASM: .hsa_code_object_isa 7,0,0,"AMD","AMDGPU"
39
40.amd_amdgpu_hsa_metadata
41  Version: [ 3, 0 ]
42  Kernels:
43    - Name:       amd_kernel_code_t_test_all
44      SymbolName: amd_kernel_code_t_test_all@kd
45    - Name:       amd_kernel_code_t_minimal
46      SymbolName: amd_kernel_code_t_minimal@kd
47.end_amd_amdgpu_hsa_metadata
48
49// ASM: .amd_amdgpu_hsa_metadata
50// ASM:    Version: [ 3, 0 ]
51// ASM:    Kernels:
52// ASM:      - Name:       amd_kernel_code_t_test_all
53// ASM:        SymbolName: 'amd_kernel_code_t_test_all@kd'
54// ASM:      - Name:       amd_kernel_code_t_minimal
55// ASM:        SymbolName: 'amd_kernel_code_t_minimal@kd'
56// ASM: .end_amd_amdgpu_hsa_metadata
57
58.amdgpu_hsa_kernel amd_kernel_code_t_test_all
59.amdgpu_hsa_kernel amd_kernel_code_t_minimal
60
61amd_kernel_code_t_test_all:
62; Test all amd_kernel_code_t members with non-default values.
63.amd_kernel_code_t
64    kernel_code_version_major = 100
65    kernel_code_version_minor = 100
66    machine_kind = 0
67    machine_version_major = 5
68    machine_version_minor = 5
69    machine_version_stepping = 5
70    kernel_code_entry_byte_offset = 512
71    kernel_code_prefetch_byte_size = 1
72    max_scratch_backing_memory_byte_size = 1
73    compute_pgm_rsrc1_vgprs = 1
74    compute_pgm_rsrc1_sgprs = 1
75    compute_pgm_rsrc1_priority = 1
76    compute_pgm_rsrc1_float_mode = 1
77    compute_pgm_rsrc1_priv = 1
78    compute_pgm_rsrc1_dx10_clamp = 1
79    compute_pgm_rsrc1_debug_mode = 1
80    compute_pgm_rsrc1_ieee_mode = 1
81    compute_pgm_rsrc2_scratch_en = 1
82    compute_pgm_rsrc2_user_sgpr = 1
83    compute_pgm_rsrc2_tgid_x_en = 1
84    compute_pgm_rsrc2_tgid_y_en = 1
85    compute_pgm_rsrc2_tgid_z_en = 1
86    compute_pgm_rsrc2_tg_size_en = 1
87    compute_pgm_rsrc2_tidig_comp_cnt = 1
88    compute_pgm_rsrc2_excp_en_msb = 1
89    compute_pgm_rsrc2_lds_size = 1
90    compute_pgm_rsrc2_excp_en = 1
91    enable_sgpr_private_segment_buffer = 1
92    enable_sgpr_dispatch_ptr = 1
93    enable_sgpr_queue_ptr = 1
94    enable_sgpr_kernarg_segment_ptr = 1
95    enable_sgpr_dispatch_id = 1
96    enable_sgpr_flat_scratch_init = 1
97    enable_sgpr_private_segment_size = 1
98    enable_sgpr_grid_workgroup_count_x = 1
99    enable_sgpr_grid_workgroup_count_y = 1
100    enable_sgpr_grid_workgroup_count_z = 1
101    enable_ordered_append_gds = 1
102    private_element_size = 1
103    is_ptr64 = 1
104    is_dynamic_callstack = 1
105    is_debug_enabled = 1
106    is_xnack_enabled = 1
107    workitem_private_segment_byte_size = 1
108    workgroup_group_segment_byte_size = 1
109    gds_segment_byte_size = 1
110    kernarg_segment_byte_size = 1
111    workgroup_fbarrier_count = 1
112    wavefront_sgpr_count = 1
113    workitem_vgpr_count = 1
114    reserved_vgpr_first = 1
115    reserved_vgpr_count = 1
116    reserved_sgpr_first = 1
117    reserved_sgpr_count = 1
118    debug_wavefront_private_segment_offset_sgpr = 1
119    debug_private_segment_buffer_sgpr = 1
120    kernarg_segment_alignment = 5
121    group_segment_alignment = 5
122    private_segment_alignment = 5
123    wavefront_size = 5
124    call_convention = 1
125    runtime_loader_kernel_symbol = 1
126.end_amd_kernel_code_t
127
128// ASM-LABEL: {{^}}amd_kernel_code_t_test_all:
129// ASM: .amd_kernel_code_t
130// ASM: amd_code_version_major = 100
131// ASM: amd_code_version_minor = 100
132// ASM: amd_machine_kind = 0
133// ASM: amd_machine_version_major = 5
134// ASM: amd_machine_version_minor = 5
135// ASM: amd_machine_version_stepping = 5
136// ASM: kernel_code_entry_byte_offset = 512
137// ASM: kernel_code_prefetch_byte_size = 1
138// ASM: granulated_workitem_vgpr_count = 1
139// ASM: granulated_wavefront_sgpr_count = 1
140// ASM: priority = 1
141// ASM: float_mode = 1
142// ASM: priv = 1
143// ASM: enable_dx10_clamp = 1
144// ASM: debug_mode = 1
145// ASM: enable_ieee_mode = 1
146// ASM: enable_sgpr_private_segment_wave_byte_offset = 1
147// ASM: user_sgpr_count = 1
148// ASM: enable_sgpr_workgroup_id_x = 1
149// ASM: enable_sgpr_workgroup_id_y = 1
150// ASM: enable_sgpr_workgroup_id_z = 1
151// ASM: enable_sgpr_workgroup_info = 1
152// ASM: enable_vgpr_workitem_id = 1
153// ASM: enable_exception_msb = 1
154// ASM: granulated_lds_size = 1
155// ASM: enable_exception = 1
156// ASM: enable_sgpr_private_segment_buffer = 1
157// ASM: enable_sgpr_dispatch_ptr = 1
158// ASM: enable_sgpr_queue_ptr = 1
159// ASM: enable_sgpr_kernarg_segment_ptr = 1
160// ASM: enable_sgpr_dispatch_id = 1
161// ASM: enable_sgpr_flat_scratch_init = 1
162// ASM: enable_sgpr_private_segment_size = 1
163// ASM: enable_sgpr_grid_workgroup_count_x = 1
164// ASM: enable_sgpr_grid_workgroup_count_y = 1
165// ASM: enable_sgpr_grid_workgroup_count_z = 1
166// ASM: enable_ordered_append_gds = 1
167// ASM: private_element_size = 1
168// ASM: is_ptr64 = 1
169// ASM: is_dynamic_callstack = 1
170// ASM: is_debug_enabled = 1
171// ASM: is_xnack_enabled = 1
172// ASM: workitem_private_segment_byte_size = 1
173// ASM: workgroup_group_segment_byte_size = 1
174// ASM: gds_segment_byte_size = 1
175// ASM: kernarg_segment_byte_size = 1
176// ASM: workgroup_fbarrier_count = 1
177// ASM: wavefront_sgpr_count = 1
178// ASM: workitem_vgpr_count = 1
179// ASM: reserved_vgpr_first = 1
180// ASM: reserved_vgpr_count = 1
181// ASM: reserved_sgpr_first = 1
182// ASM: reserved_sgpr_count = 1
183// ASM: debug_wavefront_private_segment_offset_sgpr = 1
184// ASM: debug_private_segment_buffer_sgpr = 1
185// ASM: kernarg_segment_alignment = 5
186// ASM: group_segment_alignment = 5
187// ASM: private_segment_alignment = 5
188// ASM: wavefront_size = 5
189// ASM: call_convention = 1
190// ASM: runtime_loader_kernel_symbol = 1
191// ASM: .end_amd_kernel_code_t
192
193amd_kernel_code_t_minimal:
194.amd_kernel_code_t
195	enable_sgpr_kernarg_segment_ptr = 1
196	is_ptr64 = 1
197	granulated_workitem_vgpr_count = 1
198	granulated_wavefront_sgpr_count = 1
199	user_sgpr_count = 2
200	kernarg_segment_byte_size = 16
201	wavefront_sgpr_count = 8
202//      wavefront_sgpr_count = 7
203;	wavefront_sgpr_count = 7
204// Make sure a blank line won't break anything:
205
206// Make sure a line with whitespace won't break anything:
207
208	workitem_vgpr_count = 16
209.end_amd_kernel_code_t
210
211// ASM-LABEL: {{^}}amd_kernel_code_t_minimal:
212// ASM: .amd_kernel_code_t
213// ASM:	amd_code_version_major = 1
214// ASM:	amd_code_version_minor = 2
215// ASM:	amd_machine_kind = 1
216// ASM:	amd_machine_version_major = 7
217// ASM:	amd_machine_version_minor = 0
218// ASM:	amd_machine_version_stepping = 0
219// ASM:	kernel_code_entry_byte_offset = 256
220// ASM:	kernel_code_prefetch_byte_size = 0
221// ASM: granulated_workitem_vgpr_count = 1
222// ASM: granulated_wavefront_sgpr_count = 1
223// ASM: priority = 0
224// ASM: float_mode = 0
225// ASM: priv = 0
226// ASM: enable_dx10_clamp = 0
227// ASM: debug_mode = 0
228// ASM: enable_ieee_mode = 0
229// ASM: enable_sgpr_private_segment_wave_byte_offset = 0
230// ASM: user_sgpr_count = 2
231// ASM: enable_sgpr_workgroup_id_x = 0
232// ASM: enable_sgpr_workgroup_id_y = 0
233// ASM: enable_sgpr_workgroup_id_z = 0
234// ASM: enable_sgpr_workgroup_info = 0
235// ASM: enable_vgpr_workitem_id = 0
236// ASM: enable_exception_msb = 0
237// ASM: granulated_lds_size = 0
238// ASM: enable_exception = 0
239// ASM:	enable_sgpr_private_segment_buffer = 0
240// ASM:	enable_sgpr_dispatch_ptr = 0
241// ASM:	enable_sgpr_queue_ptr = 0
242// ASM:	enable_sgpr_kernarg_segment_ptr = 1
243// ASM:	enable_sgpr_dispatch_id = 0
244// ASM:	enable_sgpr_flat_scratch_init = 0
245// ASM:	enable_sgpr_private_segment_size = 0
246// ASM:	enable_sgpr_grid_workgroup_count_x = 0
247// ASM:	enable_sgpr_grid_workgroup_count_y = 0
248// ASM:	enable_sgpr_grid_workgroup_count_z = 0
249// ASM:	enable_ordered_append_gds = 0
250// ASM:	private_element_size = 0
251// ASM:	is_ptr64 = 1
252// ASM:	is_dynamic_callstack = 0
253// ASM:	is_debug_enabled = 0
254// ASM:	is_xnack_enabled = 0
255// ASM:	workitem_private_segment_byte_size = 0
256// ASM:	workgroup_group_segment_byte_size = 0
257// ASM:	gds_segment_byte_size = 0
258// ASM:	kernarg_segment_byte_size = 16
259// ASM:	workgroup_fbarrier_count = 0
260// ASM:	wavefront_sgpr_count = 8
261// ASM:	workitem_vgpr_count = 16
262// ASM:	reserved_vgpr_first = 0
263// ASM:	reserved_vgpr_count = 0
264// ASM:	reserved_sgpr_first = 0
265// ASM:	reserved_sgpr_count = 0
266// ASM:	debug_wavefront_private_segment_offset_sgpr = 0
267// ASM:	debug_private_segment_buffer_sgpr = 0
268// ASM:	kernarg_segment_alignment = 4
269// ASM:	group_segment_alignment = 4
270// ASM:	private_segment_alignment = 4
271// ASM:	wavefront_size = 6
272// ASM:	call_convention = -1
273// ASM:	runtime_loader_kernel_symbol = 0
274// ASM: .end_amd_kernel_code_t
275