[Mesa-dev] [PATCH v2 5/7] ac: add LLVM build functions for subgroup instrinsics
Marek Olšák
maraeo at gmail.com
Tue Mar 20 14:36:12 UTC 2018
On Fri, Mar 16, 2018 at 5:50 AM, Daniel Schürmann <
daniel.schuermann at campus.tu-berlin.de> wrote:
> Co-authored-by: Connor Abbott <cwabbott0 at gmail.com>
> Signed-off-by: Daniel Schürmann <daniel.schuermann at campus.tu-berlin.de>
> ---
> src/amd/common/ac_llvm_build.c | 475 ++++++++++++++++++++++++++++++
> +++++++++++
> src/amd/common/ac_llvm_build.h | 33 ++-
> 2 files changed, 507 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_
> build.c
> index 67d15d5cb3..e4ae7fdbcc 100644
> --- a/src/amd/common/ac_llvm_build.c
> +++ b/src/amd/common/ac_llvm_build.c
> @@ -2426,3 +2426,478 @@ LLVMValueRef ac_unpack_param(struct
> ac_llvm_context *ctx, LLVMValueRef param,
> }
> return value;
> }
> +
> +static LLVMValueRef
> +_ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef src,
> LLVMValueRef lane)
> +{
> + ac_build_optimization_barrier(ctx, &src);
> + return ac_build_intrinsic(ctx,
> + lane == NULL ? "llvm.amdgcn.readfirstlane" :
> "llvm.amdgcn.readlane",
> + LLVMTypeOf(src), (LLVMValueRef []) {
> + src, lane },
> + lane == NULL ? 1 : 2,
> + AC_FUNC_ATTR_NOUNWIND |
>
NOUNWIND is always set by ac_build_intrinsic and doesn't have to be listed
here. Same for all NOUNWIND occurences below.
> + AC_FUNC_ATTR_READNONE |
> + AC_FUNC_ATTR_CONVERGENT);
> +}
> +
> +/**
> + * Builds the "llvm.amdgcn.readlane" or "llvm.amdgcn.readfirstlane"
> intrinsic.
> + * @param ctx
> + * @param src
> + * @param lane - id of the lane or NULL for the first active lane
> + * @return value of the lane
> + */
> +LLVMValueRef
> +ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef src,
> LLVMValueRef lane)
> +{
> + LLVMTypeRef src_type = LLVMTypeOf(src);
> + src = ac_to_integer(ctx, src);
> + unsigned bits = LLVMGetIntTypeWidth(LLVMTypeOf(src));
> + LLVMValueRef ret;
>
add an empty line after declarations
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180320/c5a97e09/attachment.html>
More information about the mesa-dev
mailing list