[LLVMdev] loop vectorizer
Arnold Schwaighofer
aschwaighofer at apple.com
Wed Nov 6 08:21:08 PST 2013
On Nov 6, 2013, at 7:42 AM, Frank Winter <fwinter at jlab.org> wrote:
> On 06/11/13 08:54, Arnold wrote:
>>
>>
>> Sent from my iPhone
>>
>> On Nov 5, 2013, at 7:39 PM, Frank Winter <fwinter at jlab.org> wrote:
>>
>>> Good that you bring this up. I still have no solution to this vectorization problem.
>>>
>>> However, I can rewrite the code and insert a second loop which eliminates the 'urem' and 'div' instructions in the index calculations. In this case, the inner loop's trip count would be equal to the SIMD length and the loop vectorizer ignores the loop. Unrolling the loop and SLP is not an option, since the loop body can get lengthy.
>>>
>>> What would be a quicker to implement:
>>>
>>> a) Teach the loop vectorizer the 'urem' and 'div' instructions, or
>>
>> This would probably be harder because your individual accesses are consecutive within a stride.
>>
>> a[0] a[1] a[3] a[4] a[9] a[10] a[11] a[12]
>>
>> Not something the loop vectorizer currently understands.
>>> b) have the loop vectorizer process loops with trip count equal to the vector length ?
>>
>> You should be able to change "TinyTripCountVectorThreshold" in loopvectorizer.cpp
>
> I managed to set this option when using 'opt' tool. Is there a way to set it when using the API without changing the default value in the source code and recompiling LLVM?
I think you should be able to set this flag using
char *SetTinyVectorThreshold = “fooprog -vectorizer-min-trip-count=4”;
llvm::cl::ParseCommandLineOptions(3, SetTinyVectorThreshold);
at the beginning of your program. This is ugly and would be short time solution until we add parameters to the createLoopVectorizerPass function to allow you to set this during pass creation.
More information about the llvm-dev
mailing list