From 2276f8f064ea0a67817d4deb7d553177575ccf4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 13 Aug 2018 23:59:28 -0400 Subject: [PATCH] ac: add ac_build_s_barrier Reviewed-by: Samuel Pitoiset --- src/amd/common/ac_llvm_build.c | 6 ++++++ src/amd/common/ac_llvm_build.h | 1 + src/amd/common/ac_nir_to_llvm.c | 3 +-- src/gallium/drivers/radeonsi/si_shader.c | 4 +--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 87e36df6431..c89bdf49faf 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -348,6 +348,12 @@ ac_build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type, return phi; } +void ac_build_s_barrier(struct ac_llvm_context *ctx) +{ + ac_build_intrinsic(ctx, "llvm.amdgcn.s.barrier", ctx->voidt, NULL, + 0, AC_FUNC_ATTR_CONVERGENT); +} + /* Prevent optimizations (at least of memory accesses) across the current * point in the program by emitting empty inline assembly that is marked as * having side effects. diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index c5753037e7b..84212f0d459 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -133,6 +133,7 @@ ac_build_phi(struct ac_llvm_context *ctx, LLVMTypeRef type, unsigned count_incoming, LLVMValueRef *values, LLVMBasicBlockRef *blocks); +void ac_build_s_barrier(struct ac_llvm_context *ctx); void ac_build_optimization_barrier(struct ac_llvm_context *ctx, LLVMValueRef *pvgpr); diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index cffc980e51f..1584fef7ab7 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2582,8 +2582,7 @@ void ac_emit_barrier(struct ac_llvm_context *ac, gl_shader_stage stage) ac_build_waitcnt(ac, LGKM_CNT & VM_CNT); return; } - ac_build_intrinsic(ac, "llvm.amdgcn.s.barrier", - ac->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT); + ac_build_s_barrier(ac); } static void emit_discard(struct ac_nir_context *ctx, diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 81c825db1e4..29523474735 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -4404,9 +4404,7 @@ static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action, return; } - ac_build_intrinsic(&ctx->ac, - "llvm.amdgcn.s.barrier", - ctx->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT); + ac_build_s_barrier(&ctx->ac); } static void si_create_function(struct si_shader_context *ctx, -- 2.30.2