Skip to content

Commit 56b1c60

Browse files
jambormMartin Jambor
authored andcommitted
backport: hsa-builtins.def: New file.
Merge from HSA branch to trunk 2016-11-23 Martin Jambor <[email protected]> Martin Liska <[email protected]> gcc/ * hsa-builtins.def: New file. * Makefile.in (BUILTINS_DEF): Add hsa-builtins.def dependency. * builtins.def: Include hsa-builtins.def. (DEF_HSA_BUILTIN): New macro. * dumpfile.h (OPTGROUP_OPENMP): Define. * dumpfile.c (optgroup_options): Added OPTGROUP_OPENMP. * gimple.h (gf_mask): Added elements GF_OMP_FOR_GRID_INTRA_GROUP and GF_OMP_FOR_GRID_GROUP_ITER. (gimple_omp_for_grid_phony): Added checking assert. (gimple_omp_for_set_grid_phony): Likewise. (gimple_omp_for_grid_intra_group): New function. (gimple_omp_for_set_grid_intra_group): Likewise. (gimple_omp_for_grid_group_iter): Likewise. (gimple_omp_for_set_grid_group_iter): Likewise. * omp-low.c (check_omp_nesting_restrictions): Allow GRID loop where previosuly only distribute loop was permitted. (lower_lastprivate_clauses): Allow non tcc_comparison predicates. (grid_get_kernel_launch_attributes): Support multiple HSA grid dimensions. (grid_expand_omp_for_loop): Likewise and also support standalone distribute constructs. New parameter INTRA_GROUP, updated both users. (grid_expand_target_grid_body): Support standalone distribute constructs. (pass_data_expand_omp): Changed optinfo_flags to OPTGROUP_OPENMP. (pass_data_expand_omp_ssa): Likewise. (pass_data_omp_device_lower): Likewsie. (pass_data_lower_omp): Likewise. (pass_data_diagnose_omp_blocks): Likewise. (pass_data_oacc_device_lower): Likewise. (pass_data_omp_target_link): Likewise. (grid_lastprivate_predicate): New function. (lower_omp_for_lastprivate): Call grid_lastprivate_predicate for gridified loops. (lower_omp_for): Support standalone distribute constructs. (grid_prop): New type. (grid_safe_assignment_p): Check for assignments to group_sizes, new parameter GRID. (grid_seq_only_contains_local_assignments): New parameter GRID, pass it to callee. (grid_find_single_omp_among_assignments_1): Likewise, improve missed optimization info messages. (grid_find_single_omp_among_assignments): Likewise. (grid_find_ungridifiable_statement): Do not bail out for SIMDs. (grid_parallel_clauses_gridifiable): New function. (grid_inner_loop_gridifiable_p): Likewise. (grid_dist_follows_simple_pattern): Likewise. (grid_gfor_follows_tiling_pattern): Likewise. (grid_call_permissible_in_distribute_p): Likewise. (grid_handle_call_in_distribute): Likewise. (grid_dist_follows_tiling_pattern): Likewise. (grid_target_follows_gridifiable_pattern): Support standalone distribute constructs. (grid_var_segment): New enum. (grid_mark_variable_segment): New function. (grid_copy_leading_local_assignments): Call grid_mark_variable_segment if a new argument says so. (grid_process_grid_body): New function. (grid_eliminate_combined_simd_part): Likewise. (grid_mark_tiling_loops): Likewise. (grid_mark_tiling_parallels_and_loops): Likewise. (grid_process_kernel_body_copy): Support standalone distribute constructs. (grid_attempt_target_gridification): New grid variable holding overall gridification state. Support standalone distribute constructs and collapse clauses. * doc/optinfo.texi (Optimization groups): Document OPTGROUP_OPENMP. * hsa.h (hsa_bb): Add method method append_phi. (hsa_insn_br): Renamed to hsa_insn_cbr, renamed all occurences in all files too. (hsa_insn_br): New class, now the ancestor of hsa_incn_cbr. (is_a_helper <hsa_insn_br *>::test): New function. (is_a_helper <hsa_insn_cbr *>::test): Adjust to only cover conditional branch instructions. (hsa_insn_signal): Make a direct descendant of hsa_insn_basic. Add memorder constructor parameter and m_memory_order and m_signalop member variables. (hsa_insn_queue): Changed constructor parameters to common form. Added m_segment and m_memory_order member variables. (hsa_summary_t): Add private member function process_gpu_implementation_attributes. (hsa_function_summary): Rename m_binded_function to m_bound_function. (hsa_insn_basic_p): Remove typedef. (hsa_op_with_type): Change hsa_insn_basic_p into plain pointers. (hsa_op_reg_p): Remove typedef. (hsa_function_representation): Change hsa_op_reg_p into plain pointers. (hsa_insn_phi): Removed new and delete operators. (hsa_insn_br): Likewise. (hsa_insn_cbr): Likewise. (hsa_insn_sbr): Likewise. (hsa_insn_cmp): Likewise. (hsa_insn_mem): Likewise. (hsa_insn_atomic): Likewise. (hsa_insn_signal): Likewise. (hsa_insn_seg): Likewise. (hsa_insn_call): Likewise. (hsa_insn_arg_block): Likewise. (hsa_insn_comment): Likewise. (hsa_insn_srctype): Likewise. (hsa_insn_packed): Likewise. (hsa_insn_cvt): Likewise. (hsa_insn_alloca): Likewise. * hsa.c (hsa_destroy_insn): Also handle instances of hsa_insn_br. (process_gpu_implementation_attributes): New function. (link_functions): Move some functionality into it. Adjust after renaming m_binded_functions to m_bound_functions. (hsa_insn_basic::op_output_p): Add BRIG_OPCODE_DEBUGTRAP to the list of instructions with no output registers. (get_in_type): Return this if it is a register of matching size. (hsa_get_declaration_name): Moved to... * hsa-gen.c (hsa_get_declaration_name): ...here. Allocate temporary string on an obstack instead from ggc. (query_hsa_grid): Renamed to query_hsa_grid_dim, reimplemented, cut down to two overloads. (hsa_allocp_operand_address): Removed. (hsa_allocp_operand_immed): Likewise. (hsa_allocp_operand_reg): Likewise. (hsa_allocp_operand_code_list): Likewise. (hsa_allocp_operand_operand_list): Likewise. (hsa_allocp_inst_basic): Likewise. (hsa_allocp_inst_phi): Likewise. (hsa_allocp_inst_mem): Likewise. (hsa_allocp_inst_atomic): Likewise. (hsa_allocp_inst_signal): Likewise. (hsa_allocp_inst_seg): Likewise. (hsa_allocp_inst_cmp): Likewise. (hsa_allocp_inst_br): Likewise. (hsa_allocp_inst_sbr): Likewise. (hsa_allocp_inst_call): Likewise. (hsa_allocp_inst_arg_block): Likewise. (hsa_allocp_inst_comment): Likewise. (hsa_allocp_inst_queue): Likewise. (hsa_allocp_inst_srctype): Likewise. (hsa_allocp_inst_packed): Likewise. (hsa_allocp_inst_cvt): Likewise. (hsa_allocp_inst_alloca): Likewise. (hsa_allocp_bb): Likewise. (hsa_obstack): New. (hsa_init_data_for_cfun): Initialize obstack. (hsa_deinit_data_for_cfun): Release memory of the obstack. (hsa_op_immed::operator new): Use obstack instead of object_allocator. (hsa_op_reg::operator new): Likewise. (hsa_op_address::operator new): Likewise. (hsa_op_code_list::operator new): Likewise. (hsa_op_operand_list::operator new): Likewise. (hsa_insn_basic::operator new): Likewise. (hsa_insn_phi::operator new): Likewise. (hsa_insn_br::operator new): Likewise. (hsa_insn_sbr::operator new): Likewise. (hsa_insn_cmp::operator new): Likewise. (hsa_insn_mem::operator new): Likewise. (hsa_insn_atomic::operator new): Likewise. (hsa_insn_signal::operator new): Likewise. (hsa_insn_seg::operator new): Likewise. (hsa_insn_call::operator new): Likewise. (hsa_insn_arg_block::operator new): Likewise. (hsa_insn_comment::operator new): Likewise. (hsa_insn_srctype::operator new): Likewise. (hsa_insn_packed::operator new): Likewise. (hsa_insn_cvt::operator new): Likewise. (hsa_insn_alloca::operator new): Likewise. (hsa_init_new_bb): Likewise. (hsa_bb::append_phi): New function. (gen_hsa_phi_from_gimple_phi): Use it. (get_symbol_for_decl): Fix dinstinguishing between global and local functions. Put local variables into a segment according to their attribute or static flag, if there is one. (hsa_insn_br::hsa_insn_br): New. (hsa_insn_br::operator new): Likewise. (hsa_insn_cbr::hsa_insn_cbr): Set width via ancestor constructor. (query_hsa_grid_nodim): New function. (multiply_grid_dim_characteristics): Likewise. (gen_get_num_threads): Likewise. (gen_get_num_teams): Reimplemented. (gen_get_team_num): Likewise. (gen_hsa_insns_for_known_library_call): Updated calls to the above helper functions. (get_memory_order_name): Removed. (get_memory_order): Likewise. (hsa_memorder_from_tree): New function. (gen_hsa_ternary_atomic_for_builtin): Renamed to gen_hsa_atomic_for_builtin, can also create signals. (gen_hsa_insns_for_call): Handle many new builtins. Adjust to use hsa_memory_order_from_tree and gen_hsa_atomic_for_builtin. (hsa_insn_atomic): Fix function comment. (hsa_insn_signal::hsa_insn_signal): Fix comment. Update call to ancestor constructor and initialization of new member variables. (hsa_insn_queue::hsa_insn_queue): Added initialization of new member variables. (hsa_get_host_function): Handle functions with no bound CPU implementation. Fix binded to bound. (get_brig_function_name): Likewise. (HSA_SORRY_ATV): Remove semicolon after macro. (HSA_SORRY_AT): Likewise. (omp_simple_builtin::generate): Add missing semicolons. (hsa_insn_phi::operator new): Removed. (hsa_insn_br::operator new): Likewise. (hsa_insn_cbr::operator new): Likewise. (hsa_insn_sbr::operator new): Likewise. (hsa_insn_cmp::operator new): Likewise. (hsa_insn_mem::operator new): Likewise. (hsa_insn_atomic::operator new): Likewise. (hsa_insn_signal::operator new): Likewise. (hsa_insn_seg::operator new): Likewise. (hsa_insn_call::operator new): Likewise. (hsa_insn_arg_block::operator new): Likewise. (hsa_insn_comment::operator new): Likewise. (hsa_insn_srctype::operator new): Likewise. (hsa_insn_packed::operator new): Likewise. (hsa_insn_cvt::operator new): Likewise. (hsa_insn_alloca::operator new): Likewise. (get_symbol_for_decl): Accept CONST_DECLs, put them to readonly segment. (gen_hsa_addr): Also process CONST_DECLs. (gen_hsa_addr_insns): Process CONST_DECLs by creating private copies. (gen_hsa_unary_operation): Make sure the function does not use bittype source type for firstbit and lastbit operations. (gen_hsa_popcount_to_dest): Make sure the function uses a bittype source type. * hsa-brig.c (emit_insn_operands): Cope with zero operands in an instruction. (emit_branch_insn): Renamed to emit_cond_branch_insn. Emit the width stored in the class. (emit_generic_branch_insn): New function. (emit_insn): Call emit_generic_branch_insn. (emit_signal_insn): Remove obsolete comment. Update member variable name, pick a type according to profile. (emit_alloca_insn): Remove obsolete comment. (emit_atomic_insn): Likewise. (emit_queue_insn): Get segment and memory order from the IR object. (hsa_brig_section): Make allocate_new_chunk, chunks and cur_chunk provate, add a default NULL parameter to add method. (hsa_brig_section::add): Added a new parameter, store pointer to output data there if it is non-NULL. (emit_function_directives): Use this new parameter instead of calculating the pointer itself, fix function comment. (hsa_brig_emit_function): Add forgotten endian conversion. (hsa_output_kernels): Remove unnecessary building of kernel_dependencies_vector_type. (emit_immediate_operand): Declare. (emit_directive_variable): Also emit initializers of CONST_DECLs. (gen_hsa_insn_for_internal_fn_call): Also handle IFN_RSQRT. (verify_function_arguments): Properly detect variadic arguments. * hsa-dump.c (hsa_width_specifier_name): New function. (dump_hsa_insn_1): Dump generic branch instructions, update signal member variable name. Special dumping for queue objects. * ipa-hsa.c (process_hsa_functions): Adjust after renaming m_binded_functions to m_bound_functions. Copy externally visible flag to the node. (ipa_hsa_write_summary): Likewise. (ipa_hsa_read_section): Likewise. gcc/fortran/ * f95-lang.c (DEF_HSA_BUILTIN): New macro. gcc/testsuite/ * c-c++-common/gomp/gridify-1.c: Update scan string. * gfortran.dg/gomp/gridify-1.f90: Likewise. * c-c++-common/gomp/gridify-2.c: New test. * c-c++-common/gomp/gridify-3.c: Likewise. libgomp/ * testsuite/libgomp.hsa.c/bits-insns.c: New test. * testsuite/libgomp.hsa.c/tiling-1.c: Likewise. * testsuite/libgomp.hsa.c/tiling-2.c: Likewise. Co-Authored-By: Martin Liska <[email protected]> From-SVN: r242761
1 parent f6cdfe8 commit 56b1c60

