diff options
author | Tom de Vries <tdevries@suse.de> | 2022-01-13 13:13:44 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-02-10 10:10:44 +0100 |
commit | 3e7d4e82dc9fecb051e9ac422c312b26206d5ecd (patch) | |
tree | c936837997675c954294872736c8ea5ba16b0daf /gcc/config/lynx.opt | |
parent | 5b2d679bbbcc2b976c6e228ba63afdf67c33164e (diff) | |
download | gcc-3e7d4e82dc9fecb051e9ac422c312b26206d5ecd.zip gcc-3e7d4e82dc9fecb051e9ac422c312b26206d5ecd.tar.gz gcc-3e7d4e82dc9fecb051e9ac422c312b26206d5ecd.tar.bz2 |
[nvptx] Handle pre-sm_7x shared atomic store using atomic exchange
The ptx isa specifies (for pre-sm_7x) that atomic operations on shared memory
locations do not guarantee atomicity with respect to normal store instructions
to the same address.
This can be fixed by:
- inserting barriers between normal stores and atomic operations to a common
address
- using atom.exch to store to locations accessed by other atomic operations.
It's not clearly spelled out which barriers are needed, and a barrier seem more
expensive than atomic exchange.
Implement the pre-sm_7x shared atomic store using atomic exchange.
That includes stores using generic addressing, since those may also point to
shared memory.
Tested on x86-64 with nvptx accelerator.
gcc/ChangeLog:
2022-02-02 Tom de Vries <tdevries@suse.de>
* config/nvptx/nvptx-protos.h (nvptx_mem_maybe_shared_p): Declare.
* config/nvptx/nvptx.cc (nvptx_mem_data_area): New static function.
(nvptx_mem_maybe_shared_p): New function.
* config/nvptx/nvptx.md (define_expand "atomic_store<mode>"): New
define_expand.
gcc/testsuite/ChangeLog:
2022-02-02 Tom de Vries <tdevries@suse.de>
* gcc.target/nvptx/atomic-store-1.c: New test.
* gcc.target/nvptx/atomic-store-3.c: New test.
* gcc.target/nvptx/stack-atomics-run.c: Update.
Diffstat (limited to 'gcc/config/lynx.opt')
0 files changed, 0 insertions, 0 deletions