"expecting function with parameter domain" with "isl_aff_unbind_params_insert_domain"

73 views
Skip to first unread message

Pei Mu

unread,
Aug 16, 2021, 9:00:06 AM8/16/21
to isl Development
Hi,
I got some problems when coding to get the schedule tree about the following code:
```
  for (int iter0 = 0; iter0 < 64; iter0++) {
    for (int iter1 = 0; iter1 < 8; iter1++) {
S:    Var2[iter0*8+iter1] = Var0[iter0*8+iter1] + Var1[iter0*8+iter1];
    }   
  }
```
And I get the schedule tree by ppcg, like:
```
domain: "{ S[iter0, iter1] : 0 <= iter0 <= 63 and 0 <= iter1 <= 7 }"
child:
  schedule: "L_0[{ S[iter0, iter1] -> [(iter0)] }]"
  permutable: 1
  coincident: [ 1 ]
  child:
    schedule: "L_1[{ S[iter0, iter1] -> [(iter1)] }]"
    permutable: 1
    coincident: [ 1 ]

```
It's cool.

Now I want to implement my own schedule tree builder. but when I try to get the memory access relation, I met the error report: "expecting function with parameter domain" with "isl_aff_unbind_params_insert_domain"
Actually, I have no idea what it means.

I wish I could describe my code clearly:
1. Get the domain schedule: 
```domain: "{ S[iter0, iter1] : 0 <= iter0 <= 63 and 0 <= iter1 <= 7 }"```
2. Get the memory access by adding "Var2" to the domain space by the "isl_space_add_named_tuple_id_ui", and named it "tmp_space":
```
[iter0, iter1] -> { Var2[i0, i1] } // I guess this might need to be correct to [iter0, iter1] -> { Var2[iter0, iter1] }
```
And the isl_multi_id from such tmp_space, by "isl_multi_id_from_id_list", and named it "coordinate":
```
[iter0, iter1] -> { Var2[iter0, iter1] }
```
3. Get the first aff param on such tmp_space, by "isl_aff_param_on_domain_space_id", and named it "domain_aff_bounds":
```
[iter0, iter1] -> { Var2[i0, i1] -> [(iter0)] }
```
Then I try to write:
```
isl_aff_unbind_params_insert_domain(isl_aff_copy(domain_aff_bounds), coordinate)
```
And the error "expecting function with parameter domain" occurred.

Thank you very much for your patient, I appreciate that a lot.

The isl version is 0.24, and the cpp source code is attached. I would appreciate it a lot if you could reply!

Pei
error_code.cpp

Sven Verdoolaege

unread,
Aug 17, 2021, 12:11:01 PM8/17/21
to Pei Mu, isl Development
On Mon, Aug 16, 2021 at 06:00:06AM -0700, Pei Mu wrote:
> Hi,
> I got some problems when coding to get the schedule tree about the
> following code:
> ```
> for (int iter0 = 0; iter0 < 64; iter0++) {
> for (int iter1 = 0; iter1 < 8; iter1++) {
> S: Var2[iter0*8+iter1] = Var0[iter0*8+iter1] + Var1[iter0*8+iter1];
> }
> }
> ```
>
> Now I want to implement my own schedule tree builder. but when I try to get
> the memory access relation, I met the error report: "expecting function
> with parameter domain" with "isl_aff_unbind_params_insert_domain"
> Actually, I have no idea what it means.
>
> I wish I could describe my code clearly:
> 1. Get the domain schedule:
> ```domain: "{ S[iter0, iter1] : 0 <= iter0 <= 63 and 0 <= iter1 <= 7 }"```

I don't understand why you bring up a schedule here.
Apparently you don't have a schedule yet and you are trying
to construct an access relation.
I'll assume this is meant to be the domain of the access relation.

> 2. Get the memory access by adding "Var2" to the domain space by the
> "isl_space_add_named_tuple_id_ui", and named it "tmp_space":
> ```
> [iter0, iter1] -> { Var2[i0, i1] } // I guess this might need to be correct
> to [iter0, iter1] -> { Var2[iter0, iter1] }
> ```

Are you trying to construct `[iter0, iter1] -> { Var2[iter0*8+iter1] }`?
Then clearly, this is the wrong space.