File tree

26 files changed

+2996
-1045
lines changed

26 files changed

+2996
-1045
lines changed

gcc/ChangeLog

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,262 @@
1+
2016-11-23 Martin Jambor <[email protected]>
2+
Martin Liska <[email protected]>
3+
4+
* hsa-builtins.def: New file.
5+
* Makefile.in (BUILTINS_DEF): Add hsa-builtins.def dependency.
6+
* builtins.def: Include hsa-builtins.def.
7+
(DEF_HSA_BUILTIN): New macro.
8+
* dumpfile.h (OPTGROUP_OPENMP): Define.
9+
* dumpfile.c (optgroup_options): Added OPTGROUP_OPENMP.
10+
* gimple.h (gf_mask): Added elements GF_OMP_FOR_GRID_INTRA_GROUP and
11+
GF_OMP_FOR_GRID_GROUP_ITER.
12+
(gimple_omp_for_grid_phony): Added checking assert.
13+
(gimple_omp_for_set_grid_phony): Likewise.
14+
(gimple_omp_for_grid_intra_group): New function.
15+
(gimple_omp_for_set_grid_intra_group): Likewise.
16+
(gimple_omp_for_grid_group_iter): Likewise.
17+
(gimple_omp_for_set_grid_group_iter): Likewise.
18+
* omp-low.c (check_omp_nesting_restrictions): Allow GRID loop where
19+
previosuly only distribute loop was permitted.
20+
(lower_lastprivate_clauses): Allow non tcc_comparison predicates.
21+
(grid_get_kernel_launch_attributes): Support multiple HSA grid
22+
dimensions.
23+
(grid_expand_omp_for_loop): Likewise and also support standalone
24+
distribute constructs. New parameter INTRA_GROUP, updated both users.
25+
(grid_expand_target_grid_body): Support standalone distribute
26+
constructs.
27+
(pass_data_expand_omp): Changed optinfo_flags to OPTGROUP_OPENMP.
28+
(pass_data_expand_omp_ssa): Likewise.
29+
(pass_data_omp_device_lower): Likewsie.
30+
(pass_data_lower_omp): Likewise.
31+
(pass_data_diagnose_omp_blocks): Likewise.
32+
(pass_data_oacc_device_lower): Likewise.
33+
(pass_data_omp_target_link): Likewise.
34+
(grid_lastprivate_predicate): New function.
35+
(lower_omp_for_lastprivate): Call grid_lastprivate_predicate for
36+
gridified loops.
37+
(lower_omp_for): Support standalone distribute constructs.
38+
(grid_prop): New type.
39+
(grid_safe_assignment_p): Check for assignments to group_sizes, new
40+
parameter GRID.
41+
(grid_seq_only_contains_local_assignments): New parameter GRID, pass
42+
it to callee.
43+
(grid_find_single_omp_among_assignments_1): Likewise, improve missed
44+
optimization info messages.
45+
(grid_find_single_omp_among_assignments): Likewise.
46+
(grid_find_ungridifiable_statement): Do not bail out for SIMDs.
47+
(grid_parallel_clauses_gridifiable): New function.
48+
(grid_inner_loop_gridifiable_p): Likewise.
49+
(grid_dist_follows_simple_pattern): Likewise.
50+
(grid_gfor_follows_tiling_pattern): Likewise.
51+
(grid_call_permissible_in_distribute_p): Likewise.
52+
(grid_handle_call_in_distribute): Likewise.
53+
(grid_dist_follows_tiling_pattern): Likewise.
54+
(grid_target_follows_gridifiable_pattern): Support standalone distribute
55+
constructs.
56+
(grid_var_segment): New enum.
57+
(grid_mark_variable_segment): New function.
58+
(grid_copy_leading_local_assignments): Call grid_mark_variable_segment
59+
if a new argument says so.
60+
(grid_process_grid_body): New function.
61+
(grid_eliminate_combined_simd_part): Likewise.
62+
(grid_mark_tiling_loops): Likewise.
63+
(grid_mark_tiling_parallels_and_loops): Likewise.
64+
(grid_process_kernel_body_copy): Support standalone distribute
65+
constructs.
66+
(grid_attempt_target_gridification): New grid variable holding overall
67+
gridification state. Support standalone distribute constructs and
68+
collapse clauses.
69+
* doc/optinfo.texi (Optimization groups): Document OPTGROUP_OPENMP.
70+
* hsa.h (hsa_bb): Add method method append_phi.
71+
(hsa_insn_br): Renamed to hsa_insn_cbr, renamed all
72+
occurences in all files too.
73+
(hsa_insn_br): New class, now the ancestor of hsa_incn_cbr.
74+
(is_a_helper <hsa_insn_br *>::test): New function.
75+
(is_a_helper <hsa_insn_cbr *>::test): Adjust to only cover conditional
76+
branch instructions.
77+
(hsa_insn_signal): Make a direct descendant of
78+
hsa_insn_basic. Add memorder constructor parameter and
79+
m_memory_order and m_signalop member variables.
80+
(hsa_insn_queue): Changed constructor parameters to common form.
81+
Added m_segment and m_memory_order member variables.
82+
(hsa_summary_t): Add private member function
83+
process_gpu_implementation_attributes.
84+
(hsa_function_summary): Rename m_binded_function to
85+
m_bound_function.
86+
(hsa_insn_basic_p): Remove typedef.
87+
(hsa_op_with_type): Change hsa_insn_basic_p into plain pointers.
88+
(hsa_op_reg_p): Remove typedef.
89+
(hsa_function_representation): Change hsa_op_reg_p into plain
90+
pointers.
91+
(hsa_insn_phi): Removed new and delete operators.
92+
(hsa_insn_br): Likewise.
93+
(hsa_insn_cbr): Likewise.
94+
(hsa_insn_sbr): Likewise.
95+
(hsa_insn_cmp): Likewise.
96+
(hsa_insn_mem): Likewise.
97+
(hsa_insn_atomic): Likewise.
98+
(hsa_insn_signal): Likewise.
99+
(hsa_insn_seg): Likewise.
100+
(hsa_insn_call): Likewise.
101+
(hsa_insn_arg_block): Likewise.
102+
(hsa_insn_comment): Likewise.
103+
(hsa_insn_srctype): Likewise.
104+
(hsa_insn_packed): Likewise.
105+
(hsa_insn_cvt): Likewise.
106+
(hsa_insn_alloca): Likewise.
107+
* hsa.c (hsa_destroy_insn): Also handle instances of hsa_insn_br.
108+
(process_gpu_implementation_attributes): New function.
109+
(link_functions): Move some functionality into it. Adjust after
110+
renaming m_binded_functions to m_bound_functions.
111+
(hsa_insn_basic::op_output_p): Add BRIG_OPCODE_DEBUGTRAP
112+
to the list of instructions with no output registers.
113+
(get_in_type): Return this if it is a register of
114+
matching size.
115+
(hsa_get_declaration_name): Moved to...
116+
* hsa-gen.c (hsa_get_declaration_name): ...here. Allocate
117+
temporary string on an obstack instead from ggc.
118+
(query_hsa_grid): Renamed to query_hsa_grid_dim, reimplemented, cut
119+
down to two overloads.
120+
(hsa_allocp_operand_address): Removed.
121+
(hsa_allocp_operand_immed): Likewise.
122+
(hsa_allocp_operand_reg): Likewise.
123+
(hsa_allocp_operand_code_list): Likewise.
124+
(hsa_allocp_operand_operand_list): Likewise.
125+
(hsa_allocp_inst_basic): Likewise.
126+
(hsa_allocp_inst_phi): Likewise.
127+
(hsa_allocp_inst_mem): Likewise.
128+
(hsa_allocp_inst_atomic): Likewise.
129+
(hsa_allocp_inst_signal): Likewise.
130+
(hsa_allocp_inst_seg): Likewise.
131+
(hsa_allocp_inst_cmp): Likewise.
132+
(hsa_allocp_inst_br): Likewise.
133+
(hsa_allocp_inst_sbr): Likewise.
134+
(hsa_allocp_inst_call): Likewise.
135+
(hsa_allocp_inst_arg_block): Likewise.
136+
(hsa_allocp_inst_comment): Likewise.
137+
(hsa_allocp_inst_queue): Likewise.
138+
(hsa_allocp_inst_srctype): Likewise.
139+
(hsa_allocp_inst_packed): Likewise.
140+
(hsa_allocp_inst_cvt): Likewise.
141+
(hsa_allocp_inst_alloca): Likewise.
142+
(hsa_allocp_bb): Likewise.
143+
(hsa_obstack): New.
144+
(hsa_init_data_for_cfun): Initialize obstack.
145+
(hsa_deinit_data_for_cfun): Release memory of the obstack.
146+
(hsa_op_immed::operator new): Use obstack instead of object_allocator.
147+
(hsa_op_reg::operator new): Likewise.
148+
(hsa_op_address::operator new): Likewise.
149+
(hsa_op_code_list::operator new): Likewise.
150+
(hsa_op_operand_list::operator new): Likewise.
151+
(hsa_insn_basic::operator new): Likewise.
152+
(hsa_insn_phi::operator new): Likewise.
153+
(hsa_insn_br::operator new): Likewise.
154+
(hsa_insn_sbr::operator new): Likewise.
155+
(hsa_insn_cmp::operator new): Likewise.
156+
(hsa_insn_mem::operator new): Likewise.
157+
(hsa_insn_atomic::operator new): Likewise.
158+
(hsa_insn_signal::operator new): Likewise.
159+
(hsa_insn_seg::operator new): Likewise.
160+
(hsa_insn_call::operator new): Likewise.
161+
(hsa_insn_arg_block::operator new): Likewise.
162+
(hsa_insn_comment::operator new): Likewise.
163+
(hsa_insn_srctype::operator new): Likewise.
164+
(hsa_insn_packed::operator new): Likewise.
165+
(hsa_insn_cvt::operator new): Likewise.
166+
(hsa_insn_alloca::operator new): Likewise.
167+
(hsa_init_new_bb): Likewise.
168+
(hsa_bb::append_phi): New function.
169+
(gen_hsa_phi_from_gimple_phi): Use it.
170+
(get_symbol_for_decl): Fix dinstinguishing between
171+
global and local functions. Put local variables into a segment
172+
according to their attribute or static flag, if there is one.
173+
(hsa_insn_br::hsa_insn_br): New.
174+
(hsa_insn_br::operator new): Likewise.
175+
(hsa_insn_cbr::hsa_insn_cbr): Set width via ancestor constructor.
176+
(query_hsa_grid_nodim): New function.
177+
(multiply_grid_dim_characteristics): Likewise.
178+
(gen_get_num_threads): Likewise.
179+
(gen_get_num_teams): Reimplemented.
180+
(gen_get_team_num): Likewise.
181+
(gen_hsa_insns_for_known_library_call): Updated calls to the above
182+
helper functions.
183+
(get_memory_order_name): Removed.
184+
(get_memory_order): Likewise.
185+
(hsa_memorder_from_tree): New function.
186+
(gen_hsa_ternary_atomic_for_builtin): Renamed to
187+
gen_hsa_atomic_for_builtin, can also create signals.
188+
(gen_hsa_insns_for_call): Handle many new builtins. Adjust to use
189+
hsa_memory_order_from_tree and gen_hsa_atomic_for_builtin.
190+
(hsa_insn_atomic): Fix function comment.
191+
(hsa_insn_signal::hsa_insn_signal): Fix comment. Update call to
192+
ancestor constructor and initialization of new member variables.
193+
(hsa_insn_queue::hsa_insn_queue): Added initialization of new
194+
member variables.
195+
(hsa_get_host_function): Handle functions with no bound CPU
196+
implementation. Fix binded to bound.
197+
(get_brig_function_name): Likewise.
198+
(HSA_SORRY_ATV): Remove semicolon after macro.
199+
(HSA_SORRY_AT): Likewise.
200+
(omp_simple_builtin::generate): Add missing semicolons.
201+
(hsa_insn_phi::operator new): Removed.
202+
(hsa_insn_br::operator new): Likewise.
203+
(hsa_insn_cbr::operator new): Likewise.
204+
(hsa_insn_sbr::operator new): Likewise.
205+
(hsa_insn_cmp::operator new): Likewise.
206+
(hsa_insn_mem::operator new): Likewise.
207+
(hsa_insn_atomic::operator new): Likewise.
208+
(hsa_insn_signal::operator new): Likewise.
209+
(hsa_insn_seg::operator new): Likewise.
210+
(hsa_insn_call::operator new): Likewise.
211+
(hsa_insn_arg_block::operator new): Likewise.
212+
(hsa_insn_comment::operator new): Likewise.
213+
(hsa_insn_srctype::operator new): Likewise.
214+
(hsa_insn_packed::operator new): Likewise.
215+
(hsa_insn_cvt::operator new): Likewise.
216+
(hsa_insn_alloca::operator new): Likewise.
217+
(get_symbol_for_decl): Accept CONST_DECLs, put them to
218+
readonly segment.
219+
(gen_hsa_addr): Also process CONST_DECLs.
220+
(gen_hsa_addr_insns): Process CONST_DECLs by creating private
221+
copies.
222+
(gen_hsa_unary_operation): Make sure the function does
223+
not use bittype source type for firstbit and lastbit operations.
224+
(gen_hsa_popcount_to_dest): Make sure the function uses a bittype
225+
source type.
226+
* hsa-brig.c (emit_insn_operands): Cope with zero operands in an
227+
instruction.
228+
(emit_branch_insn): Renamed to emit_cond_branch_insn.
229+
Emit the width stored in the class.
230+
(emit_generic_branch_insn): New function.
231+
(emit_insn): Call emit_generic_branch_insn.
232+
(emit_signal_insn): Remove obsolete comment. Update
233+
member variable name, pick a type according to profile.
234+
(emit_alloca_insn): Remove obsolete comment.
235+
(emit_atomic_insn): Likewise.
236+
(emit_queue_insn): Get segment and memory order from the IR object.
237+
(hsa_brig_section): Make allocate_new_chunk, chunks
238+
and cur_chunk provate, add a default NULL parameter to add method.
239+
(hsa_brig_section::add): Added a new parameter, store pointer to
240+
output data there if it is non-NULL.
241+
(emit_function_directives): Use this new parameter instead of
242+
calculating the pointer itself, fix function comment.
243+
(hsa_brig_emit_function): Add forgotten endian conversion.
244+
(hsa_output_kernels): Remove unnecessary building of
245+
kernel_dependencies_vector_type.
246+
(emit_immediate_operand): Declare.
247+
(emit_directive_variable): Also emit initializers of CONST_DECLs.
248+
(gen_hsa_insn_for_internal_fn_call): Also handle IFN_RSQRT.
249+
(verify_function_arguments): Properly detect variadic
250+
arguments.
251+
* hsa-dump.c (hsa_width_specifier_name): New function.
252+
(dump_hsa_insn_1): Dump generic branch instructions, update signal
253+
member variable name. Special dumping for queue objects.
254+
* ipa-hsa.c (process_hsa_functions): Adjust after renaming
255+
m_binded_functions to m_bound_functions. Copy externally visible flag
256+
to the node.
257+
(ipa_hsa_write_summary): Likewise.
258+
(ipa_hsa_read_section): Likewise.
259+
1260
2016-11-23 Richard Biener <[email protected]>
2261

