[PATCH] D84779: [AMDGPU] Add amdgpu specific loop threshold metadata

Tim Corringham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 11:28:41 PDT 2020


timcorringham added a comment.

You are correct that the threshold value is something of a magic number, but it is what the unroll pass uses to help decide whether to unroll a loop fully or partially. Even when using an unroll factor the amount of unrolling performed may change in response to changes which affect the loop size computation if that pushes the loop over the threshold.

The threshold used by the loop unroll pass is set by the target specific loop preferences, which can use heuristics to adjust it. The llvm.loop.unroll.threshold is used by the amdgpu target loop preferences as the starting value before heuristics are applied, but it would be possible for the value to be used in other ways by other targets.

The motivation for this is our vulkan front end which can have some insights into the workload that are not apparent from the IR alone, so the metadata is a way to use that information to help guide the loop unroll process.  It may be that the value passed will be changed over time in response to test results if they indicate that other changes have affected the unrolling decisions, but that is no different to a lot of other settings.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84779/new/

https://reviews.llvm.org/D84779



More information about the llvm-commits mailing list