Mesa (master): gallivm: fix float atomic exchange.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Nov 15 21:13:06 UTC 2020
Module: Mesa
Branch: master
Commit: f586a8efb7585475bde2783a8f412d4ad6a3e752
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f586a8efb7585475bde2783a8f412d4ad6a3e752
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Oct 30 09:58:48 2020 +1000
gallivm: fix float atomic exchange.
for atomic exchange floats are valid.
Fixes CL CTS test_atomic fails
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7595>
---
.gitlab-ci/piglit/cl.txt | 4 ++--
src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 7 +++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/.gitlab-ci/piglit/cl.txt b/.gitlab-ci/piglit/cl.txt
index 4e9ce4c298e..a64133ddab0 100644
--- a/.gitlab-ci/piglit/cl.txt
+++ b/.gitlab-ci/piglit/cl.txt
@@ -97,7 +97,7 @@ program/execute/vstore/vstore-half-private: skip
summary:
name: results
---- --------
- pass: 3764
+ pass: 3766
fail: 14
crash: 5
skip: 73
@@ -109,4 +109,4 @@ summary:
changes: 0
fixes: 0
regressions: 0
- total: 3860
+ total: 3862
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index 71af9d189c7..1105f46f10d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -879,7 +879,7 @@ static void emit_atomic_global(struct lp_build_nir_context *bld_base,
struct lp_build_context *uint_bld = &bld_base->uint_bld;
LLVMValueRef atom_res = lp_build_alloca(gallivm,
- uint_bld->vec_type, "");
+ LLVMTypeOf(val), "");
LLVMValueRef exec_mask = mask_vec(bld_base);
struct lp_build_loop_state loop_state;
lp_build_loop_begin(&loop_state, gallivm, lp_build_const_int32(gallivm, 0));
@@ -914,6 +914,7 @@ static void emit_atomic_global(struct lp_build_nir_context *bld_base,
op = LLVMAtomicRMWBinOpAdd;
break;
case nir_intrinsic_global_atomic_exchange:
+ addr_ptr = LLVMBuildBitCast(gallivm->builder, addr_ptr, LLVMPointerType(LLVMTypeOf(value_ptr), 0), "");
op = LLVMAtomicRMWBinOpXchg;
break;
case nir_intrinsic_global_atomic_and:
@@ -951,7 +952,9 @@ static void emit_atomic_global(struct lp_build_nir_context *bld_base,
LLVMBuildStore(builder, temp_res, atom_res);
lp_build_else(&ifthen);
temp_res = LLVMBuildLoad(builder, atom_res, "");
- temp_res = LLVMBuildInsertElement(builder, temp_res, lp_build_const_int32(gallivm, 0), loop_state.counter, "");
+ bool is_float = LLVMTypeOf(val) == bld_base->base.vec_type;
+ LLVMValueRef zero_val = is_float ? lp_build_const_float(gallivm, 0) : lp_build_const_int32(gallivm, 0);
+ temp_res = LLVMBuildInsertElement(builder, temp_res, zero_val, loop_state.counter, "");
LLVMBuildStore(builder, temp_res, atom_res);
lp_build_endif(&ifthen);
lp_build_loop_end_cond(&loop_state, lp_build_const_int32(gallivm, uint_bld->type.length),
More information about the mesa-commit
mailing list