3262
PR tree-optimization/78396

gcc/Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,8 @@ RTL_H = $(RTL_BASE_H) $(FLAGS_H) genrtl.h
911911
READ_MD_H = $(OBSTACK_H) $(HASHTAB_H) read-md.h
912912
PARAMS_H = params.h params-enum.h params.def
913913
BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def \
914-
gtm-builtins.def sanitizer.def cilkplus.def cilk-builtins.def
914+
gtm-builtins.def sanitizer.def cilkplus.def cilk-builtins.def \
915+
hsa-builtins.def
915916
INTERNAL_FN_DEF = internal-fn.def
916917
INTERNAL_FN_H = internal-fn.h $(INTERNAL_FN_DEF)
917918
TREE_CORE_H = tree-core.h coretypes.h all-tree.def tree.def \

gcc/builtins.def

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ along with GCC; see the file COPYING3. If not see
201201
|| flag_cilkplus \
202202
|| flag_offload_abi != OFFLOAD_ABI_UNSET))
203203

204+
#undef DEF_HSA_BUILTIN
205+
#ifdef ENABLE_HSA
206+
#define DEF_HSA_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
207+
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
208+
false, false, true, ATTRS, false, \
209+
(!flag_disable_hsa))
210+
#else
211+
#define DEF_HSA_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
212+
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
213+
false, false, true, ATTRS, false, \
214+
(false))
215+
#endif
216+
204217
/* Builtin used by implementation of Cilk Plus. Most of these are decomposed
205218
by the compiler but a few are implemented in libcilkrts. */
206219
#undef DEF_CILK_BUILTIN_STUB
@@ -968,6 +981,9 @@ DEF_GCC_BUILTIN (BUILT_IN_LINE, "LINE", BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
968981
/* Offloading and Multi Processing builtins. */
969982
#include "omp-builtins.def"
970983

984+
/* Heterogeneous Systems Architecture. */
985+
#include "hsa-builtins.def"
986+
971987
/* Cilk keywords builtins. */
972988
#include "cilk-builtins.def"
973989

gcc/doc/optinfo.texi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Loop optimization passes. Enabled by @option{-loop}.
5959
@item OPTGROUP_INLINE
6060
Inlining passes. Enabled by @option{-inline}.
6161

62+
@item OPTGROUP_OPENMP
63+
OpenMP passes. Enabled by @option{-openmp}.
64+
6265
@item OPTGROUP_VEC
6366
Vectorization passes. Enabled by @option{-vec}.
6467

gcc/dumpfile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ static const struct dump_option_value_info optgroup_options[] =
138138
{"ipa", OPTGROUP_IPA},
139139
{"loop", OPTGROUP_LOOP},
140140
{"inline", OPTGROUP_INLINE},
141+
{"openmp", OPTGROUP_OPENMP},
141142
{"vec", OPTGROUP_VEC},
142143
{"optall", OPTGROUP_ALL},
143144
{NULL, 0}

gcc/dumpfile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ enum tree_dump_index
9898
#define OPTGROUP_LOOP (1 << 2) /* Loop optimization passes */
9999
#define OPTGROUP_INLINE (1 << 3) /* Inlining passes */
100100
#define OPTGROUP_VEC (1 << 4) /* Vectorization passes */
101-
#define OPTGROUP_OTHER (1 << 5) /* All other passes */
101+
#define OPTGROUP_OPENMP (1 << 5) /* OpenMP specific transformations */
102+
#define OPTGROUP_OTHER (1 << 6) /* All other passes */
102103
#define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
103104
| OPTGROUP_VEC | OPTGROUP_OTHER)
104105

gcc/fortran/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2016-11-23 Martin Jambor <[email protected]>
2+
3+
* f95-lang.c (DEF_HSA_BUILTIN): New macro.
4+
15
2016-11-22 Steven G. Kargl <[email protected]>
26

37
PR fortran/78479

gcc/fortran/f95-lang.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,17 @@ gfc_init_builtin_functions (void)
12241224
#undef DEF_GOMP_BUILTIN
12251225
}
12261226

1227+
#ifdef ENABLE_HSA
1228+
if (!flag_disable_hsa)
1229+
{
1230+
#undef DEF_HSA_BUILTIN
1231+
#define DEF_HSA_BUILTIN(code, name, type, attr) \
1232+
gfc_define_builtin ("__builtin_" name, builtin_types[type], \
1233+
code, name, attr);
1234+
#include "../hsa-builtins.def"
1235+
}
1236+
#endif
1237+
12271238
gfc_define_builtin ("__builtin_trap", builtin_types[BT_FN_VOID],
12281239
BUILT_IN_TRAP, NULL, ATTR_NOTHROW_LEAF_LIST);
12291240
TREE_THIS_VOLATILE (builtin_decl_explicit (BUILT_IN_TRAP)) = 1;

0 commit comments

Comments
 (0)