16 #define QNAME(name) amd_kernel_code_t::name 17 #define FLD_T(name) decltype(QNAME(name)), &QNAME(name) 19 #define FIELD2(sname, aname, name) \ 20 RECORD(sname, aname, printField<FLD_T(name)>, parseField<FLD_T(name)>) 22 #define FIELD(name) FIELD2(name, name, name) 25 #define PRINTCODEPROP(name) \ 26 printBitField<FLD_T(code_properties),\ 27 AMD_CODE_PROPERTY_##name##_SHIFT,\ 28 AMD_CODE_PROPERTY_##name##_WIDTH> 30 #define PARSECODEPROP(name) \ 31 parseBitField<FLD_T(code_properties),\ 32 AMD_CODE_PROPERTY_##name##_SHIFT,\ 33 AMD_CODE_PROPERTY_##name##_WIDTH> 35 #define CODEPROP(name, shift) \ 36 RECORD(name, name, PRINTCODEPROP(shift), PARSECODEPROP(shift)) 39 #define PRINTCOMP(GetMacro, Shift) \ 40 [](StringRef Name, const amd_kernel_code_t &C, raw_ostream &OS) { \ 41 printName(OS, Name) << \ 42 (int)GetMacro(C.compute_pgm_resource_registers >> Shift); \ 44 #define PARSECOMP(SetMacro, Shift) \ 45 [](amd_kernel_code_t &C, MCAsmParser &MCParser, raw_ostream &Err) { \ 47 if (!expectAbsExpression(MCParser, Value, Err)) \ 49 C.compute_pgm_resource_registers &= ~(SetMacro(0xFFFFFFFFFFFFFFFFULL) << Shift); \ 50 C.compute_pgm_resource_registers |= SetMacro(Value) << Shift; \ 54 #define COMPPGM(name, aname, GetMacro, SetMacro, Shift) \ 55 RECORD(name, aname, PRINTCOMP(GetMacro, Shift), PARSECOMP(SetMacro, Shift)) 57 #define COMPPGM1(name, aname, AccMacro) \ 58 COMPPGM(name, aname, G_00B848_##AccMacro, S_00B848_##AccMacro, 0) 60 #define COMPPGM2(name, aname, AccMacro) \ 61 COMPPGM(name, aname, G_00B84C_##AccMacro, S_00B84C_##AccMacro, 32) 68 FIELD2(amd_code_version_major, kernel_code_version_major, amd_kernel_code_version_major),
69 FIELD2(amd_code_version_minor, kernel_code_version_minor, amd_kernel_code_version_minor),
70 FIELD2(amd_machine_kind, machine_kind, amd_machine_kind),
71 FIELD2(amd_machine_version_major, machine_version_major, amd_machine_version_major),
72 FIELD2(amd_machine_version_minor, machine_version_minor, amd_machine_version_minor),
73 FIELD2(amd_machine_version_stepping, machine_version_stepping, amd_machine_version_stepping),
75 FIELD(kernel_code_entry_byte_offset),
76 FIELD(kernel_code_prefetch_byte_size),
78 COMPPGM1(granulated_workitem_vgpr_count, compute_pgm_rsrc1_vgprs, VGPRS),
79 COMPPGM1(granulated_wavefront_sgpr_count, compute_pgm_rsrc1_sgprs, SGPRS),
80 COMPPGM1(priority, compute_pgm_rsrc1_priority, PRIORITY),
81 COMPPGM1(float_mode, compute_pgm_rsrc1_float_mode, FLOAT_MODE),
82 COMPPGM1(priv, compute_pgm_rsrc1_priv, PRIV),
83 COMPPGM1(enable_dx10_clamp, compute_pgm_rsrc1_dx10_clamp, DX10_CLAMP),
84 COMPPGM1(debug_mode, compute_pgm_rsrc1_debug_mode, DEBUG_MODE),
85 COMPPGM1(enable_ieee_mode, compute_pgm_rsrc1_ieee_mode, IEEE_MODE),
88 COMPPGM2(enable_sgpr_private_segment_wave_byte_offset, compute_pgm_rsrc2_scratch_en, SCRATCH_EN),
89 COMPPGM2(user_sgpr_count, compute_pgm_rsrc2_user_sgpr, USER_SGPR),
90 COMPPGM2(enable_trap_handler, compute_pgm_rsrc2_trap_handler, TRAP_HANDLER),
91 COMPPGM2(enable_sgpr_workgroup_id_x, compute_pgm_rsrc2_tgid_x_en, TGID_X_EN),
92 COMPPGM2(enable_sgpr_workgroup_id_y, compute_pgm_rsrc2_tgid_y_en, TGID_Y_EN),
93 COMPPGM2(enable_sgpr_workgroup_id_z, compute_pgm_rsrc2_tgid_z_en, TGID_Z_EN),
94 COMPPGM2(enable_sgpr_workgroup_info, compute_pgm_rsrc2_tg_size_en, TG_SIZE_EN),
95 COMPPGM2(enable_vgpr_workitem_id, compute_pgm_rsrc2_tidig_comp_cnt, TIDIG_COMP_CNT),
96 COMPPGM2(enable_exception_msb, compute_pgm_rsrc2_excp_en_msb, EXCP_EN_MSB),
97 COMPPGM2(granulated_lds_size, compute_pgm_rsrc2_lds_size, LDS_SIZE),
98 COMPPGM2(enable_exception, compute_pgm_rsrc2_excp_en, EXCP_EN),
100 CODEPROP(enable_sgpr_private_segment_buffer, ENABLE_SGPR_PRIVATE_SEGMENT_BUFFER),
101 CODEPROP(enable_sgpr_dispatch_ptr, ENABLE_SGPR_DISPATCH_PTR),
102 CODEPROP(enable_sgpr_queue_ptr, ENABLE_SGPR_QUEUE_PTR),
103 CODEPROP(enable_sgpr_kernarg_segment_ptr, ENABLE_SGPR_KERNARG_SEGMENT_PTR),
104 CODEPROP(enable_sgpr_dispatch_id, ENABLE_SGPR_DISPATCH_ID),
105 CODEPROP(enable_sgpr_flat_scratch_init, ENABLE_SGPR_FLAT_SCRATCH_INIT),
106 CODEPROP(enable_sgpr_private_segment_size, ENABLE_SGPR_PRIVATE_SEGMENT_SIZE),
107 CODEPROP(enable_sgpr_grid_workgroup_count_x, ENABLE_SGPR_GRID_WORKGROUP_COUNT_X),
108 CODEPROP(enable_sgpr_grid_workgroup_count_y, ENABLE_SGPR_GRID_WORKGROUP_COUNT_Y),
109 CODEPROP(enable_sgpr_grid_workgroup_count_z, ENABLE_SGPR_GRID_WORKGROUP_COUNT_Z),
110 CODEPROP(enable_ordered_append_gds, ENABLE_ORDERED_APPEND_GDS),
111 CODEPROP(private_element_size, PRIVATE_ELEMENT_SIZE),
113 CODEPROP(is_dynamic_callstack, IS_DYNAMIC_CALLSTACK),
114 CODEPROP(is_debug_enabled, IS_DEBUG_SUPPORTED),
115 CODEPROP(is_xnack_enabled, IS_XNACK_SUPPORTED),
117 FIELD(workitem_private_segment_byte_size),
118 FIELD(workgroup_group_segment_byte_size),
119 FIELD(gds_segment_byte_size),
120 FIELD(kernarg_segment_byte_size),
121 FIELD(workgroup_fbarrier_count),
122 FIELD(wavefront_sgpr_count),
123 FIELD(workitem_vgpr_count),
124 FIELD(reserved_vgpr_first),
125 FIELD(reserved_vgpr_count),
126 FIELD(reserved_sgpr_first),
127 FIELD(reserved_sgpr_count),
128 FIELD(debug_wavefront_private_segment_offset_sgpr),
129 FIELD(debug_private_segment_buffer_sgpr),
130 FIELD(kernarg_segment_alignment),
131 FIELD(group_segment_alignment),
132 FIELD(private_segment_alignment),
133 FIELD(wavefront_size),
134 FIELD(call_convention),
135 FIELD(runtime_loader_kernel_symbol)
#define COMPPGM2(name, aname, AccMacro)
#define CODEPROP(name, shift)
#define COMPPGM1(name, aname, AccMacro)
#define FIELD2(sname, aname, name)