gcc/gcc/config/nvptx/nvptx.opt

149 lines
3.6 KiB
Plaintext
Raw Normal View History

; Options for the NVPTX port
2022-01-03 10:42:10 +01:00
; Copyright (C) 2014-2022 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
; GCC is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free
; Software Foundation; either version 3, or (at your option) any later
; version.
;
; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
; WARRANTY; without even the implied warranty of MERCHANTABILITY or
; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
; for more details.
;
; You should have received a copy of the GNU General Public License
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
; It's not clear whether this was ever build/tested/used, so this is no longer
; exposed to the user.
;m32
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
;Target RejectNegative InverseMask(ABI64)
;Generate code for a 32-bit ABI.
m64
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target RejectNegative Mask(ABI64)
Ignored, but preserved for backward compatibility. Only 64-bit ABI is
supported.
mmainkernel
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target RejectNegative
Link in code for a __main kernel.
moptimize
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target Var(nvptx_optimize) Init(-1)
Optimize partition neutering.
nvptx backend prerequisites for OpenMP offloading gcc/ * config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP is selected. Pass -mgomp to offload compiler in OpenMP case. * config/nvptx/nvptx-protos.h (nvptx_shuffle_kind): Move enum declaration from nvptx.c. (nvptx_gen_shuffle): Declare. (nvptx_output_set_softstack): Declare. * config/nvptx/nvptx.c (nvptx_shuffle_kind): Move to nvptx-protos.h. (need_softstack_decl): New variable. (need_unisimt_decl): New variable. (diagnose_openacc_conflict): New. Use it... (nvptx_option_override): ...here. Handle TARGET_GOMP. (nvptx_encode_section_info): Handle "shared" attribute. (write_as_kernel): Restrict to OpenACC target regions. (init_softstack_frame): New. (nvptx_init_unisimt_predicate): New. (write_omp_entry): New. Use it... (nvptx_declare_function_name): ...here to emit OpenMP target region entrypoints. Handle TARGET_SOFT_STACK. Call nvptx_init_unisimt_predicate. (nvptx_output_set_softstack): New. (nvptx_get_drap_rtx): Return %argp as the DRAP if needed. (nvptx_gen_shuffle): Export. (nvptx_output_call_insn): Handle COND_EXEC patterns. Emit instruction predicate. (nvptx_print_operand): Fix handling of instruction predicates. (nvptx_get_unisimt_master): New helper function. (nvptx_get_unisimt_predicate): Ditto. (nvptx_call_insn_is_syscall_p): Ditto. (nvptx_unisimt_handle_set): Ditto. (nvptx_reorg_uniform_simt): New. Transform code for -muniform-simt. (nvptx_reorg): Call nvptx_reorg_uniform_simt. (nvptx_handle_shared_attribute): New. Use it... (nvptx_attribute_table): ... here (new entry). (nvptx_record_offload_symbol): Handle NULL attributes. (nvptx_file_end): Handle need_softstack_decl and need_unisimt_decl. (nvptx_simt_vf): New. (TARGET_SIMT_VF): Define. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Define __nvptx_softstack or __nvptx_unisimt__ when -msoft-stack, or resp. -muniform-simt option is active. (STACK_SIZE_MODE): Define. (FIXED_REGISTERS): Adjust. (SOFTSTACK_SLOT_REGNUM): New. (SOFTSTACK_PREV_REGNUM): New. (REGISTER_NAMES): Adjust. (struct machine_function): New fields. * config/nvptx/nvptx.md (UNSPEC_SET_SOFTSTACK): New. (UNSPEC_VOTE_BALLOT): Ditto. (UNSPEC_LANEID): Ditto. (UNSPECV_NOUNROLL): Ditto. (atomic): New attribute. (predicable): New attribute. Generate predicated forms via define_cond_exec. (br_true): Mark as not predicable. (br_false): Ditto. (br_true_uni): Ditto. (br_false_uni): Ditto. (return): Ditto. (trap_if_true): Ditto. (trap_if_false): Ditto. (nvptx_fork): Ditto. (nvptx_forked): Ditto. (nvptx_joining): Ditto. (nvptx_join): Ditto. (nvptx_barsync): Ditto. (epilogue): Emit stack restore if TARGET_SOFT_STACK. (allocate_stack): Implement for TARGET_SOFT_STACK. Remove unused code. (allocate_stack_<mode>): Remove unused pattern. (set_softstack_insn): New pattern. (restore_stack_block): Handle for TARGET_SOFT_STACK. (nvptx_vote_ballot): New pattern. (omp_simt_lane): Ditto. (omp_simt_last_lane): Ditto. (omp_simt_ordered): Ditto. (omp_simt_vote_any): Ditto. (omp_simt_xchg_bfly): Ditto. (omp_simt_xchg_idx): Ditto. (nvptx_nounroll): Ditto. (atomic_compare_and_swap<mode>_1): Mark with atomic attribute. (atomic_exchange<mode>): Ditto. (atomic_fetch_add<mode>): Ditto. (atomic_fetch_addsf): Ditto. (atomic_fetch_<logic><mode>): Ditto. * config/nvptx/nvptx.opt: (msoft-stack): New option. (muniform-simt): Ditto. (mgomp): Ditto. * config/nvptx/t-nvptx (MULTILIB_OPTIONS): New. * doc/extend.texi (Nvidia PTX Variable Attributes): New section. * doc/invoke.texi (msoft-stack): Document. (muniform-simt): Document (mgomp): Document. * doc/tm.texi: Regenerate. * doc/tm.texi.in: (TARGET_SIMT_VF): New hook. * target.def: Define it. * target-insns.def (omp_simt_lane): New. (omp_simt_last_lane): New. (omp_simt_ordered): New. (omp_simt_vote_any): New. (omp_simt_xchg_bfly): New. (omp_simt_xchg_idx): New. libgcc/ * config/nvptx/crt0.c (__main): Setup __nvptx_stacks and __nvptx_uni. * config/nvptx/mgomp.c: New file. * config/nvptx/t-nvptx: Add mgomp.c gcc/testsuite/ * lib/target-supports.exp (check_effective_target_alloca): Use a compile test. * gcc.target/nvptx/softstack.c: New test. * gcc.target/nvptx/decl-shared.c: New test. * gcc.target/nvptx/decl-shared-init.c: New test. From-SVN: r242503
2016-11-16 18:17:00 +01:00
msoft-stack
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target Mask(SOFT_STACK)
nvptx backend prerequisites for OpenMP offloading gcc/ * config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP is selected. Pass -mgomp to offload compiler in OpenMP case. * config/nvptx/nvptx-protos.h (nvptx_shuffle_kind): Move enum declaration from nvptx.c. (nvptx_gen_shuffle): Declare. (nvptx_output_set_softstack): Declare. * config/nvptx/nvptx.c (nvptx_shuffle_kind): Move to nvptx-protos.h. (need_softstack_decl): New variable. (need_unisimt_decl): New variable. (diagnose_openacc_conflict): New. Use it... (nvptx_option_override): ...here. Handle TARGET_GOMP. (nvptx_encode_section_info): Handle "shared" attribute. (write_as_kernel): Restrict to OpenACC target regions. (init_softstack_frame): New. (nvptx_init_unisimt_predicate): New. (write_omp_entry): New. Use it... (nvptx_declare_function_name): ...here to emit OpenMP target region entrypoints. Handle TARGET_SOFT_STACK. Call nvptx_init_unisimt_predicate. (nvptx_output_set_softstack): New. (nvptx_get_drap_rtx): Return %argp as the DRAP if needed. (nvptx_gen_shuffle): Export. (nvptx_output_call_insn): Handle COND_EXEC patterns. Emit instruction predicate. (nvptx_print_operand): Fix handling of instruction predicates. (nvptx_get_unisimt_master): New helper function. (nvptx_get_unisimt_predicate): Ditto. (nvptx_call_insn_is_syscall_p): Ditto. (nvptx_unisimt_handle_set): Ditto. (nvptx_reorg_uniform_simt): New. Transform code for -muniform-simt. (nvptx_reorg): Call nvptx_reorg_uniform_simt. (nvptx_handle_shared_attribute): New. Use it... (nvptx_attribute_table): ... here (new entry). (nvptx_record_offload_symbol): Handle NULL attributes. (nvptx_file_end): Handle need_softstack_decl and need_unisimt_decl. (nvptx_simt_vf): New. (TARGET_SIMT_VF): Define. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Define __nvptx_softstack or __nvptx_unisimt__ when -msoft-stack, or resp. -muniform-simt option is active. (STACK_SIZE_MODE): Define. (FIXED_REGISTERS): Adjust. (SOFTSTACK_SLOT_REGNUM): New. (SOFTSTACK_PREV_REGNUM): New. (REGISTER_NAMES): Adjust. (struct machine_function): New fields. * config/nvptx/nvptx.md (UNSPEC_SET_SOFTSTACK): New. (UNSPEC_VOTE_BALLOT): Ditto. (UNSPEC_LANEID): Ditto. (UNSPECV_NOUNROLL): Ditto. (atomic): New attribute. (predicable): New attribute. Generate predicated forms via define_cond_exec. (br_true): Mark as not predicable. (br_false): Ditto. (br_true_uni): Ditto. (br_false_uni): Ditto. (return): Ditto. (trap_if_true): Ditto. (trap_if_false): Ditto. (nvptx_fork): Ditto. (nvptx_forked): Ditto. (nvptx_joining): Ditto. (nvptx_join): Ditto. (nvptx_barsync): Ditto. (epilogue): Emit stack restore if TARGET_SOFT_STACK. (allocate_stack): Implement for TARGET_SOFT_STACK. Remove unused code. (allocate_stack_<mode>): Remove unused pattern. (set_softstack_insn): New pattern. (restore_stack_block): Handle for TARGET_SOFT_STACK. (nvptx_vote_ballot): New pattern. (omp_simt_lane): Ditto. (omp_simt_last_lane): Ditto. (omp_simt_ordered): Ditto. (omp_simt_vote_any): Ditto. (omp_simt_xchg_bfly): Ditto. (omp_simt_xchg_idx): Ditto. (nvptx_nounroll): Ditto. (atomic_compare_and_swap<mode>_1): Mark with atomic attribute. (atomic_exchange<mode>): Ditto. (atomic_fetch_add<mode>): Ditto. (atomic_fetch_addsf): Ditto. (atomic_fetch_<logic><mode>): Ditto. * config/nvptx/nvptx.opt: (msoft-stack): New option. (muniform-simt): Ditto. (mgomp): Ditto. * config/nvptx/t-nvptx (MULTILIB_OPTIONS): New. * doc/extend.texi (Nvidia PTX Variable Attributes): New section. * doc/invoke.texi (msoft-stack): Document. (muniform-simt): Document (mgomp): Document. * doc/tm.texi: Regenerate. * doc/tm.texi.in: (TARGET_SIMT_VF): New hook. * target.def: Define it. * target-insns.def (omp_simt_lane): New. (omp_simt_last_lane): New. (omp_simt_ordered): New. (omp_simt_vote_any): New. (omp_simt_xchg_bfly): New. (omp_simt_xchg_idx): New. libgcc/ * config/nvptx/crt0.c (__main): Setup __nvptx_stacks and __nvptx_uni. * config/nvptx/mgomp.c: New file. * config/nvptx/t-nvptx: Add mgomp.c gcc/testsuite/ * lib/target-supports.exp (check_effective_target_alloca): Use a compile test. * gcc.target/nvptx/softstack.c: New test. * gcc.target/nvptx/decl-shared.c: New test. * gcc.target/nvptx/decl-shared-init.c: New test. From-SVN: r242503
2016-11-16 18:17:00 +01:00
Use custom stacks instead of local memory for automatic storage.
msoft-stack-reserve-local=
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target Joined RejectNegative UInteger Var(nvptx_softstack_size) Init(128)
OpenMP/PTX privatization in SIMD regions * config/nvptx/nvptx-protos.h (nvptx_output_simt_enter): Declare. (nvptx_output_simt_exit): Declare. * config/nvptx/nvptx.c (nvptx_init_unisimt_predicate): Use cfun->machine->unisimt_location. Handle NULL unisimt_predicate. (init_softstack_frame): Move initialization of crtl->is_leaf to... (nvptx_declare_function_name): ...here. Emit declaration of local memory space buffer for omp_simt_enter insn. (nvptx_output_unisimt_switch): New. (nvptx_output_softstack_switch): New. (nvptx_output_simt_enter): New. (nvptx_output_simt_exit): New. * config/nvptx/nvptx.h (struct machine_function): New fields has_simtreg, unisimt_location, simt_stack_size, simt_stack_align. * config/nvptx/nvptx.md (UNSPECV_SIMT_ENTER): New unspec. (UNSPECV_SIMT_EXIT): Ditto. (omp_simt_enter_insn): New insn. (omp_simt_enter): New expansion. (omp_simt_exit): New insn. * config/nvptx/nvptx.opt (msoft-stack-reserve-local): New option. * internal-fn.c (expand_GOMP_SIMT_ENTER): New. (expand_GOMP_SIMT_ENTER_ALLOC): New. (expand_GOMP_SIMT_EXIT): New. * internal-fn.def (GOMP_SIMT_ENTER): New internal function. (GOMP_SIMT_ENTER_ALLOC): Ditto. (GOMP_SIMT_EXIT): Ditto. * target-insns.def (omp_simt_enter): New insn. (omp_simt_exit): Ditto. * omp-low.c (struct omplow_simd_context): New fields simt_eargs, simt_dlist. (lower_rec_simd_input_clauses): Implement SIMT privatization. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Handle SIMT privatization. * omp-offload.c: Include langhooks.h, tree-nested.h, stor-layout.h. (ompdevlow_adjust_simt_enter): New. (find_simtpriv_var_op): New. (execute_omp_device_lower): Handle IFN_GOMP_SIMT_ENTER, IFN_GOMP_SIMT_ENTER_ALLOC, IFN_GOMP_SIMT_EXIT. * tree-inline.h (struct copy_body_data): New field dst_simt_vars. * tree-inline.c (expand_call_inline): Handle SIMT privatization. (copy_decl_for_dup_finish): Ditto. * tree-ssa.c (execute_update_addresses_taken): Handle GOMP_SIMT_ENTER. From-SVN: r246550
2017-03-28 19:24:57 +02:00
Specify size of .local memory used for stack when the exact amount is not known.
nvptx backend prerequisites for OpenMP offloading gcc/ * config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP is selected. Pass -mgomp to offload compiler in OpenMP case. * config/nvptx/nvptx-protos.h (nvptx_shuffle_kind): Move enum declaration from nvptx.c. (nvptx_gen_shuffle): Declare. (nvptx_output_set_softstack): Declare. * config/nvptx/nvptx.c (nvptx_shuffle_kind): Move to nvptx-protos.h. (need_softstack_decl): New variable. (need_unisimt_decl): New variable. (diagnose_openacc_conflict): New. Use it... (nvptx_option_override): ...here. Handle TARGET_GOMP. (nvptx_encode_section_info): Handle "shared" attribute. (write_as_kernel): Restrict to OpenACC target regions. (init_softstack_frame): New. (nvptx_init_unisimt_predicate): New. (write_omp_entry): New. Use it... (nvptx_declare_function_name): ...here to emit OpenMP target region entrypoints. Handle TARGET_SOFT_STACK. Call nvptx_init_unisimt_predicate. (nvptx_output_set_softstack): New. (nvptx_get_drap_rtx): Return %argp as the DRAP if needed. (nvptx_gen_shuffle): Export. (nvptx_output_call_insn): Handle COND_EXEC patterns. Emit instruction predicate. (nvptx_print_operand): Fix handling of instruction predicates. (nvptx_get_unisimt_master): New helper function. (nvptx_get_unisimt_predicate): Ditto. (nvptx_call_insn_is_syscall_p): Ditto. (nvptx_unisimt_handle_set): Ditto. (nvptx_reorg_uniform_simt): New. Transform code for -muniform-simt. (nvptx_reorg): Call nvptx_reorg_uniform_simt. (nvptx_handle_shared_attribute): New. Use it... (nvptx_attribute_table): ... here (new entry). (nvptx_record_offload_symbol): Handle NULL attributes. (nvptx_file_end): Handle need_softstack_decl and need_unisimt_decl. (nvptx_simt_vf): New. (TARGET_SIMT_VF): Define. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Define __nvptx_softstack or __nvptx_unisimt__ when -msoft-stack, or resp. -muniform-simt option is active. (STACK_SIZE_MODE): Define. (FIXED_REGISTERS): Adjust. (SOFTSTACK_SLOT_REGNUM): New. (SOFTSTACK_PREV_REGNUM): New. (REGISTER_NAMES): Adjust. (struct machine_function): New fields. * config/nvptx/nvptx.md (UNSPEC_SET_SOFTSTACK): New. (UNSPEC_VOTE_BALLOT): Ditto. (UNSPEC_LANEID): Ditto. (UNSPECV_NOUNROLL): Ditto. (atomic): New attribute. (predicable): New attribute. Generate predicated forms via define_cond_exec. (br_true): Mark as not predicable. (br_false): Ditto. (br_true_uni): Ditto. (br_false_uni): Ditto. (return): Ditto. (trap_if_true): Ditto. (trap_if_false): Ditto. (nvptx_fork): Ditto. (nvptx_forked): Ditto. (nvptx_joining): Ditto. (nvptx_join): Ditto. (nvptx_barsync): Ditto. (epilogue): Emit stack restore if TARGET_SOFT_STACK. (allocate_stack): Implement for TARGET_SOFT_STACK. Remove unused code. (allocate_stack_<mode>): Remove unused pattern. (set_softstack_insn): New pattern. (restore_stack_block): Handle for TARGET_SOFT_STACK. (nvptx_vote_ballot): New pattern. (omp_simt_lane): Ditto. (omp_simt_last_lane): Ditto. (omp_simt_ordered): Ditto. (omp_simt_vote_any): Ditto. (omp_simt_xchg_bfly): Ditto. (omp_simt_xchg_idx): Ditto. (nvptx_nounroll): Ditto. (atomic_compare_and_swap<mode>_1): Mark with atomic attribute. (atomic_exchange<mode>): Ditto. (atomic_fetch_add<mode>): Ditto. (atomic_fetch_addsf): Ditto. (atomic_fetch_<logic><mode>): Ditto. * config/nvptx/nvptx.opt: (msoft-stack): New option. (muniform-simt): Ditto. (mgomp): Ditto. * config/nvptx/t-nvptx (MULTILIB_OPTIONS): New. * doc/extend.texi (Nvidia PTX Variable Attributes): New section. * doc/invoke.texi (msoft-stack): Document. (muniform-simt): Document (mgomp): Document. * doc/tm.texi: Regenerate. * doc/tm.texi.in: (TARGET_SIMT_VF): New hook. * target.def: Define it. * target-insns.def (omp_simt_lane): New. (omp_simt_last_lane): New. (omp_simt_ordered): New. (omp_simt_vote_any): New. (omp_simt_xchg_bfly): New. (omp_simt_xchg_idx): New. libgcc/ * config/nvptx/crt0.c (__main): Setup __nvptx_stacks and __nvptx_uni. * config/nvptx/mgomp.c: New file. * config/nvptx/t-nvptx: Add mgomp.c gcc/testsuite/ * lib/target-supports.exp (check_effective_target_alloca): Use a compile test. * gcc.target/nvptx/softstack.c: New test. * gcc.target/nvptx/decl-shared.c: New test. * gcc.target/nvptx/decl-shared-init.c: New test. From-SVN: r242503
2016-11-16 18:17:00 +01:00
muniform-simt
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target Mask(UNIFORM_SIMT)
nvptx backend prerequisites for OpenMP offloading gcc/ * config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP is selected. Pass -mgomp to offload compiler in OpenMP case. * config/nvptx/nvptx-protos.h (nvptx_shuffle_kind): Move enum declaration from nvptx.c. (nvptx_gen_shuffle): Declare. (nvptx_output_set_softstack): Declare. * config/nvptx/nvptx.c (nvptx_shuffle_kind): Move to nvptx-protos.h. (need_softstack_decl): New variable. (need_unisimt_decl): New variable. (diagnose_openacc_conflict): New. Use it... (nvptx_option_override): ...here. Handle TARGET_GOMP. (nvptx_encode_section_info): Handle "shared" attribute. (write_as_kernel): Restrict to OpenACC target regions. (init_softstack_frame): New. (nvptx_init_unisimt_predicate): New. (write_omp_entry): New. Use it... (nvptx_declare_function_name): ...here to emit OpenMP target region entrypoints. Handle TARGET_SOFT_STACK. Call nvptx_init_unisimt_predicate. (nvptx_output_set_softstack): New. (nvptx_get_drap_rtx): Return %argp as the DRAP if needed. (nvptx_gen_shuffle): Export. (nvptx_output_call_insn): Handle COND_EXEC patterns. Emit instruction predicate. (nvptx_print_operand): Fix handling of instruction predicates. (nvptx_get_unisimt_master): New helper function. (nvptx_get_unisimt_predicate): Ditto. (nvptx_call_insn_is_syscall_p): Ditto. (nvptx_unisimt_handle_set): Ditto. (nvptx_reorg_uniform_simt): New. Transform code for -muniform-simt. (nvptx_reorg): Call nvptx_reorg_uniform_simt. (nvptx_handle_shared_attribute): New. Use it... (nvptx_attribute_table): ... here (new entry). (nvptx_record_offload_symbol): Handle NULL attributes. (nvptx_file_end): Handle need_softstack_decl and need_unisimt_decl. (nvptx_simt_vf): New. (TARGET_SIMT_VF): Define. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Define __nvptx_softstack or __nvptx_unisimt__ when -msoft-stack, or resp. -muniform-simt option is active. (STACK_SIZE_MODE): Define. (FIXED_REGISTERS): Adjust. (SOFTSTACK_SLOT_REGNUM): New. (SOFTSTACK_PREV_REGNUM): New. (REGISTER_NAMES): Adjust. (struct machine_function): New fields. * config/nvptx/nvptx.md (UNSPEC_SET_SOFTSTACK): New. (UNSPEC_VOTE_BALLOT): Ditto. (UNSPEC_LANEID): Ditto. (UNSPECV_NOUNROLL): Ditto. (atomic): New attribute. (predicable): New attribute. Generate predicated forms via define_cond_exec. (br_true): Mark as not predicable. (br_false): Ditto. (br_true_uni): Ditto. (br_false_uni): Ditto. (return): Ditto. (trap_if_true): Ditto. (trap_if_false): Ditto. (nvptx_fork): Ditto. (nvptx_forked): Ditto. (nvptx_joining): Ditto. (nvptx_join): Ditto. (nvptx_barsync): Ditto. (epilogue): Emit stack restore if TARGET_SOFT_STACK. (allocate_stack): Implement for TARGET_SOFT_STACK. Remove unused code. (allocate_stack_<mode>): Remove unused pattern. (set_softstack_insn): New pattern. (restore_stack_block): Handle for TARGET_SOFT_STACK. (nvptx_vote_ballot): New pattern. (omp_simt_lane): Ditto. (omp_simt_last_lane): Ditto. (omp_simt_ordered): Ditto. (omp_simt_vote_any): Ditto. (omp_simt_xchg_bfly): Ditto. (omp_simt_xchg_idx): Ditto. (nvptx_nounroll): Ditto. (atomic_compare_and_swap<mode>_1): Mark with atomic attribute. (atomic_exchange<mode>): Ditto. (atomic_fetch_add<mode>): Ditto. (atomic_fetch_addsf): Ditto. (atomic_fetch_<logic><mode>): Ditto. * config/nvptx/nvptx.opt: (msoft-stack): New option. (muniform-simt): Ditto. (mgomp): Ditto. * config/nvptx/t-nvptx (MULTILIB_OPTIONS): New. * doc/extend.texi (Nvidia PTX Variable Attributes): New section. * doc/invoke.texi (msoft-stack): Document. (muniform-simt): Document (mgomp): Document. * doc/tm.texi: Regenerate. * doc/tm.texi.in: (TARGET_SIMT_VF): New hook. * target.def: Define it. * target-insns.def (omp_simt_lane): New. (omp_simt_last_lane): New. (omp_simt_ordered): New. (omp_simt_vote_any): New. (omp_simt_xchg_bfly): New. (omp_simt_xchg_idx): New. libgcc/ * config/nvptx/crt0.c (__main): Setup __nvptx_stacks and __nvptx_uni. * config/nvptx/mgomp.c: New file. * config/nvptx/t-nvptx: Add mgomp.c gcc/testsuite/ * lib/target-supports.exp (check_effective_target_alloca): Use a compile test. * gcc.target/nvptx/softstack.c: New test. * gcc.target/nvptx/decl-shared.c: New test. * gcc.target/nvptx/decl-shared-init.c: New test. From-SVN: r242503
2016-11-16 18:17:00 +01:00
Generate code that can keep local state uniform across all lanes.
mgomp
opts: Remove all usages of Report keyword. gcc/brig/ChangeLog: * lang.opt: Remove usage of Report. gcc/c-family/ChangeLog: * c.opt: Remove usage of Report. gcc/ChangeLog: * common.opt: Remove usage of Report. * config/aarch64/aarch64.opt: Ditto. * config/alpha/alpha.opt: Ditto. * config/arc/arc.opt: Ditto. * config/arm/arm.opt: Ditto. * config/avr/avr.opt: Ditto. * config/bfin/bfin.opt: Ditto. * config/bpf/bpf.opt: Ditto. * config/c6x/c6x.opt: Ditto. * config/cr16/cr16.opt: Ditto. * config/cris/cris.opt: Ditto. * config/cris/elf.opt: Ditto. * config/csky/csky.opt: Ditto. * config/darwin.opt: Ditto. * config/fr30/fr30.opt: Ditto. * config/frv/frv.opt: Ditto. * config/ft32/ft32.opt: Ditto. * config/gcn/gcn.opt: Ditto. * config/i386/cygming.opt: Ditto. * config/i386/i386.opt: Ditto. * config/ia64/ia64.opt: Ditto. * config/ia64/ilp32.opt: Ditto. * config/linux-android.opt: Ditto. * config/linux.opt: Ditto. * config/lm32/lm32.opt: Ditto. * config/m32r/m32r.opt: Ditto. * config/m68k/m68k.opt: Ditto. * config/mcore/mcore.opt: Ditto. * config/microblaze/microblaze.opt: Ditto. * config/mips/mips.opt: Ditto. * config/mmix/mmix.opt: Ditto. * config/mn10300/mn10300.opt: Ditto. * config/moxie/moxie.opt: Ditto. * config/msp430/msp430.opt: Ditto. * config/nds32/nds32.opt: Ditto. * config/nios2/elf.opt: Ditto. * config/nios2/nios2.opt: Ditto. * config/nvptx/nvptx.opt: Ditto. * config/pa/pa.opt: Ditto. * config/pdp11/pdp11.opt: Ditto. * config/pru/pru.opt: Ditto. * config/riscv/riscv.opt: Ditto. * config/rl78/rl78.opt: Ditto. * config/rs6000/aix64.opt: Ditto. * config/rs6000/linux64.opt: Ditto. * config/rs6000/rs6000.opt: Ditto. * config/rs6000/sysv4.opt: Ditto. * config/rx/elf.opt: Ditto. * config/rx/rx.opt: Ditto. * config/s390/s390.opt: Ditto. * config/s390/tpf.opt: Ditto. * config/sh/sh.opt: Ditto. * config/sol2.opt: Ditto. * config/sparc/long-double-switch.opt: Ditto. * config/sparc/sparc.opt: Ditto. * config/tilegx/tilegx.opt: Ditto. * config/tilepro/tilepro.opt: Ditto. * config/v850/v850.opt: Ditto. * config/visium/visium.opt: Ditto. * config/vms/vms.opt: Ditto. * config/vxworks.opt: Ditto. * config/xtensa/xtensa.opt: Ditto. gcc/lto/ChangeLog: * lang.opt: Remove usage of Report.
2020-12-11 17:25:43 +01:00
Target Mask(GOMP)
nvptx backend prerequisites for OpenMP offloading gcc/ * config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP is selected. Pass -mgomp to offload compiler in OpenMP case. * config/nvptx/nvptx-protos.h (nvptx_shuffle_kind): Move enum declaration from nvptx.c. (nvptx_gen_shuffle): Declare. (nvptx_output_set_softstack): Declare. * config/nvptx/nvptx.c (nvptx_shuffle_kind): Move to nvptx-protos.h. (need_softstack_decl): New variable. (need_unisimt_decl): New variable. (diagnose_openacc_conflict): New. Use it... (nvptx_option_override): ...here. Handle TARGET_GOMP. (nvptx_encode_section_info): Handle "shared" attribute. (write_as_kernel): Restrict to OpenACC target regions. (init_softstack_frame): New. (nvptx_init_unisimt_predicate): New. (write_omp_entry): New. Use it... (nvptx_declare_function_name): ...here to emit OpenMP target region entrypoints. Handle TARGET_SOFT_STACK. Call nvptx_init_unisimt_predicate. (nvptx_output_set_softstack): New. (nvptx_get_drap_rtx): Return %argp as the DRAP if needed. (nvptx_gen_shuffle): Export. (nvptx_output_call_insn): Handle COND_EXEC patterns. Emit instruction predicate. (nvptx_print_operand): Fix handling of instruction predicates. (nvptx_get_unisimt_master): New helper function. (nvptx_get_unisimt_predicate): Ditto. (nvptx_call_insn_is_syscall_p): Ditto. (nvptx_unisimt_handle_set): Ditto. (nvptx_reorg_uniform_simt): New. Transform code for -muniform-simt. (nvptx_reorg): Call nvptx_reorg_uniform_simt. (nvptx_handle_shared_attribute): New. Use it... (nvptx_attribute_table): ... here (new entry). (nvptx_record_offload_symbol): Handle NULL attributes. (nvptx_file_end): Handle need_softstack_decl and need_unisimt_decl. (nvptx_simt_vf): New. (TARGET_SIMT_VF): Define. * config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Define __nvptx_softstack or __nvptx_unisimt__ when -msoft-stack, or resp. -muniform-simt option is active. (STACK_SIZE_MODE): Define. (FIXED_REGISTERS): Adjust. (SOFTSTACK_SLOT_REGNUM): New. (SOFTSTACK_PREV_REGNUM): New. (REGISTER_NAMES): Adjust. (struct machine_function): New fields. * config/nvptx/nvptx.md (UNSPEC_SET_SOFTSTACK): New. (UNSPEC_VOTE_BALLOT): Ditto. (UNSPEC_LANEID): Ditto. (UNSPECV_NOUNROLL): Ditto. (atomic): New attribute. (predicable): New attribute. Generate predicated forms via define_cond_exec. (br_true): Mark as not predicable. (br_false): Ditto. (br_true_uni): Ditto. (br_false_uni): Ditto. (return): Ditto. (trap_if_true): Ditto. (trap_if_false): Ditto. (nvptx_fork): Ditto. (nvptx_forked): Ditto. (nvptx_joining): Ditto. (nvptx_join): Ditto. (nvptx_barsync): Ditto. (epilogue): Emit stack restore if TARGET_SOFT_STACK. (allocate_stack): Implement for TARGET_SOFT_STACK. Remove unused code. (allocate_stack_<mode>): Remove unused pattern. (set_softstack_insn): New pattern. (restore_stack_block): Handle for TARGET_SOFT_STACK. (nvptx_vote_ballot): New pattern. (omp_simt_lane): Ditto. (omp_simt_last_lane): Ditto. (omp_simt_ordered): Ditto. (omp_simt_vote_any): Ditto. (omp_simt_xchg_bfly): Ditto. (omp_simt_xchg_idx): Ditto. (nvptx_nounroll): Ditto. (atomic_compare_and_swap<mode>_1): Mark with atomic attribute. (atomic_exchange<mode>): Ditto. (atomic_fetch_add<mode>): Ditto. (atomic_fetch_addsf): Ditto. (atomic_fetch_<logic><mode>): Ditto. * config/nvptx/nvptx.opt: (msoft-stack): New option. (muniform-simt): Ditto. (mgomp): Ditto. * config/nvptx/t-nvptx (MULTILIB_OPTIONS): New. * doc/extend.texi (Nvidia PTX Variable Attributes): New section. * doc/invoke.texi (msoft-stack): Document. (muniform-simt): Document (mgomp): Document. * doc/tm.texi: Regenerate. * doc/tm.texi.in: (TARGET_SIMT_VF): New hook. * target.def: Define it. * target-insns.def (omp_simt_lane): New. (omp_simt_last_lane): New. (omp_simt_ordered): New. (omp_simt_vote_any): New. (omp_simt_xchg_bfly): New. (omp_simt_xchg_idx): New. libgcc/ * config/nvptx/crt0.c (__main): Setup __nvptx_stacks and __nvptx_uni. * config/nvptx/mgomp.c: New file. * config/nvptx/t-nvptx: Add mgomp.c gcc/testsuite/ * lib/target-supports.exp (check_effective_target_alloca): Use a compile test. * gcc.target/nvptx/softstack.c: New test. * gcc.target/nvptx/decl-shared.c: New test. * gcc.target/nvptx/decl-shared-init.c: New test. From-SVN: r242503
2016-11-16 18:17:00 +01:00
Generate code for OpenMP offloading: enables -msoft-stack and -muniform-simt.
misa=
Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM30)
Specify the PTX ISA target architecture to use.
march=
Target RejectNegative Joined Alias(misa=)
Alias:
march-map=sm_30
Target RejectNegative Alias(misa=,sm_30)
march-map=sm_32
Target RejectNegative Alias(misa=,sm_30)
march-map=sm_35
Target RejectNegative Alias(misa=,sm_35)
march-map=sm_37
Target RejectNegative Alias(misa=,sm_35)
march-map=sm_50
Target RejectNegative Alias(misa=,sm_35)
march-map=sm_52
Target RejectNegative Alias(misa=,sm_35)
march-map=sm_53
Target RejectNegative Alias(misa=,sm_53)
march-map=sm_60
Target RejectNegative Alias(misa=,sm_53)
march-map=sm_61
Target RejectNegative Alias(misa=,sm_53)
march-map=sm_62
Target RejectNegative Alias(misa=,sm_53)
march-map=sm_70
Target RejectNegative Alias(misa=,sm_70)
march-map=sm_72
Target RejectNegative Alias(misa=,sm_70)
march-map=sm_75
Target RejectNegative Alias(misa=,sm_75)
march-map=sm_80
Target RejectNegative Alias(misa=,sm_80)
march-map=sm_86
Target RejectNegative Alias(misa=,sm_80)
march-map=sm_87
Target RejectNegative Alias(misa=,sm_80)
march-map=sm_90
Target RejectNegative Alias(misa=,sm_80)
Enum
Name(ptx_version) Type(int)
Known PTX ISA versions (for use with the -mptx= option):
EnumValue
Enum(ptx_version) String(3.1) Value(PTX_VERSION_3_1)
EnumValue
Enum(ptx_version) String(6.0) Value(PTX_VERSION_6_0)
EnumValue
Enum(ptx_version) String(6.3) Value(PTX_VERSION_6_3)
EnumValue
Enum(ptx_version) String(7.0) Value(PTX_VERSION_7_0)
EnumValue
Enum(ptx_version) String(_) Value(PTX_VERSION_default)
mptx=
Target RejectNegative ToLower Joined Enum(ptx_version) Var(ptx_version_option)
Specify the PTX ISA version to use.
[nvptx] Initialize ptx regs With nvptx target, driver version 510.47.03 and board GT 1030 I, we run into: ... FAIL: gcc.c-torture/execute/pr53465.c -O1 execution test FAIL: gcc.c-torture/execute/pr53465.c -O2 execution test FAIL: gcc.c-torture/execute/pr53465.c -O3 -g execution test ... while the test-cases pass with nvptx-none-run -O0. The problem is that the generated ptx contains a read from an uninitialized ptx register, and the driver JIT doesn't handle this well. For -O2 and -O3, we can get rid of the FAIL using --param logical-op-non-short-circuit=0. But not for -O1. At -O1, the test-case minimizes to: ... void __attribute__((noinline, noclone)) foo (int y) { int c; for (int i = 0; i < y; i++) { int d = i + 1; if (i && d <= c) __builtin_abort (); c = d; } } int main () { foo (2); return 0; } ... Note that the test-case does not contain an uninitialized use. In the first iteration, i is 0 and consequently c is not read. In the second iteration, c is read, but by that time it's already initialized by 'c = d' from the first iteration. AFAICT the problem is introduced as follows: the conditional use of c in the loop body is translated into an unconditional use of c in the loop header: ... # c_1 = PHI <c_4(D)(2), c_9(6)> ... which forwprop1 propagates the 'c_9 = d_7' assignment into: ... # c_1 = PHI <c_4(D)(2), d_7(6)> ... which ends up being translated by expand into an unconditional: ... (insn 13 12 0 (set (reg/v:SI 22 [ c ]) (reg/v:SI 23 [ d ])) -1 (nil)) ... at the start of the loop body, creating an uninitialized read of d on the path from loop entry. By disabling coalesce_ssa_name, we get the more usual copies on the incoming edges. The copy on the loop entry path still does an uninitialized read, but that one's now initialized by init-regs. The test-case passes, also when disabling init-regs, so it's possible that the JIT driver doesn't object to this type of uninitialized read. Now that we characterized the problem to some degree, we need to fix this, because either: - we're violating an undocumented ptx invariant, and this is a compiler bug, or - this is is a driver JIT bug and we need to work around it. There are essentially two strategies to address this: - stop the compiler from creating uninitialized reads - patch up uninitialized reads using additional initialization The former will probably involve: - making some optimizations more conservative in the presence of uninitialized reads, and - disabling some other optimizations (where making them more conservative is not possible, or cannot easily be achieved). This will probably will have a cost penalty for code that does not suffer from the original problem. The latter has the problem that it may paper over uninitialized reads in the source code, or indeed over ones that were incorrectly introduced by the compiler. But it has the advantage that it allows for the problem to be addressed at a single location. There's an existing pass, init-regs, which implements a form of the latter, but it doesn't work for this example because it only inserts additional initialization for uses that have not a single reaching definition. Fix this by adding initialization of uninitialized ptx regs in reorg. Control the new functionality using -minit-regs=<0|1|2|3>, meaning: - 0: disabled. - 1: add initialization of all regs at the entry bb - 2: add initialization of uninitialized regs at the entry bb - 3: add initialization of uninitialized regs close to the use and defaulting to 3. Tested on nvptx. gcc/ChangeLog: 2022-02-17 Tom de Vries <tdevries@suse.de> PR target/104440 * config/nvptx/nvptx.cc (workaround_uninit_method_1) (workaround_uninit_method_2, workaround_uninit_method_3) (workaround_uninit): New function. (nvptx_reorg): Use workaround_uninit. * config/nvptx/nvptx.opt (minit-regs): New option.
2022-02-16 17:09:11 +01:00
minit-regs=
Target Var(nvptx_init_regs) IntegerRange(0, 3) Joined UInteger Init(3)
Initialize ptx registers.
mptx-comment
Target Var(nvptx_comment) Init(1) Undocumented
[nvptx] Use .alias directive for mptx >= 6.3 Starting with ptx isa version 6.3, a ptx directive .alias is available. Use this directive to support symbol aliases, as far as possible. The alias support is off by default. It can be turned on using a switch -malias. Furthermore, for pre-sm_75, it's not effective unless the ptx version is bumped to 6.3 or higher using -mptx (given that the default for pre-sm_75 is 6.0). The alias support has the following limitations. Only function aliases are supported. Weak aliases are not supported. That is, if I disable the check in nvptx_asm_output_def_from_decls that disallows this, a weak alias is emitted and parsed by the driver. But the test gcc.dg/globalalias.c starts failing, with the behaviour matching the comment about "weird behavior of AIX's .set pseudo-op": a weak alias may resolve to different functions in different files. Aliases to weak symbols are not supported (see gcc.dg/localalias.c). This is currently not prohibited by the compiler, but with the driver link we run into: "error: Function test with .weak scope cannot be aliased". Aliases to aliases are not supported (see libgomp.c-c++-common/pr96390.c). This is currently not prohibited by the compiler, but with the driver link we run into: "Internal error: alias to unknown symbol" . Unreferenced aliases are not emitted (these can occur f.i. when inlining a call to an alias). This avoids driver link error "Internal error: reference to deleted section". When enabling malias by default, libgomp detects alias support and consequently libgomp.a will contains a few uses of .alias. This however results in aforementioned "Internal error: reference to deleted section" in many test-cases. Either there's some error with how .alias is used, or there's a driver bug. While this issue is not resolved, we keep malias off-by-default. At some point we may add support in the nvptx-tools linker for symbol aliases, and define f.i. malias=ptx and malias=ld to choose between the two in the compiler. An example of where this support is useful, is the OvO (OpenMP vs Offload) testsuite. The testsuite passes already at -O2. But at -O0, there are errors in some c++ test-cases due to missing symbol alias support. By compiling with -malias, the whole testsuite passes also at -O0. This patch causes a regression: ... -PASS: gcc.dg/pr60797.c (test for errors, line 4) +FAIL: gcc.dg/pr60797.c (test for errors, line 4) ... The test-case is skipped for effective target alias, and both without and with this patch the nvptx target is considered to not support it, so the test-case is executed. The test-case expects an error message along the lines of "alias definitions not supported in this configuration", but instead we run into: ... gcc.dg/pr60797.c:4:12: error: foo aliased to undefined symbol ... This is probably due to the fact that the nvptx backend now defines macros ASM_OUTPUT_DEF and ASM_OUTPUT_DEF_FROM_DECLS, so from the point of view of the common part of the compiler, aliases are supported. gcc/ChangeLog: 2022-03-18 Tom de Vries <tdevries@suse.de> PR target/104957 * config/nvptx/nvptx-protos.h (nvptx_asm_output_def_from_decls): Declare. * config/nvptx/nvptx.cc (write_fn_proto_1): Don't add function marker for alias. (SET_ASM_OP, NVPTX_ASM_OUTPUT_DEF): New macro def. (nvptx_asm_output_def_from_decls): New function. * config/nvptx/nvptx.h (ASM_OUTPUT_DEF): New macro def, define to gcc_unreachable (). (ASM_OUTPUT_DEF_FROM_DECLS): New macro def, define to nvptx_asm_output_def_from_decls. * config/nvptx/nvptx.opt (malias): New opt. gcc/testsuite/ChangeLog: 2022-03-18 Tom de Vries <tdevries@suse.de> PR target/104957 * gcc.target/nvptx/alias-1.c: New test. * gcc.target/nvptx/alias-2.c: New test. * gcc.target/nvptx/alias-3.c: New test. * gcc.target/nvptx/alias-4.c: New test. * gcc.target/nvptx/nvptx.exp (check_effective_target_runtime_ptx_isa_version_6_3): New proc.
2022-03-11 13:41:01 +01:00
malias
Target Var(nvptx_alias) Init(0) Undocumented
mexperimental
Target Var(nvptx_experimental) Init(0) Undocumented