[Mesa-dev] [PATCH 1/5] ac: properly document a buffer.store LLVM workaround
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Oct 3 18:49:59 UTC 2017
2-5 are:
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
On 10/03/2017 07:30 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/amd/common/ac_llvm_build.c | 13 ++++++++-----
> src/amd/common/ac_llvm_build.h | 2 +-
> 2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
> index 51fb009..0cebaa7 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -753,42 +753,45 @@ void
> ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
> LLVMValueRef rsrc,
> LLVMValueRef vdata,
> unsigned num_channels,
> LLVMValueRef voffset,
> LLVMValueRef soffset,
> unsigned inst_offset,
> bool glc,
> bool slc,
> bool writeonly_memory,
> - bool has_add_tid)
> + bool swizzle_enable_hint)
> {
> - /* TODO: Fix stores with ADD_TID and remove the "has_add_tid" flag. */
> - if (!has_add_tid) {
> + /* SWIZZLE_ENABLE requires that soffset isn't folded into voffset
> + * (voffset is swizzled, but soffset isn't swizzled).
> + * llvm.amdgcn.buffer.store doesn't have a separate soffset parameter.
> + */
> + if (!swizzle_enable_hint) {
> /* Split 3 channel stores, becase LLVM doesn't support 3-channel
> * intrinsics. */
> if (num_channels == 3) {
> LLVMValueRef v[3], v01;
>
> for (int i = 0; i < 3; i++) {
> v[i] = LLVMBuildExtractElement(ctx->builder, vdata,
> LLVMConstInt(ctx->i32, i, 0), "");
> }
> v01 = ac_build_gather_values(ctx, v, 2);
>
> ac_build_buffer_store_dword(ctx, rsrc, v01, 2, voffset,
> soffset, inst_offset, glc, slc,
> - writeonly_memory, has_add_tid);
> + writeonly_memory, swizzle_enable_hint);
> ac_build_buffer_store_dword(ctx, rsrc, v[2], 1, voffset,
> soffset, inst_offset + 8,
> glc, slc,
> - writeonly_memory, has_add_tid);
> + writeonly_memory, swizzle_enable_hint);
> return;
> }
>
> unsigned func = CLAMP(num_channels, 1, 3) - 1;
> static const char *types[] = {"f32", "v2f32", "v4f32"};
> char name[256];
> LLVMValueRef offset = soffset;
>
> if (inst_offset)
> offset = LLVMBuildAdd(ctx->builder, offset,
> diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
> index 1d6dc0a..ac8ea9c 100644
> --- a/src/amd/common/ac_llvm_build.h
> +++ b/src/amd/common/ac_llvm_build.h
> @@ -163,21 +163,21 @@ void
> ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
> LLVMValueRef rsrc,
> LLVMValueRef vdata,
> unsigned num_channels,
> LLVMValueRef voffset,
> LLVMValueRef soffset,
> unsigned inst_offset,
> bool glc,
> bool slc,
> bool writeonly_memory,
> - bool has_add_tid);
> + bool swizzle_enable_hint);
> LLVMValueRef
> ac_build_buffer_load(struct ac_llvm_context *ctx,
> LLVMValueRef rsrc,
> int num_channels,
> LLVMValueRef vindex,
> LLVMValueRef voffset,
> LLVMValueRef soffset,
> unsigned inst_offset,
> unsigned glc,
> unsigned slc,
>
More information about the mesa-dev
mailing list