diff options
author | Samuel Pitoiset <[email protected]> | 2019-04-16 10:38:22 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-04-17 21:59:52 +0200 |
commit | 78c551aca1c785470e3c0480e33a072b0b5f8928 (patch) | |
tree | 753ce9ce3ef73d8e7d063739dc138bcdc154b478 /src | |
parent | dded2edf8bedb9a5bafd7788e52dc8e714527186 (diff) |
ac/nir: use new LLVM 8 intrinsics for SSBO atomics except cmpswap
Use the raw version (ie. IDXEN=0) because vindex is unused.
Use the old intrinsic for compare&swap because the new one
hangs the GPU for some reasons.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index aa85029aed0..de2a9ed8f67 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1648,17 +1648,6 @@ static LLVMValueRef visit_atomic_ssbo(struct ac_nir_context *ctx, LLVMValueRef params[6]; int arg_count = 0; - 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: op = "add"; @@ -1694,11 +1683,27 @@ static LLVMValueRef visit_atomic_ssbo(struct ac_nir_context *ctx, abort(); } - if (HAVE_LLVM >= 0x900 && + 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 >= 0x800 && instr->intrinsic != nir_intrinsic_ssbo_atomic_comp_swap) { + 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 */ + snprintf(name, sizeof(name), - "llvm.amdgcn.buffer.atomic.%s.i32", op); + "llvm.amdgcn.raw.buffer.atomic.%s.i32", op); } 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 */ + snprintf(name, sizeof(name), "llvm.amdgcn.buffer.atomic.%s", op); } |