[nvptx] Handle large vector reductions

Programming / Compilers / GCC - vries [138bc75d-0d04-0410-961f-82ee72b054a4] - 7 January 2019 08:11 EST

Add support for vector reductions with openacc vector_length larger than warp-size.

2019-01-07 Tom de Vries

- config/nvptx/nvptx-protos.h (nvptx_output_red_partition): Declare.
- config/nvptx/nvptx.c (vector_red_size, vector_red_align,
vector_red_partition, vector_red_sym): New global variables. (nvptx_option_override): Initialize vector_red_sym. (nvptx_declare_function_name): Restore red_partition register. (nvptx_file_end): Emit code to declare the vector reduction variables. (nvptx_output_red_partition): New function. (nvptx_expand_shared_addr): Add vector argument. Use it to handle large vector reductions. (enum nvptx_builtins): Add NVPTX_BUILTIN_VECTOR_ADDR. (nvptx_init_builtins): Add VECTOR_ADDR. (nvptx_expand_builtin): Update call to nvptx_expand_shared_addr. Handle nvptx_expand_shared_addr. (nvptx_get_shared_red_addr): Add vector argument and handle large
vectors. (nvptx_goacc_reduction_setup): Add offload_attrs argument and handle large vectors. (nvptx_goacc_reduction_init): Likewise. (nvptx_goacc_reduction_fini): Likewise. (nvptx_goacc_reduction_teardown): Likewise. (nvptx_goacc_reduction): Update calls to nvptx_goacc_reduction_{setup, init,fini,teardown}. (nvptx_init_axis_predicate): Initialize vector_red_partition. (nvptx_set_current_function): Init vector_red_partition.
- config/nvptx/nvptx.md (UNSPECV_RED_PART): New unspecv. (nvptx_red_partition): New insn.
- config/nvptx/nvptx.h (struct machine_function): Add red_partition.

ed42202dbc7 [nvptx] Handle large vector reductions
gcc/ChangeLog | 30 ++++++++
gcc/config/nvptx/nvptx-protos.h | 1 +
gcc/config/nvptx/nvptx.c | 154 ++++++++++++++++++++++++++++++++--------
gcc/config/nvptx/nvptx.h | 2 +
gcc/config/nvptx/nvptx.md | 12 ++++
5 files changed, 170 insertions(+), 29 deletions(-)

Upstream: gcc.gnu.org


  • Share