diff options
author | Marek Olšák <marek.olsak@amd.com> | 2016-12-02 19:40:40 +0100 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2016-12-14 19:03:12 +0000 |
commit | 18bb2d5c66133df790082aaba8359cc1beeee82f (patch) | |
tree | 165df2c7855a06b6c5664fca946bcad3dfa1dd17 | |
parent | 3b956bdbcc86418404e7e861521d14ce83c8543e (diff) | |
download | external_mesa3d-18bb2d5c66133df790082aaba8359cc1beeee82f.zip external_mesa3d-18bb2d5c66133df790082aaba8359cc1beeee82f.tar.gz external_mesa3d-18bb2d5c66133df790082aaba8359cc1beeee82f.tar.bz2 |
radeonsi: wait for outstanding LDS instructions in memory barriers if needed
Cc: 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
(cherry picked from commit 13c34cf8ca43d0f9c1e1a663e6a3783b0938dfd9)
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 73887a1..c975fae 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -3320,6 +3320,7 @@ static void emit_optimization_barrier(struct si_shader_context *ctx) #endif /* Combine these with & instead of |. */ +#define NOOP_WAITCNT 0xf7f #define LGKM_CNT 0x07f #define VM_CNT 0xf70 @@ -3340,8 +3341,23 @@ static void membar_emit( struct lp_build_emit_data *emit_data) { struct si_shader_context *ctx = si_shader_context(bld_base); + LLVMValueRef src0 = lp_build_emit_fetch(bld_base, emit_data->inst, 0, 0); + unsigned flags = LLVMConstIntGetZExtValue(src0); + unsigned waitcnt = NOOP_WAITCNT; - emit_waitcnt(ctx, VM_CNT); + if (flags & TGSI_MEMBAR_THREAD_GROUP) + waitcnt &= VM_CNT & LGKM_CNT; + + if (flags & (TGSI_MEMBAR_ATOMIC_BUFFER | + TGSI_MEMBAR_SHADER_BUFFER | + TGSI_MEMBAR_SHADER_IMAGE)) + waitcnt &= VM_CNT; + + if (flags & TGSI_MEMBAR_SHARED) + waitcnt &= LGKM_CNT; + + if (waitcnt != NOOP_WAITCNT) + emit_waitcnt(ctx, waitcnt); } static LLVMValueRef |