[Mesa-dev] [PATCH 14/15] ac: place amdgpu.uniform on loads instead of GEPs

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Jan 8 21:21:47 UTC 2018



On 01/06/2018 12:12 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   src/amd/common/ac_llvm_build.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
> index 164f310..ed00d20 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -775,25 +775,28 @@ ac_build_indexed_store(struct ac_llvm_context *ctx,
>    *                  dynamically uniform (i.e. load to an SGPR)
>    * \param invariant Whether the load is invariant (no other opcodes affect it)
>    */
>   static LLVMValueRef
>   ac_build_load_custom(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
>   		     LLVMValueRef index, bool uniform, bool invariant)
>   {
>   	LLVMValueRef pointer, result;
>   
>   	pointer = ac_build_gep0(ctx, base_ptr, index);
> -	if (uniform)
> +	/* This will be removed by InstCombine if index == 0. */
> +	if (HAVE_LLVM < 0x0600 && uniform)

IMHO, it would be better to add more explanations here.

Also, I would like to test 11, so for now 12-14 are:

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

>   		LLVMSetMetadata(pointer, ctx->uniform_md_kind, ctx->empty_md);
>   	result = LLVMBuildLoad(ctx->builder, pointer, "");
>   	if (invariant)
>   		LLVMSetMetadata(result, ctx->invariant_load_md_kind, ctx->empty_md);
> +	if (HAVE_LLVM >= 0x0600 && uniform)
> +		LLVMSetMetadata(result, ctx->uniform_md_kind, ctx->empty_md);
>   	return result;
>   }
>   
>   LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
>   			   LLVMValueRef index)
>   {
>   	return ac_build_load_custom(ctx, base_ptr, index, false, false);
>   }
>   
>   LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx,
> 


More information about the mesa-dev mailing list