Hello,
I am entirely new to the realms of LLVM, MLIR, and OpenScop. I was trying to understand how the polyhedral model works and luckily found OpenScop documentation where the author explained very beginner-friendly way.
However, I encountered some confusion at a certain point during my reading, and I am seeking assistance in understanding the specific section that has me puzzled. I couldn’t find an OpenScop forum for queries. So I thought this forum may be the appropriate place to seek guidance.
Here is the documentation link: OpenScop Documentation.
In section 2.2.1 Iteration Domain
pi = 3.14; // S1
for (i = 0; i < 5; i++)
A[i] = pi; // S2
The above code example is used for analysis. Here, one execution of a statement is referred to as a statement instance. This means that each statement, such as S1 and S2, acts like a class, and when a statement is executed once, an instance of that statement is created.
So, the list of statement instances is the following:
pi = 3.14;
A[0] = pi;
A[1] = pi;
A[2] = pi;
A[3] = pi;
A[4] = pi;
My confusion begins regarding notation. To illustrate my confusion, I’d like to directly quote a line from the documentation:
In the polyhedral model we consider statements as functions of the outer loop counters that may produce statement instances: instead of simply “S2”, we use preferably the notation S2(i). For instance we denote the statement instance A[3] = pi; of the previous example as S2(3). This means instance of statement S2 for i = 3.
The above section is clear to me. However, in the subsequent part, they attempt to give a slightly different way of reading the notation using the same example, denoted as S2(3). I am quoting the line that has led to my confusion:
The ordered list of iterators (ordered from the outermost iterator to the innermost iterator) is called the iteration vector . For instance the iteration vector for
S3
is(i,j)
, forS2
it is(i)
, and forS1
it is empty since it has no enclosing loop:()
. A more precise reading at the notationS2(3)
would show that it denotes the instance of statementS2
for the iteration vector(2)
.
Now the question:
The precise notation for S2(3), denotes an instance of S2 for the iteration vector (2). However, I am puzzled as to why it isn’t supposed to be for the iteration vector (3). If the iteration vector is indeed (2), could someone kindly explain how this conclusion is reached? I apologize for this seemingly naive question.
Thanks in advance!