gpu: also add synchronization after writes to shared memory from core
commit36d347d17b7633182ae331ee54bfad05a119d2b8
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 1 Apr 2015 10:55:17 +0000 (1 12:55 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 16 Apr 2015 06:59:08 +0000 (16 08:59 +0200)
tree135ef339d6e42189c0defb0b7832fd4447faf80c
parentf63eb8d425a6600c2877271f2a030887973f69dd
gpu: also add synchronization after writes to shared memory from core

By default, the mapping to shared memory is computed at the level
that is mapped to threads and the copying is only hoisted up through
schedule dimensions that do not affect the shared memory tile offset.
It is therefore unlikely that the shared memory elements are accessed
by different threads in successive iterations of these intermediate
schedule dimensions, but it is still possible in theory.
Add synchronization after the core if it has any writes to shared
memory that require synchronization to protect us from such cases and
also from future cases where the mapping to shared memory could
be computed at a different level.

Reported-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
gpu.c