[LLVMdev] How to make Polly ignore some non-affine memory accesses

Marcello Maggioni
Fri, 07 Oct 2011 14:25:27 -0000

Hi, I'd like to ask another thing about Polly and SCoP discarding.

I've noticed that Polly discards quite simple loops like:

for (int i = 1; i < 1000; i++) {}

or

for (int i= 0; i < 1000; i+=2) {}

is this an intended behavior or there is some way to make it accept
these kind of loops ?

Thanks,
Marcello

2011/10/3 Marcello Maggioni <hayarms at
gmail.com>:
> Hi Tobias,
>
> thanks for the answer. I'll try to give a look to the code you pointed
> me to , and I'll try to make the modification myself. I'm new to
LLVM
> and Polly, but the code of both seem clean and understandable, so I
> hope to be able to do it myself. In case I'll ask here for support :)
>
> Marcello
>
> 2011/10/1 Tobias Grosser <tobias at grosser.es>:
>> On 10/01/2011 03:26 PM, Marcello Maggioni wrote:
>>>
>>> Hello everyone,
>>>
>>> I'm trying to use LLVM+Polly to obtain a polyhedral
representation of
>>> some loops to use later for passes I want to implement, but seems
like
>>> Polly will stop when reaching any statement that has non-affine
access
>>> functions of the loop bounds discarding the whole SCoP entirely.
>>>
>>> What I would like to achieve is still getting some information for
the
>>> statements that , instead, have affine access functions,
practically
>>> "ignoring" the non-affine ones.
>>>
>>> There is a way to do such a thing?
>>
>> Hi Marcello,
>>
>> this is not yet integrated into Polly, but a very valuable extension
which I
>> planned to integrate myself. In case you want to give it a try,
>> I am very glad to help you.
>>
>> Basically, what you want is to adapt lib/Analysis/ScopDetection.cpp to
>> not reject non-affine constructs. In lib/Analysis/ScopInfo.cpp we would
>> need to adapt the translation into the polyhedral description. Instead
of
>> creating a map defining an affine must access (such as
>> Stmt[i,j] -> A[2 * i + j]), we create a map that defines a may
access to all
>> elements of the corresponding array. Something like 'Stmt[i,j]
-> A[x]'.
>>
>> Cheers
>> Tobi
>>
>>
>