> And the isl_multi_id from such tmp_space, by "isl_multi_id_from_id_list",
> and named it "coordinate":
> ```
> [iter0, iter1] -> { Var2[iter0, iter1] }
> ```
> 3. Get the first aff param on such tmp_space, by
> "isl_aff_param_on_domain_space_id", and named it "domain_aff_bounds":
> ```
> [iter0, iter1] -> { Var2[i0, i1] -> [(iter0)] }
> ```

What is this meant to represent? That is, why did you construct this?

> Then I try to write:
> ```
> isl_aff_unbind_params_insert_domain(isl_aff_copy(domain_aff_bounds),
> coordinate)
> ```

The function you constructed above already has a domain,
so you can't insert one.
isl_aff_unbind_params_insert_domain can only be used on a function
that does not have a domain tuple.
What are you trying to do here?

Btw, you may want to use the C++ interface.
In particular, if you use the templated C++ interface,
then the equivalent of the code above wouldn't even compile.

skimo

Pei Mu

unread,
Aug 17, 2021, 11:19:33 PM8/17/21
to isl Development
Hi skimo,

Thanks a lot for your reply! 

> I don't understand why you bring up a schedule here. 
> Apparently you don't have a schedule yet and you are trying 
> to construct an access relation. 
> I'll assume this is meant to be the domain of the access relation. 
Yes, you are right. It's the domain of the access relation.

> > for (int iter0 = 0; iter0 < 64; iter0++) { 
> > for (int iter1 = 0; iter1 < 8; iter1++) { 
> > S: Var2[iter0*8+iter1] = Var0[iter0*8+iter1] + Var1[iter0*8+iter1]; 
> > } 
> > } 
> Are you trying to construct `[iter0, iter1] -> { Var2[iter0*8+iter1] }`? 
> Then clearly, this is the wrong space. 
Sorry for the error input C code, which should be:
```S: Var2[iter0][iter1] = Var0[iter0][iter1] + Var1[iter0][iter1]; ```

> > 3. Get the first aff param on such tmp_space, by 
> > "isl_aff_param_on_domain_space_id", and named it "domain_aff_bounds": 
> > ``` 
> > [iter0, iter1] -> { Var2[i0, i1] -> [(iter0)] } 
> > ``` 
>
> What is this meant to represent? That is, why did you construct this? 
I just learned from the AKG(Auto Kernel Gerenation) code and I not sure about what it actually mean.
I guess this code want to get the loop iterator info - "iter0". I will go to the AKG community(if exist) to confirm.

> The function you constructed above already has a domain, 
> so you can't insert one. 
> isl_aff_unbind_params_insert_domain can only be used on a function 
> that does not have a domain tuple. 
I've now understod, thank you.

> Btw, you may want to use the C++ interface. 
> In particular, if you use the templated C++ interface, 
> then the equivalent of the code above wouldn't even compile. 
Yes, I'm writting with the c++ interface.

Actually, I just want to make a toy demo with isl, which includes:
1. extracting schedule tree from the AST(I've finished my lexcer and parser, and get an AST);
2. instance access relation analysis and dependency analysis;
3. schedule transformation.

I chos the AKG at the first glance. PPCG and TC seem a bit complex. But it looks difficult either to learn from the AKG.
May be I should start with iscc or  barvinok?

Thanks again,
Pei

Sven Verdoolaege

unread,
Aug 19, 2021, 2:05:35 PM8/19/21
to Pei Mu, isl Development
On Tue, Aug 17, 2021 at 08:19:33PM -0700, Pei Mu wrote:
> Actually, I just want to make a toy demo with isl, which includes:
> 1. extracting schedule tree from the AST(I've finished my lexcer and
> parser, and get an AST);
> 2. instance access relation analysis and dependency analysis;
> 3. schedule transformation.
>
> I chos the AKG at the first glance. PPCG and TC seem a bit complex. But it
> looks difficult either to learn from the AKG.

The schedule tree and access relation construction in TC
are a lot simpler than in pet, partly because the input
is simpler language is simpler to analyze.
I'm not familiar with AKG.

> May be I should start with iscc or barvinok?

I guess that depends on what you want to do with them,
but iscc doesn't expose any low-level construction funtions
(since it's an interactive environment where set/relations
are assumed to be written be hand) or schedule tree functionality.
The pyhton interface may be more useful for experimenting
with these things.

skimo

Pei Mu

unread,
Aug 19, 2021, 10:38:50 PM8/19/21
to isl Development
Awesome! Thanks for your help! I will check out TC and isl python interface.

Pei

Reply all
Reply to author
Forward
0 new messages