[Mesa-dev] [PATCH 1/2] amd/common: import get_{load, store}_intr_attribs() from RadeonSI

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Jan 10 13:40:49 UTC 2018



On 01/10/2018 02:24 PM, Grazvydas Ignotas wrote:
> On Wed, Jan 10, 2018 at 1:57 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/amd/common/ac_llvm_build.c                    | 12 ++---------
>>   src/amd/common/ac_llvm_util.c                     | 18 ++++++++++++++++
>>   src/amd/common/ac_llvm_util.h                     |  6 ++++++
>>   src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 26 +++++------------------
>>   4 files changed, 31 insertions(+), 31 deletions(-)
>>
>> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
>> index efc6fa12e5..07044142b0 100644
>> --- a/src/amd/common/ac_llvm_build.c
>> +++ b/src/amd/common/ac_llvm_build.c
>> @@ -983,11 +983,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
>>
>>          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. */
>> -                                 can_speculate && HAVE_LLVM >= 0x0400 ?
>> -                                         AC_FUNC_ATTR_READNONE :
>> -                                         AC_FUNC_ATTR_READONLY);
>> +                                 ac_get_load_intr_attribs(can_speculate));
>>   }
>>
>>   LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
>> @@ -1007,11 +1003,7 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
>>          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. */
>> -                                 can_speculate && HAVE_LLVM >= 0x0400 ?
>> -                                         AC_FUNC_ATTR_READNONE :
>> -                                         AC_FUNC_ATTR_READONLY);
>> +                                 ac_get_load_intr_attribs(can_speculate));
>>   }
>>
>>   /**
>> diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
>> index 429904c040..976d6540a1 100644
>> --- a/src/amd/common/ac_llvm_util.c
>> +++ b/src/amd/common/ac_llvm_util.c
>> @@ -240,3 +240,21 @@ ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
>>          snprintf(str, sizeof(str), "%i", value);
>>          LLVMAddTargetDependentFunctionAttr(F, name, str);
>>   }
>> +
>> +unsigned
>> +ac_get_load_intr_attribs(bool can_speculate)
>> +{
>> +       /* READNONE means writes can't affect it, while READONLY means that
>> +        * writes can affect it. */
>> +       return can_speculate && HAVE_LLVM >= 0x0400 ?
>> +                                AC_FUNC_ATTR_READNONE :
>> +                                AC_FUNC_ATTR_READONLY;
>> +}
>> +
>> +unsigned
>> +ac_get_store_intr_attribs(bool writeonly_memory)
>> +{
>> +       return writeonly_memory && HAVE_LLVM >= 0x0400 ?
>> +                                 AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY :
>> +                                 AC_FUNC_ATTR_WRITEONLY;
>> +}
> 
> What about putting such tiny functions in the header as static inline
> to avoid function call overheads?

I can do that, yes.

> 
> GraÅžvydas
> 


More information about the mesa-dev mailing list