amdgcn: Add waitcnt after LDS write instructions
authorJulian Brown <julian@codesourcery.com>
Mon, 10 Feb 2020 20:26:57 +0000 (12:26 -0800)
committerJulian Brown <julian@codesourcery.com>
Tue, 8 Sep 2020 20:26:42 +0000 (13:26 -0700)
commite929d65b48ad5583e995d872ca5de95b23de4d72
tree653ba525d9caf52a579a85f2e5e929cf36307744
parent3aee3aaf48be2d3d81e381690ae9dd305d8b505f
amdgcn: Add waitcnt after LDS write instructions

Data-share write (ds_write) instructions do not necessarily complete
the write to LDS immediately. When a write completes, LGKM_CNT is
decremented. For now, we wait until LGKM_CNT reaches zero after each
ds_write instruction.

This fixes a race condition in the case where LDS is read immediately
after being written. This can happen with broadcast operations.

2020-09-08  Julian Brown  <julian@codesourcery.com>

gcc/
* config/gcn/gcn-valu.md (scatter<mode>_insn_1offset_ds<exec_scatter>):
Add waitcnt.
* config/gcn/gcn.md (*mov<mode>_insn, *movti_insn): Add waitcnt to
ds_write alternatives.
gcc/config/gcn/gcn-valu.md
gcc/config/gcn/gcn.md