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

Matt Arsenault arsenm2 at gmail.com
Fri Feb 24 04:36:31 UTC 2017


> On Feb 23, 2017, at 19:44, Dave Airlie <airlied at gmail.com> wrote:
> 
> On 24 February 2017 at 13:36, Matt Arsenault <arsenm2 at gmail.com <mailto: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.

The question is more why are you using the unroll metadata at all? It’s for implementing user hints like pragma unroll. By default the backend heuristics should be making these decisions. If this is helping benchmarks then that’s a datapoint that we need to play with those and increase the thresholds or something.

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170223/0dd28391/attachment.html>


More information about the mesa-dev mailing list