[Mesa-dev] [PATCH] radv/ac: enable loop unrolling.

Dave Airlie airlied at gmail.com
Fri Feb 24 03:44:32 UTC 2017


On 24 February 2017 at 13:36, Matt Arsenault <arsenm2 at gmail.com> wrote:
>
> On Feb 23, 2017, at 19:27, Dave Airlie <airlied at gmail.com> wrote:
>
> +static void set_unroll_metadata(struct nir_to_llvm_context *ctx,
> +        LLVMValueRef br)
> +{
> + unsigned kind = LLVMGetMDKindIDInContext(ctx->context, "llvm.loop", 9);
> + LLVMValueRef md_unroll;
> + LLVMValueRef full_arg = LLVMMDStringInContext(ctx->context,
> "llvm.loop.unroll.full", 21);
> + LLVMValueRef full = LLVMMDNodeInContext(ctx->context, &full_arg, 1);
> +
> + LLVMValueRef md_args[] = {NULL, full};
> + md_unroll = LLVMMDNodeInContext(ctx->context, md_args, 2);
> + ac_metadata_point_op0_to_itself(md_unroll);
> +
> + LLVMSetMetadata(br, kind, md_unroll);
> +}
> +
>
>
> Why are you forcing full unrolling of all loops?

Because I copied Marek's code with little idea of what llvm does.

Should I just drop the full bits, perhaps set a llvm.loop.unroll.count = 32?

Dave.


More information about the mesa-dev mailing list