diff options
author | Timothy Arceri <[email protected]> | 2019-03-28 11:43:06 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-03-29 21:04:01 +1100 |
commit | 4478c5374b552334b8f14d99ae27eab83cfa1f34 (patch) | |
tree | 1df4c373062c0a8428b4d567a1526acffd947292 | |
parent | cc752dea612fedbb27b5295b754a4b5317d1bd38 (diff) |
Revert "ac/nir: use new LLVM 8 intrinsics for SSBO atomic operations"
This reverts commit 29132af2347ede46a6d02422295a5fadbe5fe788.
It seems the new intrinsic causes a hang on radeonsi (VEGA) when running the
piglit test:
tests/spec/arb_shader_storage_buffer_object/execution/ssbo-atomicCompSwap-int.shader_test
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 2321fed69f3..7b457015e16 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1670,75 +1670,57 @@ static void visit_store_ssbo(struct ac_nir_context *ctx, static LLVMValueRef visit_atomic_ssbo(struct ac_nir_context *ctx, const nir_intrinsic_instr *instr) { - const char *atomic_name; - char intrinsic_name[64]; - LLVMValueRef params[7]; + const char *name; + LLVMValueRef params[6]; int arg_count = 0; - int length; + + if (instr->intrinsic == nir_intrinsic_ssbo_atomic_comp_swap) { + params[arg_count++] = ac_llvm_extract_elem(&ctx->ac, get_src(ctx, instr->src[3]), 0); + } + params[arg_count++] = ac_llvm_extract_elem(&ctx->ac, get_src(ctx, instr->src[2]), 0); + params[arg_count++] = ctx->abi->load_ssbo(ctx->abi, + get_src(ctx, instr->src[0]), + true); + params[arg_count++] = ctx->ac.i32_0; /* vindex */ + params[arg_count++] = get_src(ctx, instr->src[1]); /* voffset */ + params[arg_count++] = ctx->ac.i1false; /* slc */ switch (instr->intrinsic) { case nir_intrinsic_ssbo_atomic_add: - atomic_name = "add"; + name = "llvm.amdgcn.buffer.atomic.add"; break; case nir_intrinsic_ssbo_atomic_imin: - atomic_name = "smin"; + name = "llvm.amdgcn.buffer.atomic.smin"; break; case nir_intrinsic_ssbo_atomic_umin: - atomic_name = "umin"; + name = "llvm.amdgcn.buffer.atomic.umin"; break; case nir_intrinsic_ssbo_atomic_imax: - atomic_name = "smax"; + name = "llvm.amdgcn.buffer.atomic.smax"; break; case nir_intrinsic_ssbo_atomic_umax: - atomic_name = "umax"; + name = "llvm.amdgcn.buffer.atomic.umax"; break; case nir_intrinsic_ssbo_atomic_and: - atomic_name = "and"; + name = "llvm.amdgcn.buffer.atomic.and"; break; case nir_intrinsic_ssbo_atomic_or: - atomic_name = "or"; + name = "llvm.amdgcn.buffer.atomic.or"; break; case nir_intrinsic_ssbo_atomic_xor: - atomic_name = "xor"; + name = "llvm.amdgcn.buffer.atomic.xor"; break; case nir_intrinsic_ssbo_atomic_exchange: - atomic_name = "swap"; + name = "llvm.amdgcn.buffer.atomic.swap"; break; case nir_intrinsic_ssbo_atomic_comp_swap: - atomic_name = "cmpswap"; + name = "llvm.amdgcn.buffer.atomic.cmpswap"; break; default: abort(); } - if (instr->intrinsic == nir_intrinsic_ssbo_atomic_comp_swap) { - params[arg_count++] = ac_llvm_extract_elem(&ctx->ac, get_src(ctx, instr->src[3]), 0); - } - params[arg_count++] = ac_llvm_extract_elem(&ctx->ac, get_src(ctx, instr->src[2]), 0); - params[arg_count++] = ctx->abi->load_ssbo(ctx->abi, - get_src(ctx, instr->src[0]), - true); - - if (HAVE_LLVM >= 0x0800) { - params[arg_count++] = get_src(ctx, instr->src[1]); /* voffset */ - params[arg_count++] = ctx->ac.i32_0; /* soffset */ - params[arg_count++] = ctx->ac.i32_0; /* slc */ - - length = snprintf(intrinsic_name, sizeof(intrinsic_name), - "llvm.amdgcn.raw.buffer.atomic.%s.i32", - atomic_name); - } else { - params[arg_count++] = ctx->ac.i32_0; /* vindex */ - params[arg_count++] = get_src(ctx, instr->src[1]); /* voffset */ - params[arg_count++] = ctx->ac.i1false; /* slc */ - - length = snprintf(intrinsic_name, sizeof(intrinsic_name), - "llvm.amdgcn.buffer.atomic.%s", atomic_name); - } - - assert(length < sizeof(intrinsic_name)); - return ac_build_intrinsic(&ctx->ac, intrinsic_name, ctx->ac.i32, - params, arg_count, 0); + return ac_build_intrinsic(&ctx->ac, name, ctx->ac.i32, params, arg_count, 0); } static LLVMValueRef visit_load_buffer(struct ac_nir_context *ctx, |