x86_64-pc-linux-gnu-accel-nvptx-none-gcc needs both -misa and -mptx to select a specific target. When I use OpenMP offload. -foffload-options=nvptx-none="-misa=sm_80" I got error ``` ptxas /tmp/ccW7wYQT.o, line 3; error : PTX .version 3.1 does not support .target sm_80 ptxas /tmp/ccW7wYQT.o, line 2622; warning : Instruction 'shfl' without '.sync' may produce unpredictable results on sm_70 and later architectures ``` Then I have to get it through with -foffload-options=nvptx-none="-misa=sm_80 -mptx=7.0" I think GPU users know what sm_80 is but they rarely know PTX. Can we -mptx default to highest -misa selection supports? Or introduce something like -march=sm_80 and map it to appropriate -misa and -mptx. Simplify the need of options is much appreciated.
The master branch has been updated by Tom de Vries <vries@gcc.gnu.org>: https://gcc.gnu.org/g:decde11183bdccc46587d6614b75f3d56a2f2e4a commit r12-7098-gdecde11183bdccc46587d6614b75f3d56a2f2e4a Author: Tom de Vries <tdevries@suse.de> Date: Fri Feb 4 08:53:52 2022 +0100 [nvptx] Choose -mptx default based on -misa While testing with driver version 390.147 I ran into the problem that it doesn't support ptx isa version 6.3 (the new default), only 6.1. Furthermore, using the -mptx option is a bit user-unfriendly. Say we want to compile for sm_80. We can use -misa=sm_80 to specify that, but then run into errors because the default ptx version is 6.3, which doesn't support sm_80 yet. Address both these issues by: - picking a default -mptx based on the active -misa, and - ensuring that the default -mptx is at least 6.0 (instead of 6.3). Also add an error in case of incompatible options like "-misa=sm_80 -mptx=6.3": ... cc1: error: PTX version (-mptx) needs to be at least 7.0 to support \ selected -misa (sm_80) ... Tested on x86_64-linux with nvptx accelerator. gcc/ChangeLog: 2022-02-08 Tom de Vries <tdevries@suse.de> PR target/104283 * config/nvptx/nvptx-opts.h (enum ptx_version): Add PTX_VERSION_3_0 and PTX_VERSION_4_2. * config/nvptx/nvptx.cc (first_ptx_version_supporting_sm) (default_ptx_version_option, ptx_version_to_string) (sm_version_to_string, handle_ptx_version_option): New function. (nvptx_option_override): Call handle_ptx_version_option. (nvptx_file_start): Use ptx_version_to_string and sm_version_to_string. * config/nvptx/nvptx.md (define_insn "nvptx_shuffle<mode>") (define_insn "nvptx_vote_ballot"): Use TARGET_PTX_6_0. * config/nvptx/nvptx.opt (mptx): Remove 'Init'.
Fixed by commit "[nvptx] Choose -mptx default based on -misa".