[nvptx] Update bar.sync for ptx isa 6.0
authorTom de Vries <tdevries@suse.de>
Wed, 26 Jan 2022 13:16:42 +0000 (14:16 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 1 Feb 2022 18:28:48 +0000 (19:28 +0100)
commit57f971f99209cc950d7e706b7b52f4c9ef1d10b0
tree18dbffcb88d4a184356cf9e98e66f0a0844fc353
parent456de10c549379b74d4858f00d4b8817035a73fc
[nvptx] Update bar.sync for ptx isa 6.0

In ptx isa 6.0, a new barrier instruction was added, and bar.sync was
redefined as barrier.sync.aligned.

The aligned modifier indicates that all threads in a CTA will execute the same
barrier instruction.

The seems fine for a form "bar.sync 0".

But a "bar.sync %rx,64" (as used for vector length > 32) may execute a
diffferent barrier depending on the value of %rx, so we can't assume it's
aligned.

Fix this by using "barrier.sync %rx,64" instead.

Tested on x86_64 with nvptx accelerator.

gcc/ChangeLog:

2022-01-27  Tom de Vries  <tdevries@suse.de>

* config/nvptx/nvptx-opts.h (enum ptx_version): Add PTX_VERSION_6_0.
* config/nvptx/nvptx.h (TARGET_PTX_6_0): New macro.
* config/nvptx/nvptx.md (define_insn "nvptx_barsync"): Use barrier
insn for TARGET_PTX_6_0.
gcc/config/nvptx/nvptx-opts.h
gcc/config/nvptx/nvptx.h
gcc/config/nvptx/nvptx.md