[Mesa-dev] [PATCH 1/5] radeonsi: fix LLVM 3.9 - don't use non-matching attributes on declarations
Dave Airlie
airlied at gmail.com
Sun Mar 5 22:48:37 UTC 2017
On 6 March 2017 at 08:22, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Call site attributes are used since LLVM 4.0.
For all 5,
Reviewed-by: Dave Airlie <airlied at redhat.com>
>
> This also reverts commit b19caecbd6f310c1663b0cfe483d113ae3bd5fe2
> "radeon/ac: fix intrinsic version check", because this is the correct fix.
> ---
> src/amd/common/ac_llvm_build.c | 6 +++---
> src/gallium/drivers/radeonsi/si_shader.c | 6 ++++--
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
> index acda5e2..20c6eb8 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -686,21 +686,21 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
> }
>
> snprintf(name, sizeof(name), "llvm.amdgcn.buffer.load.%s",
> type_names[func]);
>
> return ac_build_intrinsic(ctx, name, types[func], args,
> ARRAY_SIZE(args),
> /* READNONE means writes can't
> * affect it, while READONLY means
> * that writes can affect it. */
> - readonly_memory ?
> + readonly_memory && HAVE_LLVM >= 0x0400 ?
> AC_FUNC_ATTR_READNONE :
> AC_FUNC_ATTR_READONLY);
> } else {
> LLVMValueRef args[] = {
> LLVMBuildBitCast(ctx->builder, rsrc, ctx->v16i8, ""),
> voffset ? voffset : vindex,
> soffset,
> LLVMConstInt(ctx->i32, inst_offset, 0),
> LLVMConstInt(ctx->i32, voffset ? 1 : 0, 0), // offen
> LLVMConstInt(ctx->i32, vindex ? 1 : 0, 0), //idxen
> @@ -729,36 +729,36 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
> ARRAY_SIZE(args), AC_FUNC_ATTR_READONLY);
> }
> }
>
> LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
> LLVMValueRef rsrc,
> LLVMValueRef vindex,
> LLVMValueRef voffset,
> bool readonly_memory)
> {
> - if (HAVE_LLVM >= 0x0400) {
> + if (HAVE_LLVM >= 0x0309) {
> LLVMValueRef args [] = {
> LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
> vindex,
> voffset,
> LLVMConstInt(ctx->i1, 0, 0), /* glc */
> LLVMConstInt(ctx->i1, 0, 0), /* slc */
> };
>
> return ac_build_intrinsic(ctx,
> "llvm.amdgcn.buffer.load.format.v4f32",
> ctx->v4f32, args, ARRAY_SIZE(args),
> /* READNONE means writes can't
> * affect it, while READONLY means
> * that writes can affect it. */
> - readonly_memory ?
> + readonly_memory && HAVE_LLVM >= 0x0400 ?
> AC_FUNC_ATTR_READNONE :
> AC_FUNC_ATTR_READONLY);
> }
>
> LLVMValueRef args[] = {
> rsrc,
> voffset,
> vindex,
> };
> return ac_build_intrinsic(ctx, "llvm.SI.vs.load.input",
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 319c0c8..4e133ec 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -3435,27 +3435,29 @@ static void load_fetch_args(
>
> image_append_args(ctx, emit_data, target, false, false);
> }
> }
> }
>
> static unsigned get_load_intr_attribs(bool readonly_memory)
> {
> /* READNONE means writes can't affect it, while READONLY means that
> * writes can affect it. */
> - return readonly_memory ? LP_FUNC_ATTR_READNONE :
> + return readonly_memory && HAVE_LLVM >= 0x0400 ?
> + LP_FUNC_ATTR_READNONE :
> LP_FUNC_ATTR_READONLY;
> }
>
> static unsigned get_store_intr_attribs(bool writeonly_memory)
> {
> - return writeonly_memory ? LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY :
> + return writeonly_memory && HAVE_LLVM >= 0x0400 ?
> + LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY :
> LP_FUNC_ATTR_WRITEONLY;
> }
>
> static void load_emit_buffer(struct si_shader_context *ctx,
> struct lp_build_emit_data *emit_data,
> bool readonly_memory)
> {
> const struct tgsi_full_instruction *inst = emit_data->inst;
> struct gallivm_state *gallivm = &ctx->gallivm;
> LLVMBuilderRef builder = gallivm->builder;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list