[nvptx] Add -mptx=3.1/6.3
Add nvptx option -mptx that sets the ptx ISA version. This is currently hardcoded to 3.1. Tested libgomp on x86_64-linux with nvptx accelerator, both with default set to 3.1 and 6.3. gcc/ChangeLog: 2021-05-12 Tom de Vries <tdevries@suse.de> PR target/96005 * config/nvptx/nvptx-opts.h (enum ptx_version): New enum. * config/nvptx/nvptx.c (nvptx_file_start): Print .version according to ptx_version_option. * config/nvptx/nvptx.h (TARGET_PTX_6_3): Define. * config/nvptx/nvptx.md (define_insn "nvptx_shuffle<mode>") (define_insn "nvptx_vote_ballot"): Use sync variant for TARGET_PTX_6_3. * config/nvptx/nvptx.opt (ptx_version): Add enum. (mptx): Add option. * doc/invoke.texi (Nvidia PTX Options): Add mptx item.
This commit is contained in:
parent
097fde5e75
commit
2a1586401a
6 changed files with 44 additions and 3 deletions
|
@ -26,5 +26,11 @@ enum ptx_isa
|
|||
PTX_ISA_SM35
|
||||
};
|
||||
|
||||
enum ptx_version
|
||||
{
|
||||
PTX_VERSION_3_1,
|
||||
PTX_VERSION_6_3
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5309,7 +5309,10 @@ static void
|
|||
nvptx_file_start (void)
|
||||
{
|
||||
fputs ("// BEGIN PREAMBLE\n", asm_out_file);
|
||||
fputs ("\t.version\t3.1\n", asm_out_file);
|
||||
if (TARGET_PTX_6_3)
|
||||
fputs ("\t.version\t6.3\n", asm_out_file);
|
||||
else
|
||||
fputs ("\t.version\t3.1\n", asm_out_file);
|
||||
if (TARGET_SM35)
|
||||
fputs ("\t.target\tsm_35\n", asm_out_file);
|
||||
else
|
||||
|
|
|
@ -98,6 +98,8 @@
|
|||
|
||||
#define TARGET_SM35 (ptx_isa_option >= PTX_ISA_SM35)
|
||||
|
||||
#define TARGET_PTX_6_3 (ptx_version_option >= PTX_VERSION_6_3)
|
||||
|
||||
/* Registers. Since ptx is a virtual target, we just define a few
|
||||
hard registers for special purposes and leave pseudos unallocated.
|
||||
We have to have some available hard registers, to keep gcc setup
|
||||
|
|
|
@ -1452,14 +1452,24 @@
|
|||
(match_operand:SI 3 "const_int_operand" "n")]
|
||||
UNSPEC_SHUFFLE))]
|
||||
""
|
||||
"%.\\tshfl%S3.b32\\t%0, %1, %2, 31;")
|
||||
{
|
||||
if (TARGET_PTX_6_3)
|
||||
return "%.\\tshfl.sync%S3.b32\\t%0, %1, %2, 31, 0xffffffff;";
|
||||
else
|
||||
return "%.\\tshfl%S3.b32\\t%0, %1, %2, 31;";
|
||||
})
|
||||
|
||||
(define_insn "nvptx_vote_ballot"
|
||||
[(set (match_operand:SI 0 "nvptx_register_operand" "=R")
|
||||
(unspec:SI [(match_operand:BI 1 "nvptx_register_operand" "R")]
|
||||
UNSPEC_VOTE_BALLOT))]
|
||||
""
|
||||
"%.\\tvote.ballot.b32\\t%0, %1;")
|
||||
{
|
||||
if (TARGET_PTX_6_3)
|
||||
return "%.\\tvote.sync.ballot.b32\\t%0, %1, 0xffffffff;";
|
||||
else
|
||||
return "%.\\tvote.ballot.b32\\t%0, %1;";
|
||||
})
|
||||
|
||||
;; Patterns for OpenMP SIMD-via-SIMT lowering
|
||||
|
||||
|
|
|
@ -65,3 +65,17 @@ Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
|
|||
misa=
|
||||
Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM35)
|
||||
Specify the version of the ptx ISA to use.
|
||||
|
||||
Enum
|
||||
Name(ptx_version) Type(int)
|
||||
Known PTX 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.3) Value(PTX_VERSION_6_3)
|
||||
|
||||
mptx=
|
||||
Target RejectNegative ToLower Joined Enum(ptx_version) Var(ptx_version_option) Init(PTX_VERSION_3_1)
|
||||
Specify the version of the ptx version to use.
|
||||
|
|
|
@ -26284,6 +26284,12 @@ Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
|
|||
strings must be lower-case. Valid ISA strings include @samp{sm_30} and
|
||||
@samp{sm_35}. The default ISA is sm_35.
|
||||
|
||||
@item -mptx=@var{version-string}
|
||||
@opindex mptx
|
||||
Generate code for given the specified PTX version (e.g.@: @samp{6.3}).
|
||||
Valid version strings include @samp{3.1} and @samp{6.3}. The default PTX
|
||||
version is 3.1.
|
||||
|
||||
@item -mmainkernel
|
||||
@opindex mmainkernel
|
||||
Link in code for a __main kernel. This is for stand-alone instead of
|
||||
|
|
Loading…
Add table
Reference in a new issue